View Full Version : Scripting Slider value into rollout GUI
10-02-2009, 08:19 AM
Iīm building a character with some face morph controls. Looking good so far, I even wired facial morphs, teeth and tongue to slider objects in my viewport. So far so good. However the sliders cluttering my viewport annoyed me. So I had the idea of building some sort of scripted rollout window. Nothing fancy, for starters, just a place to organize my sliders.
Now, hereīs my problem. I cant manage to have my scripted slider control my slider object. Hereīs my code so far:
rollout slider1 "Mouth Controls"
slider mouth_open "Mouth open" orient:#horizontal value: 0 ticks:10 Controller: (slider_object1[#value]) ange:[0,100,0]
I think I am still missing something? Set up the value as a variable? Or is it that I need to create some sort of controller for my slider object first that can be accessed by my script? Currently Iīm out of answers, searched the forum to no avail. Any suggestions/pushing in the right direction for this problem are greatly appreciated.
Thank you in advance for helping a Max Script newbie
10-02-2009, 08:48 AM
the 'controller' property needs exactly that in order to bind a scripted UI to a viewport control. Your method is passing a 'value' which would probably be a number (integer or float) which is the value of the controller. So first you need to see if your viewport control has a controller to bind to - i dont know in your case what that would be but it is usually something like 'slider_object1.controller'
10-02-2009, 09:26 AM
took up your tip and found the solution by meddling a bit around with the script listener. Seems the slider objects already have a controller when created. So hereīs the corrected script which will create a slider window which in turn remote control your viewport sliders :)
rollout Selection1 "Selection Sets"
slider mouth_open "Mouth open" orient:#horizontal value: 0 Controller:$sl_mouth_open.value.controller ticks:10 range:[0,100,0]
slider eyes_open "Eyes open" orient:#horizontal value: 0 Controller:$sl_eyes_open.value.controller ticks:10 range:[0,100,0]
if SelectorFloater != undefined do
SelectorFloater = newRolloutFloater "Animation Controls v0.1" 250 250
addRollout Selection1 SelectorFloater rolledup:false
It seems so easy once you finish, but until Iīm there I feel like a total moron.
Thanks, case closed
10-02-2009, 09:48 AM
that's the stuff, you could now consider removing the link to to viewport slider and passing the controller of the actual object you are influencing, it might speed your rig up if that was an issue. The other thing is to wire to a custom attribute on the character's rig somewhere (i usually choose the head) and launch your floater from there.
10-02-2009, 10:19 AM
Yes, Custom Attributes are the next logical step. I already bought the neccesary DVDīs by Mr.PEN, but havenīt had the time to watch them yet.
Anyway, the sliders work nicely now, the character isnīt that complicated (med poly resolution, CAT rig and about 10 CAT muscles to work out foldings and creases of skin and clothes), but for future productions Iīd better take a look at CAīs.
10-05-2009, 04:14 PM
just started digging into Custom Attributes and it looks very promising. Currently I am creating those with the Parameter Editor, and then wiring them to my facial controls. Both steps are done by hand. Then I use this command:
slider brow_up_l "Brow up left" orient:#horizontal value: 0 Controller:$Head.Custom_Attributes[#01].controller ticks:10 range:[0,100,0]
to have my slider GUI control the Custom Attributes. Works like a charm..
while I have been able to create a Attribute Holder modifer by script, I havenīt found the script command to add/remove/administrate Custom Attributes to objects. This would be very interesting.
Any help/further nudges in the right direction here to keep me on my path?
10-05-2009, 04:14 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.