Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > Cocoa/Quartz valueForOutputKey

Cocoa/Quartz valueForOutputKey
Thread Tools
Fresh-Faced Recruit
Join Date: Jul 2006
Status: Offline
Reply With Quote
Aug 14, 2006, 01:04 PM
 
Hi all,

I am working with a Quartz Composer composition in my Cocoa project via a QCRenderer. I have had no problems using [myQCRenderer setValue:myValue forInputKey:myKey] to set values of inputs in the quartz composition. However, when I try to read the current values of inputs or outputs I have tourble.

I am trying to do something like:

NSNumber* myQuartzOutput = [_myQCRenderer valueForOutputKey:@"myOutput"];
NSString* output = [NSString stringWithFormat:@"%d", myQuartzOutput];
NSLog(output);

Using either valueForOutputKey or valueForInputKey, the printed output is always something along the lines of: "350369552" or "350365488" etc. Which my guess would be they are memory addresses or the result of null values being passed, I'm not sure. If I assign myQuartzOutput the value 19, then 19 prints just like it is supposed to, so that narrows the problem down a bit. Does anyone have any ideas what I'm doing wrong? Any help would be appreciated.

Thanks.
     
Clinically Insane
Join Date: Oct 2001
Location: San Diego, CA, USA
Status: Offline
Reply With Quote
Aug 14, 2006, 01:20 PM
 
The format specifier "%d" makes NSString expect an int argument. You are passing an NSNumber to that, which makes it interpret the NSNumber's address as an int. What you want is [myQuartzOutput intValue].
Chuck
___
"Instead of either 'multi-talented' or 'multitalented' use 'bisexual'."
     
swfreak  (op)
Fresh-Faced Recruit
Join Date: Jul 2006
Status: Offline
Reply With Quote
Aug 14, 2006, 01:55 PM
 
Thanks for the quick reply,

I tried your suggestion and changed the line to:

output = [NSString stringWithFormat:@"%d", [myQuartzOutput intValue]];

Now the output of the program is always 0 instead of the long numbers that were printed previously. I suppose this is progress, however it is still not the expected value that should be getting printed. I double checked the quartz file and made sure that the output port was indeed published under the name that I was trying to access it by, and that the value was getting to it. Any ideas?

Thanks.
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 10:57 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2