Simply Maya User Community

Simply Maya User Community (https://simplymaya.com/forum/index.php)
-   Maya Basics & Newbie Lounge (https://simplymaya.com/forum/forumdisplay.php?f=31)
-   -   Simple Slider Control (https://simplymaya.com/forum/showthread.php?t=6216)

Alan 08-06-2003 09:32 PM

Simple Slider Control
 
Hi guys I want to create a simple slider control to control the rotations of a group of objects and I am finding this really hard for some reason!! :( from the MEL command reference I got this code:

window;
columnLayout -adjustableColumn true;
floatSlider -min -25 -max 25 -value 0 -step 1;
showWindow;

And that's fine, exactly what I want! Now how the heck do i get the value that the slider is set to when it's dragged? Do i need a procedure to do this?!

Please guys any help is greatly appreciated.

Alan

Darkware 08-06-2003 10:07 PM

I don't know much about mels and the like, so I'm no help there. Why don't you just set up a set driven key for the group?

Alan 08-06-2003 10:09 PM

could you explain roughly how to do that?

Darkware 08-06-2003 11:05 PM

Select your group. Choose Modify>Add Atribute. Under the "new" tab, type in the attribute's name. (rotateYaxis or something like that) Check the "Make Attribute Keyable" box, make sure the data type is "float", and make sure the attribute type is "scalar." Type in 0 for Minimun value, 10 for maximum, and 0 for default. Press ok. In the channel box, you will see a new attribute for your group.

Now that you have your attribute, it's time to set up a set driven key. With your group selected, choose Animate>Set Driven Key>Set options box. With set driven key, you use one thing to "drive" another. The top section of the window shows the driver - the thing that will drive the driven. The bottom section of the window shows the driven - the thing that will be driven by the driver. (Say that ten times fast.)

Ok, since you had your group selected already, it should appear in the bottom section. The bottom right-hand box shows all the attributes of your group. Since we want to set up a slider for the rotation on the Y axis, select rotateY. Now click "Load Driver" at the bottom. Since we had the group selected, it is now the driver as well. In the upper right-hand box, select rotateYaxis or whatever you named the new attribute we created.

We now have everything set up. Next, is the hard part that most people mess up on. Do this carefully. Rotate your group however you want it when the slider is at 0. (for this example we will assume your group's rotateY is at 0) Press the "Key" button near the bottom. This tells Maya that when rotateYaxis is at 0, the rotateY of your group is 0. In the channel box, change rotateYaxis to 10. Using the rotate tool, rotate your group however you want it to be when rotateYaxis is at 10. Press the "Key" button once again. Press "Close."

We're done. Now to use the slider, select rotateYaxis in the channel box. The words "rotateYaxis" should be highlited in black. Hold your mouse over your group in perspective view and middle-mouse drag to the right. Your group rotates according to the values you set for the set driven key.

Truthfully, sliders are not really neccesary in my opinion unless you're doing a lot of animating. Sometimes, it would just be easier to type in the value for rotateY rather than go through this process to create a new attribute and set up a set driven key. BUT, you wanted a slider for rotateY, so I gave you one. You can create a slider for each axis if you like.


All times are GMT. The time now is 03:56 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Simply Maya 2018