Hey all,
we ran into the same problem on 10.7 in our products (just:play and just:live
by ToolsOnAir), here's my bugreport's Radar ID: #10619051
We use a workaround for this issue that's not really pretty: parsing the .qtz
file itself for the menu items. You may want to refactor the code below to not
read in the composition every time it is called and maybe to return menu items
for all input ports that have them. In our code, we check if there's something
there for QCPortAttributeMenuItemsKey for index input ports and if not, we use
the code below.
Cheers,
Marco
// Returns the menu items defined in Quartz Composer for index input ports
// This methods tries to read them directly from the .qtz file instead of using
QCCompositionRenderer's QCPortAttributeMenuItemsKey because on Mac OS X 10.7,
nothing is returned for that key
// The passed in portName is the string found in the .qtz file in
/inputParameters/<portName>
- (NSArray*)menuItemsFromFileForPortNamed:(NSString*)portName {
NSString* qtzFile = [[NSBundle mainBundle] pathForResource:@"Popup Test"
ofType:@"qtz"]; // Modify me
NSDictionary* qtzDict = [NSDictionary dictionaryWithContentsOfFile:qtzFile];
NSDictionary* rootPatch = [qtzDict objectForKey:@"rootPatch"];
NSDictionary* state = [rootPatch objectForKey:@"state"];
NSArray* publishedInputPorts = [state objectForKey:@"publishedInputPorts"];
NSString* portKey = nil;
for (NSDictionary* port in publishedInputPorts) {
// Find published input port's key for the given port name
// Find the name in /rootPatch/state/publishedInputPorts[x]/key
if ([[port objectForKey:@"key"] isEqualToString:portName]) {
// Found key
portKey = [port objectForKey:@"node"];
break;
}
}
if (portKey != nil) {
NSArray* nodes = [state objectForKey:@"nodes"];
for (NSDictionary* node in nodes) {
NSString* nodeKey = [node objectForKey:@"key"];
// Check the portKey is this node's name as found in
/rootPatch/state/nodes[x]/key
if ([nodeKey isEqualToString:portKey]) {
NSString* nodeClass = [node objectForKey:@"class"];
// Sanity check: this port must be a QCSplitter
if ([nodeClass isEqualToString:@"QCSplitter"]) {
NSDictionary* nodeState = [node objectForKey:@"state"];
// Get labels from
/rootPatch/state/nodes[x]/state/indexLabels
NSArray* labels = [nodeState objectForKey:@"indexLabels"];
NSMutableArray* menuItems = [NSMutableArray
arrayWithCapacity:labels.count];
for (NSString* label in labels) {
// Quartz Composer inserts "-" as separators in popup
menus, we ignore them
if ([label isEqualToString:@"-"] == NO) {
[menuItems addObject:label];
}
}
return menuItems;
}
}
}
}
// Nothing found
return nil;
}
On 22.12.2011, at 10:52, Achim Breidenbach wrote:
> Hello Vade,
>
> (sorry for the big delay in my responds)
>
> we encountered a very similar problem when using QuartzComposer on 10.7 the
> first time to create some layers for BoinxTV. We lost most of the published
> port definitions and the UI in BoinxTV was messed up because we rely on them.
> Because of that I am still working on 10.6... :-/
>
> We filed a bug in July (#9729607) but didn't get any responds.
>
> @ChristopherW? Any news?
>
> best,
>
> Achim Breidenbach
> Boinx Software Ltd.
>
>
> On 13.12.2011, at 23:14, vade wrote:
>
>>
>> Hello.
>>
>> I have 2 compositions I am loading in 2 QCRenderers, and I am iterating over
>> the published input keys and their attributes. Each composition has a
>> published port, of type index, with menu items listed in the settings pane.
>> I am building a custom interface by checking for the existence of the
>> QCPortAttributeMenuItemsKey. One input splitter reports the
>> QCPortAttributeMenuItemsKey, the other does not. Looking at a very very
>> simple (attached) composition, reveals no reason for the discrepancy in the
>> QC Editor.
>>
>> However, I was able to reproduce "losing" the QCPortAttributeMenuItemsKey in
>> the one published input that worked, via Property List editor: By opening
>> the composition, and editing the UserInfo Key (actually, just removing it),
>> of the published rootPatch -> publishedInputPorts-> (published item)
>> ->state->userInfo.
>>
>> That resulted in the one working input (that returned proper
>> QCPortAttributeMenuItemsKey) to returning a key with a min and max, and no
>> menu items listed.
>>
>> Attached is two *very simple* compositions which show the issue.
>>
>> The first, "Test":
>>
>> This has an an input key published named "Texture Format", which properly
>> returns menu items. It has a second published input key named "test", which
>> in the user intefrace has menu items declared, but has no menu items
>> reported programmatically. This compostion *was not altered in any way* and
>> was the result of editing a QC composition, and noticing that ports behaved
>> differently.
>>
>> The second composition "Test Copy",
>>
>> Same as the first, in the editor, both input keys have menu items declared,
>> however, neither report any QCPortAttributeMenuItemsKey, and both report a
>> min and a max. This feat was accomplished by editing the user info keys of
>> the published ports, via Property List editor (as an experiment to try and
>> determine if I can fix this myself). My feeling is that somehow the userInfo
>> key had a min key added by somehow flipping a input splitter preference or
>> some such, but flipping it back did not remove it, resulting in a disparity
>> between the user interface, and the reported values. (total speculation...)
>>
>> I am aware there is a known bug about QCPortAttributeMenuItemsKey, but, this
>> *really* inhibits any 3rd party applications from properly loading and
>> presenting user custom interfaces by introspecting keys and their
>> attributes, especially if the behavior is inconsistent.
>>
>> Thank you.
>>
>>
>> <Test copy.qtz><Test.qtz>
>>
>> :The result of looking at "Test.qtz" via GDB, attemping to read the input
>> attributes of the port values from a loaded QCRenderer.
>>
>> (gdb) po inputAttributes
>> {
>> QCPortAttributeMaximumValueKey = 5;
>> QCPortAttributeMinimumValueKey = 0;
>> QCPortAttributeNameKey = Test;
>> QCPortAttributeTypeKey = QCPortTypeIndex;
>> }
>> (gdb) continue
>>
>> (gdb) po inputAttributes
>> {
>> QCPortAttributeMaximumValueKey = 14;
>> QCPortAttributeMenuItemsKey = (
>> "GL_RGB4",
>> "GL_RGB5",
>> "GL_RGB8",
>> "GL_RGB10",
>> "GL_RGB12",
>> "GL_RGB16",
>> "GL_RGB16F_ARB",
>> "GL_RGBA2",
>> "GL_RGBA4",
>> "GL_RGB5_A1",
>> "GL_RGBA8",
>> "GL_RGB10_A2",
>> "GL_RGBA12",
>> "GL_RGBA16",
>> "GL_RGBA16F_ARB"
>> );
>> QCPortAttributeMinimumValueKey = 0;
>> QCPortAttributeNameKey = "Texture Format";
>> QCPortAttributeTypeKey = QCPortTypeIndex;
>> }
>>
>> _______________________________________________
>> 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/achim%40boinx.com
>>
>> This email sent to [email protected]
>
> _______________________________________________
> 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/lists%40duckcode.com
>
> This email sent to [email protected]
_______________________________________________
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]