Beer glass scene creation
This course contains a little bit of everything with modeling, UVing, texturing and dynamics in Maya, as well as compositing multilayered EXR's in Photoshop.
# 1 14-06-2015 , 06:02 PM
Registered User
Join Date: Jun 2015
Posts: 1

Simple MEL Help almost done.

Dashboard_avatar
Michael Park
Jun 14, 2015
Quote Reply Post id: 315335 Report Item
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.
if (`window -exists setCreateTool` ==1)

// Delete if it exists.
deleteUI setCreateTool;

// Define the selection.
string $sSelection[]= `ls -sl`;

// 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.
if (`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()";
showWindow setCreateTool;
}

}

global proc createSetFunction()

{

// GIVE A VALUE TO THE TEXT FIELD BY QUERYING!
string $tData = `textField -query -text textFieldData`;

// print $tData;
// Define the selection
string $sSelection[]= `ls -sl`;

// 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]);
}

}

setCreateTool;

Posting Rules Forum Rules
You may not post new threads | You may not post replies | You may not post attachments | You may not edit your posts | BB code is On | Smilies are On | [IMG] code is On | HTML code is Off

Similar Threads