View Full Version : How to switch sliders on different attributes with the press of a button?
Guibou 08-19-2009, 01:34 PM Hi,
I was wondering if there was a way to have a bunch of sliders sitting on different custom attributes on different objects ramp up to 100 with the press of a button. Can anybody point me in the right direction?
Thanks for your time and have a good day!
|
|
denisT
08-19-2009, 07:45 PM
Hi,
I was wondering if there was a way to have a bunch of sliders sitting on different custom attributes on different objects ramp up to 100 with the press of a button. Can anybody point me in the right direction?
Thanks for your time and have a good day!
Sorry but I don't understand what you want to do. Do you want to bind several sliders (spinners) to one? Or you want to bind controllers?
Guibou
08-19-2009, 08:29 PM
Hi denisT,
What I want to do is with the press of a button have a bunch of sliders ramp up to 100. Those sliders are sitting in different custom attributes. I'll also want to have another button that brings them all down to 0
Thanks for your response
denisT
08-19-2009, 08:46 PM
Hi denisT,
What I want to do is with the press of a button have a bunch of sliders ramp up to 100. Those sliders are sitting in different custom attributes. I'll also want to have another button that brings them all down to 0
Thanks for your response
do you know names of these sliders (or names of cust attriburtes)?
Guibou
08-20-2009, 01:56 PM
Yeah i know the names of those sliders and the name of the custom attributes they are in.
denisT
08-20-2009, 04:35 PM
Yeah i know the names of those sliders and the name of the custom attributes they are in.
If the slider linked to the cust attribute, this slider is linked the cust attr controller. That means you have a direct link between the slider and the controller. Changes to the slider will automatically update the controller (and its controlled objects). Changes to the controller automatically update the slider.
To ramp up the slider you have to set its value to maximum. Maximum value of a slider is Y component of slider's range. Minimum is X component of range. So:
-- ramp up:
<slider_name>.value = <slider_name>.range.y
-- throw down:
<slider_name>.value = <slider_name>.range.x
-- for list of sliders (ramp up):
for s in list_of_sliders do s.value = s.range.y
But you have to know: If you would do it in animation mode it will create keys for all linked controllers. If you don't need to key controllers use "with animate context":
with animate off
(
for s in list_of_sliders do s.value = s.range.y
)
Guibou
08-20-2009, 04:42 PM
Thanks a lot for the help!
How would it work if my button was on another object than my slider?
Let's say my button is in an attribute holder on a Box and my slider is in an attribute holder on a sphere.
Is the process any different?
Guibou
08-20-2009, 04:50 PM
I'll explain exactly what is my goal, it should make more sense than.
I have a rig using FK and IK for the Spine, the arms and the Head.
On the controls for each of those body parts there's an attribute holder with a slider enabling you to switch from IK to FK, vice versa.
What i'd like to do is have a button on another controller. When pressing the FK button, all my sliders on the arms, spine and head controls would ramp up to 100 (FK). Pressing the IK button would bring those down to 0 (IK).
So those buttons aren't in the same custom attributes as my slider.
Thanks for your help man, it's appreciated!
denisT
08-20-2009, 05:05 PM
Thanks a lot for the help!
How would it work if my button was on another object than my slider?
Let's say my button is in an attribute holder on a Box and my slider is in an attribute holder on a sphere.
Is the process any different?
in this case you have to set controllers... not sliders.
you can add "master slider" to box's attribute holder, which will not be linked to any controller. This slider will be used for the setting up sphere's controllers. I don't know names of your attr holders and their controllers. So I can't give you a sample code... But pseudo code will be something like:
on <box_attr_holder_master_slider> changed val do
(
for c in <sphere_attr_holder_controller_names> do setproperty <sphere_attr_holder> c val
)
CGTalk Moderation
08-20-2009, 05:05 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.
vBulletin v3.0.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.