Hello everyone,
Mostly for educational purposes I'm trying to create a simple rotate tool UI window. But I feel I'm stuck on the Mel syntax and various things I tried just don't work.
-I'm using a switch case statement, but I'm wondering if I can omit this by directly inserting the axis into the rotate mel command arguments. Is this possible?
-The procedure to get the state of the radio buttons is something that I found on the Internet, do I really need this procedure to get the state of the radio buttons or is there a simpler way?
-My current error is:
// Error: Line 3.51: "$axisCollection" is an undeclared variable. //
Can anyone help me to fix this script so it works?
global proc RotateSelected(){<br> <br> string $axis = `get_radio_state($axisCollection)`;<br> <br> switch ($axis){<br> case "x":<br> rotate -r -x 10 0 0;<br> break;<br> case "y":<br> rotate -r -y 10 0 0;<br> break;<br> case "z":<br> rotate -r -z 10 0 0;<br> break;<br> <br> }<br>} <br><br>global proc string get_radio_state(string $radio)<br>{<br> string $selected = `radioCollection -q -select $radio`;<br> return `radioButton -q -label $selected`;<br>}<br><br><br>if (`window -exists myWindow`) deleteUI myWindow;<br>window -title "new window" -widthHeight 300 200 myWindow;<br> scrollLayout scrollLayout;<br> columnLayout -adjustableColumn true;<br> <br> frameLayout -label "Axis";<br><br> rowLayout -nc 3;<br> string $axisCollection = `radioCollection`;<br> radioButton -label "x";<br> radioButton -label "y";<br> radioButton -label "z";<br> setParent ..;<br> setParent ..;<br> <br> <br> frameLayout -label "Degrees";<br><br> rowLayout -nc 6;<br> string $degreesCollection = `radioCollection`;<br> radioButton -label "90";<br> radioButton -label "45";<br> radioButton -label "30";<br> radioButton -label "22,5";<br> radioButton -label "10";<br> radioButton -label "5"; <br> setParent ..;<br> setParent ..;<br> <br> <br> frameLayout -label "Rotate" -lv false;<br><br> rowLayout -nc 2;<br> button -label "-" -w 32 -h 32 -c ("RotateSelected") ;<br> button -label "+" -w 32 -h 32 -c "RotateSelected";<br> setParent ..;<br> setParent ..;<br><br><br>showWindow;
Replies
You can name your layouts instead of doing a new variable.
I'm trying to extend the script further, with adjustable pivot points. However, with the script below i get the following error when choosing the 'origin' option and i don't understand why:
// Error: line 9: Invalid flag '-pivot 0 0 0' //
The other pivot options are working correctly.
It's a bit tricky cause you will need those floats only in origin mode.
Maybe you will have to make specific rotate commands for each case.