I have a very simple composition that puts out an image in a
QCCompositionLayer.  That works.  I have added a simple 10 sec. timer with a
published flag (BOOL) which has been verified to work in Quartz Composer.  I
have also verified the output key for the flag.  The flag is (eventually)
supposed to tell me when the composition is finished.

    Trying to use an observer to monitor it has failed.
observeValueForKeyPath is never called.  Am I going to have to poll it? Or
is there some stupid mistake in the following?


(KTerminateCompositionFlag = @"terminated")

- (void)installLayer:(BOOL)install {
    if(install) {
        CALayer* attentionLayer = [self attentionLayer];
        if(attentionLayer == nil)
            return;

        [[compLayer composition] addObserver:self
                    forKeyPath:kTerminateCompositionFlag
                       options:NSKeyValueObservingOptionNew
                       context:NULL];

        [attentionLayer addSublayer:compLayer];
        //    Start playing.  Supposed to be automatic.
    }
    else {
        [compLayer removeFromSuperlayer];
        [[compLayer composition] removeObserver:self
forKeyPath:kTerminateCompositionFlag];
    }
}

- (void)observeValueForKeyPath:(NSString *)keyPath
                      ofObject:(id)observedObject
                        change:(NSDictionary *)change
                       context:(void *)context
{ 
    //    Let us know when composition terminates
    if ([keyPath isEqualToString:kTerminateCompositionFlag]) {
        BOOL result = [[[compLayer composition]
valueForKey:kTerminateCompositionFlag] boolValue];
        if(result)    //    The only case it should be.
            [self endComposition];
    }
}


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Quartzcomposer-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/quartzcomposer-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to