Morning everyone,
I'm setting up a script that dynamically creates optionMenus for a window. Everything works and i'm able to get the information from the actual optionMenu but i'm unable to query the label of the menu itself.
here's the code i use to create the individual option menus (again this works)...
deleteUI -window annoBlendSetup;
frameLayout -edit -enable true -cl false selectedBlendShapeFrame;
frameLayout -edit -enable false -cl true selectedControllerFrame;
button -edit -enable false buttonSetupControllers;
string $curObject[] = `ls -sl`;
string $curShape[] = `listRelatives -s $curObject[0]`;
string $curConnect[] = `listConnections -type "blendShape" $curShape[0]`;
string $blendShapeList[];
string $blendShapeNodes[] = `listAttr -m ($curConnect[0] + ".w")`;
string $annoGetVisemeList = `textField -q -text visemeList`;
string $annoVisemeList[] = stringToStringArray ($annoGetVisemeList, " ");
stringArrayInsertAtIndex(0, $blendShapeNodes, " ");
for ($i = 0; $i < `size($annoVisemeList)`; $i++)
{
string $curOptMenu = ("visemeOptionMenu" + $annoVisemeList[$i]);
print ($curOptMenu + "\n");
int $annoOptionTest = `optionMenu -exists $curOptMenu`;
if ($annoOptionTest == 1)
{
//text -edit -label ($annoVisemeList[$i] + " Viseme") -parent selectedBlendShapeFrame ($annoVisemeList[$i] + "Text") ;
optionMenu -edit -label ($annoVisemeList[$i] + " Viseme") -changeCommand "string $getCurValue = `print #1`; string $getCurLabel = `optionMenu -q -label`; annoMakeConnection($getCurValue, $getCurLabel)" -parent selectedBlendShapeFrame $curOptMenu;
}
else
{
//text -label ($annoVisemeList[$i] + " Viseme") -parent selectedBlendShapeFrame ($annoVisemeList[$i] + "Text") ;
optionMenu -label ($annoVisemeList[$i] + " Viseme") -changeCommand "string $getCurValue = `print #1`; string $getCurLabel = `optionMenu -q -label`; annoMakeConnection($getCurValue, $getCurLabel)" -parent selectedBlendShapeFrame $curOptMenu;
}
for ($m = 0; $m < `size($blendShapeNodes)`; $m++)
{
menuItem -label $blendShapeNodes[$m];
}
}
The problem i'm having is within string $getCurLabel = optionMenu -q -label; section. Basically it errors saying No object name specified. So really what i'm trying to get is the name of the label OR the name of the object w/o knowing implicitly which option menu i'm in. Is that possible?
Cheers
Bryan