LisaMAnd
12-27-2010, 05:07 AM
Hi everyone,
I'm afraid I'm new to MEL and having trouble getting a UI to work. The script here is just supposed to take a joint and split it into even segments.
There are a couple problems- I wanted a checkbox to change which procedure is executed (either splitting the original joint or making a new hierarchy) and I wanted a slider to change the number segments. Neither of these elements are working so I commented out the checkbox and figured I'd concentrate on getting the number of segments to work.
Right now, if I specify a number for $segmentOpt it'll work- but it won't pull a number from the slider.
Sorry if this is a super basic question. I'm getting pretty lost here.
Also: Just a side note- I've been basing what I'm doing off of some of Jason Schleifer, Duncan Skertchly, and my MEL Scripting for Maya Animators book's code- so if something works they should get the credit and if something doesn't belong or is broken it's probably mine!
Any help is appreciated,
-Lisa
global proc LA_splitJointUI()
{
//Build the interface window
string $splitJointWindow = `window -t "Split Joint UI"`;
string $form = `formLayout -numberOfDivisions 100`;
$segments = `intSliderGrp -field true -l "Segments" -min 2 -max 25 slider1`;
$button1 = `button -l "Split Joints"`;
$button2 = `button -l "Cancel"`;
//$checkBox = `checkBox -l "Create as New Joint Hierarchy"`;
/* -onCommand
"button -edit -command (\"LA_splitNewJoint \" + $segmentOpt) $button1"
-offCommand
"button -edit -command (\"LA_splitJoint \" + $segmentOpt) $button1"`;
*/
formLayout -edit
-attachForm $segments top 25
-af $segments left 25
//-af $checkBox top 75
//-af $checkBox left 100
-af $button1 bottom 10
-af $button1 left 15
-af $button2 bottom 10
-af $button2 left 110
$form;
// get the value from the slider
int $segmentOpt = `intSliderGrp -q -value slider1`;
// set up the buttons
button -edit -command ("deleteUI \"" + $splitJointWindow + "\"") $button2;
button -edit -command ("LA_splitNewJoint " + $segmentOpt) $button1;
/*checkBox -onCommand
"button -edit -command (\"LA_splitNewJoint \" + $segmentOpt) $button1"
-offCommand
"button -edit -command (\"LA_splitJoint \" + $segmentOpt) $button1"
$checkBox;
*/
showWindow $splitJointWindow;
}
I'm afraid I'm new to MEL and having trouble getting a UI to work. The script here is just supposed to take a joint and split it into even segments.
There are a couple problems- I wanted a checkbox to change which procedure is executed (either splitting the original joint or making a new hierarchy) and I wanted a slider to change the number segments. Neither of these elements are working so I commented out the checkbox and figured I'd concentrate on getting the number of segments to work.
Right now, if I specify a number for $segmentOpt it'll work- but it won't pull a number from the slider.
Sorry if this is a super basic question. I'm getting pretty lost here.
Also: Just a side note- I've been basing what I'm doing off of some of Jason Schleifer, Duncan Skertchly, and my MEL Scripting for Maya Animators book's code- so if something works they should get the credit and if something doesn't belong or is broken it's probably mine!
Any help is appreciated,
-Lisa
global proc LA_splitJointUI()
{
//Build the interface window
string $splitJointWindow = `window -t "Split Joint UI"`;
string $form = `formLayout -numberOfDivisions 100`;
$segments = `intSliderGrp -field true -l "Segments" -min 2 -max 25 slider1`;
$button1 = `button -l "Split Joints"`;
$button2 = `button -l "Cancel"`;
//$checkBox = `checkBox -l "Create as New Joint Hierarchy"`;
/* -onCommand
"button -edit -command (\"LA_splitNewJoint \" + $segmentOpt) $button1"
-offCommand
"button -edit -command (\"LA_splitJoint \" + $segmentOpt) $button1"`;
*/
formLayout -edit
-attachForm $segments top 25
-af $segments left 25
//-af $checkBox top 75
//-af $checkBox left 100
-af $button1 bottom 10
-af $button1 left 15
-af $button2 bottom 10
-af $button2 left 110
$form;
// get the value from the slider
int $segmentOpt = `intSliderGrp -q -value slider1`;
// set up the buttons
button -edit -command ("deleteUI \"" + $splitJointWindow + "\"") $button2;
button -edit -command ("LA_splitNewJoint " + $segmentOpt) $button1;
/*checkBox -onCommand
"button -edit -command (\"LA_splitNewJoint \" + $segmentOpt) $button1"
-offCommand
"button -edit -command (\"LA_splitJoint \" + $segmentOpt) $button1"
$checkBox;
*/
showWindow $splitJointWindow;
}
