[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[sc-dev] view getProperty question

Is it possible to set the class of a return object when getProperty is called?

I've been working on adding a Quartz Composer view, and have implemented a method to get the values of QC output ports. The SC side looks like this:

^this.getProperty(\getOutputValue, key.asSymbol);

The key is the name of the port to be read. This works fine for ints and floats, but if I want to get a Color:

if (strcmp(name, "getOutputValue")==0) {
PyrSymbol *keysymbol;
int err = slotSymbolVal(slot, &keysymbol);
if (err) return err;

NSString *key = [[NSString alloc] initWithCString: keysymbol->name encoding: NSASCIIStringEncoding];
if(![[mQCView outputKeys] containsObject: key]) {
[key release];
return errFailed;

NSDictionary *outputAttributes = [[mQCView attributes] objectForKey: key];
NSString *type = [outputAttributes objectForKey:QCPortAttributeTypeKey];

else if([type isEqualToString:QCPortTypeColor]) {
NSColor *val = [mQCView valueForOutputKey: key];
SCColor rgb = SCMakeColor([val redComponent], [val greenComponent], [val blueComponent], [val alphaComponent]);
err = setSlotColor(slot, &rgb);
[key release];
return errNone;

it fails with errWrongType at setSlotColor because the slot is of the wrong type. Can one change this and if so, how?