Currently trying to create a UI where after I selected a control on a rig in the text field I can name it whatever I want then click create to create a button for it. Doing this because having quick selection sets are very annoying sometimes with short names to represent certain controls. So MY PROBLEM is I can create ONE button so far, but when I click another control and try to name it and create another button it won't do anything... Please help and go easy on this noob... here is my code thank you.
global proc setCreateTool()
// Test if a window "setCreateTool" exists.
window -exists setCreateTool ==1)
// Delete if it exists.
// Define the selection.
// If nothing is selected have an error...
if (size($sSelection) == 0) error "No objects selected to create set";
// So now if a window does not currently exist create one.
window -exists setCreateTool != 1)
window -title "Set Creation Tool"
setCreateTool; columnLayout -w 200 -h 50;
// Make a text field area for typing in control names.
textField -w 200 textFieldData;
// Make a create botton.
button -label Create -width 50 -command "createSetFunction()";
global proc createSetFunction()
// GIVE A VALUE TO THE TEXT FIELD BY QUERYING!
string $tData =
textField -query -text textFieldData;
// print $tData;
// Define the selection
// Use a for statement to create a loop so you can create the sets multiple times.
// Use the array that was defined for selection and variable for querying the text field.
for ($i = 0; $i < (size($sSelection)); $i = $i + 1)
button -label $tData -command ("select " + $sSelection[$i]);