Give the Random/Result some reason to evaluate. QC uses "lazy evaluation" which required a consumer object to call for the value in question.
So, try attaching the output to a port of a 3D transform, the Enable of a Billboard with no image going to it, or something similar, and see if result starts returning the expected ...result. -GT On Thu, Dec 2, 2010 at 2:33 PM, tra...@postfl.com <tra...@postfl.com> wrote: > Hi All, > > I'm new to quartz, but not cocoa programming. > > I'm trying to make a simple test to input and receive values from a quartz > composition. > > I'm not interested in rendering, at least at the moment. > > I built a composition with a single Random patch. > > I published the input variables as: > Min > Max > > I published the output variables as: > Result > > I saved the patch, and included it in a Cocoa project. > > (... after trying QCRenderer, QCView, and QCCompositionLayer to no > avail...) > > The example I am posting is for a QCCompositionLayer... > NSString *compositionPath = [[NSBundle mainBundle] pathForResource: > @"random" ofType:@"qtz"]; > NSNumber *n = [[[NSNumber alloc] init] retain]; > layer = [[QCCompositionLayer alloc] initWithFile:compositionPath]; > > [layer setValue:[NSNumber numberWithInt:[CFAMath randomInt:30]] > forInputKey:@"Min"]; > [layer setValue:[NSNumber numberWithInt:[CFAMath randomInt:30]+30] > forInputKey:@"Max"]; > CFALog(@"min:%@",[[layer valueForInputKey:@"Min"] description]); > CFALog(@"max:%@",[[layer valueForInputKey:@"Max"] description]); > CFALog(@"val1:%@",[[layer valueForOutputKey:@"Value"] description]); > CFALog(@"val2:%4.2f",[layer valueForOutputKey:@"Value" ofType: > @"floatValue"]); > n = [layer valueForOutputKey:@"Value"]; > CFALog(@"val3: %4.2f",[n floatValue]); > > In the console I always get: > min: --- some random value --- > max: --- some random value --- > val1:0 > val2:0.00 > val3:0.00 > > Min and max are always updating nicely, but the composition doesn't > produced an appropriate value for Result... > But, in quartz composer, the value of Result always changes > appropriately... > > Cheers, > T > > _______________________________________________ > Do not post admin requests to the list. They will be ignored. > Quartzcomposer-dev mailing list (Quartzcomposer-dev@lists.apple.com) > Help/Unsubscribe/Update your Subscription: > > http://lists.apple.com/mailman/options/quartzcomposer-dev/gtoledo3%40gmail.com > > This email sent to gtole...@gmail.com > -- George Toledo gtole...@gmail.com www.georgetoledo.com The information contained in this E-mail and any attachments may be confidential. If you have received this E-mail in error, please notify us immediately by telephone or return E-mail. You should not use or disclose the contents of this E-mail or any of the attachments for any purpose or to any persons.
_______________________________________________ Do not post admin requests to the list. They will be ignored. Quartzcomposer-dev mailing list (Quartzcomposer-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/quartzcomposer-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com