Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: QCRenderer and getting the OutputPort values



Thanks for the response Pierre-Olivier.  Is there example code that you know of that creates windows of QCRenderers that have input and output ports feeding and receiving data?

When doing:
[renderer addObserver:self forKeyPath:@"imageClickA" options:0 context:NULL];
... I never receive the imageClickA (my published port), when I passed the click through to the composition.

I do have a :
- (void) observeValueForKeyPath:(NSString*)keyPath ofObject:(id)object
change:(NSDictionary*)change context:(void*)context
{
NSLog(@"got it");
}
defined for "self" but it never gets called.

In my :
- (void) renderWithEvent:(NSEvent*)event
... I have:
NSLog(@"Sending Event to renderer");
if(![renderer renderAtTime:time arguments:arguments])
NSLog(@"Rendering failed at time %.3fs", time);

//Parse any output events
NSNumber *num = [renderer valueForOutputKey:@"imageClickA"];
BOOL isClicked = [num boolValue];
NSLog(@"Value of ImageClick:%d",isClicked);
..isClicked is never anything other than 0, even though when I run this through in Quartz Composer itself the value changes.  Any ideas?

Also, why in PlayerApplication and QCRenderer do we need to call renderAtTime:time :arguments: anyway?  It seems that if we have a timer a certain interval, then why tell the renderer when to render? and if we're rendering at 60 fps, why is the "time" argument in units of seconds, instead of milliseconds?  Also, this time value is relative to the start of the application I presume, the way PlayerApplication is written?

Thanks again,
Kevin

On Jan 22, 2006, at 9:39 PM, Pierre-Olivier Latour wrote:

I've have a composition with published input and output ports defined, that worked when I used a QCView to render it, and had the addObserver: forKeyPath:  working, so that whenever an outputPort changed I would get my callback.
My problem is that my application needs to have many windows of renderers that come and go, but the docs say the QCView can only be instantiated through the IB.

You can definitely create a QCView programmatically. Just make sure you have it render only when its owner window is on screen, otherwise, things might not work correctly.

  I even tried having my own windows with the QCViews and could never get it to work.  I then migrated to using the QCRenderer class and the PlayerApplication as a base.  I've got my compositions rendering, but I can't see how to get the output values to my app.  (I have subclasses the NSApplication and am forwarding events)
From what I understand I don't need to do the addObserver: forKeyPath:.  There's a point in the QC Programming manual that says in the renderWithEvent (from PlayerApplication) that I should just call the valueForOutputKey for my key.  I've done this and it does not work.  In the QCView I use "patch.foo.Value" whereas here I just use "foo".  Any ideas?

The QCRenderer does not render the composition automatically, you have to explicitly call -renderAtTime:arguments: to render a frame, then you can call valueForOutputKey: to retrieve output values of the compositions.

Also, I'm going to have many, many outputs, so I don't want to go through them all and see if they are different than the previous values.  What is the best way to do this?  can I still add the "addObserver: forKeyPath:" ??

Yes, that works as well for the QCRenderer


________________________________________________________
Pierre-Olivier Latour                            email@hidden
Quartz Composer Team Apple Computer, Inc.





 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Quartzcomposer-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/quartzcomposer-dev/email@hidden

This email sent to email@hidden

References: 
 >QCRenderer and getting the OutputPort values (From: Kevin Kicklighter <email@hidden>)
 >Re: QCRenderer and getting the OutputPort values (From: Pierre-Olivier Latour <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.