PDA

View Full Version : Custom joint size slider


golden14
07-09-2005, 05:29 AM
I'm trying to duplicate the joint size slider (that can be found under Display -> Joint Size -> Custom...) for a set of rigging tools I'm putting together. The code I came up with seems to be correct as far as syntax goes, but the slider won't change the joint size. Here is the code I have:

$size = `floatSliderGrp -q -v floatSliderGrp1`;
jointDisplayScale -ikfk $size;

So the value of the slider should be going into $size, and then that value will be applied to the jointDisplayScale command. The slider works just fine, but it wont change the joint size. I figure that there should be a way to do this, since Maya already has such a slider. Any help would be appreciated. Thanks,

- Shay

drGonzo
07-09-2005, 09:47 AM
What you need is jdsWin.mel:
global proc jdsReset()
{
jointDisplayScale 1.0;
floatSliderGrp -e -v 1.0 jdswidget;
}

global proc jdsWin()
{

float $jdsVal1;

$jdsVal1 = `jointDisplayScale -q`;


if ( `window -ex jdsWnd` )
{
showWindow jdsWnd;
}
else
{
window
-rtf 1
// -wh 242 100
// -w 242
-t "Joint Display Scale"
-in "jds"
-menuBar 1
-s 0
jdsWnd;

menu
-p jdsWnd
-l "Reset"
-enable 1
-familyImage "menuIconReset.xpm"
jdsResetMenu;

menuItem
-p jdsResetMenu
-l "100%"
-c "jdsReset"
jdsResetToItem;

setParent jdsWnd;

formLayout jdsform;

rowLayout
-nc 2
-cw 1 60
-cw 2 300
jdsrow1;

setParent jdsform;

columnLayout jdscol;

floatSliderGrp
-field 1
-min 0.01
-max 10.0
-fieldMaxValue 1000.0
-pre 2
-v $jdsVal1
-dc "jointDisplayScale #1"
-cc "jointDisplayScale #1"
jdswidget;

formLayout -e
-af jdscol top 3
-af jdscol left 3
-af jdscol right 3
-af jdscol bottom 3
jdsform;


}
showWindow jdsWnd;
}

golden14
07-09-2005, 03:43 PM
Thank you. After looking at that code, I see that my code was basically backwards. I fixed it, and it now works fine. I appreciate the help.

- Shay

golden14
07-09-2005, 03:49 PM
Actually, there is one more thing that didn't make sense to me. In the part of the code where it is setting the paramteres for the slider, where it has the "-dc "and "-cc", I know that it is setting the command for the slider to execute when it moves. But it says "jointDisplayScale #1", and I dont understand what the #1 is for and what it does. Obviously it wont work without it, but what does the # and 1 refer to?

drGonzo
07-11-2005, 04:50 AM
But it says "jointDisplayScale #1", and I dont understand what the #1 is for and what it does.
Good question. Because I have no idea ;-)
I'll try to find out.

drGonzo
07-11-2005, 01:29 PM
"#1" refers to the current value of the floatSliderGrp. it's kind of like
"this.value1". this syntax is mentioned somewhere deep within the maya
mel help docs. if a ui element has multiple
fields/checkboxes/radiobuttons/etc, you can use the values of each by
referring to #1, #2, #3 and so on.

(From Chad at Luna pictures)

CGTalk Moderation
07-11-2005, 01:29 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.