- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I am currently trying to use the output of a menuOption dropdown menu to determine what Object i want to create when i press a button. The window, the menu and the button seem to be working in general, but the procedure of the button is not correct yet. It seems i don't correctly query what i want to or i have problems in my variable definition/declaration. Here is the script
(I use polyobjects instead of NURBS objects for testing. Don't get confused by that)
//Window deletion, followed up by window creation
if ( `window -exists MyRiggingScript` )
{
deleteUI MyRigging;
}
window -wh 300 500 MyRiggingScript;
//Layout
columnLayout;
//Variable Declaration
global string $NURBSoption = "Shape";
// Menu creation
optionMenu -label "NURBS-Shape" $NURBSoption;
menuItem -label "Circle";
menuItem -label "Square";
menuItem -label "Triangle";
//Button and Procedure:
button -w 110 -h 35 -label "Create Shape" -command "createShape()" MyButton1;
proc createShape()
{
global string $NURBSoption;
string $NURBSshape = `optionMenu -q -value $NURBSoption` ;
if ( `$NURBSshape = "Circle"` ) polySphere;
if ( `$NURBSshape = "Square"` ) polyCube;
if ( `$NURBSshape = "Triangle"` ) polyCone;
}
// Show final window
showWindow MyRiggingScript;
When I perform the script i get Syntax errors for the if-lines and also one Error for the line :
optionMenu -label "NURBS-Shape" $NURBSoption;
I can't figure out whats the problem here. I am appreciating any kind of help!
Solved! Go to Solution.