[Closed] multiple Spinner controller
im using an orientation constraint on a bone in an arm so that its got two targets (a bone for FK and one for IK) there are therefore two weights. at 1st i had them wired so that one weight was the inverse of the other. now that im going to use maxscrpt to control the weights i needed to remove the wireing since it was messing up the maxscript. currently ive got this piece of code
spinner RightIKSpn "Right IK" pos:[58,432] width:68 height:16 range:[0,100,0] controller: $Colonel_Right_Arm_2.rotation.controller.weight[1].controller
basically this allows my spinner to alter the weight 0 of the constraint. my inverse equation was that weight#2 = ((weight#1)-100)/-1 that was when weight 1 = 100 weight 2 = 0 and when #1 = 75… #2 = 25
so what i need now is that when my spinner changes #1 i also need #2 to change using my little equation. when i looked up spinner in the maxscript help file i didnt see anything about multiple controllers.
I’m probably not the best person to answer this, but depending on how you’ve rigged it all together…you could use the spinners on changed event.
This is a simple script call back where you could effect a number of controls simultanously.
Otherwise I’d look at setting up some kind of scripted controller or wired parameter – linking the two controllers to the single spinner and calculating the desired result from the value of the spinner
Shane
Absolutely not helping on this forum too j/k.
Decipher my example to examine how callbacks work and on spinner changed do ( ) event handlers work. It’ll do what you need
-Colin
Well I’m not sure why you need to do this in the CA def? Create the spinners and wire to those with the correct math.
The first weight will have theSpinner as the expression and the second should have 100-theSpinner to invert it. Unless you have planes for something further that you are not mentioning.
Paul,
Question for you related to this thread. How do you use wire params on rollout ui objects (like spinners) that haven’t been created yet? If this were my problem, I would hook the event handler “on spinner changed” and then register a callback for “when parameters spinner changed” if necessary. Is there an easier way to setup direct relationships?
Thanks,
-Colin
actually i did end up doing wiring. i had things wired when i 1st did the maxscript and for some reason i was having problems. after i took the wireing off it worked. but then when i put wiring back on things were still working so its all working well now.
thats my control pannel
unfortunately the snap IK still isnt figured out yet. i guess ill get it one of these days. neither the locks hehe. ive atleast got it looking like what i want in my control pannel and now just need to work on the actual code behind everything. a basic sample code is this
spinner OOSpn "OO" pos:[35,58] width:68 height:16 range:[0,100,0] Controller: ($Colonel_Head.modifiers[#morpher])[1].controller
button OOBtn "X" pos:[67,81] width:15 height:15
on OOBtn pressed do
(
deselectKeys $Colonel_Head
selectKeys ($Colonel_Head.modifiers[#morpher])[1] currentTime
deleteKeys ($Colonel_Head.modifiers[#morpher])[1].controller #selection
)
or
spinner RightIKSpn "Right IK" pos:[58,432] width:68 height:16 range:[0,100,0] controller: $Colonel_Right_Arm_2.rotation.controller.weight[1].controller
button RightIKDBtn "X" pos:[114,456] width:15 height:15
on RightIKDBtn pressed do
(
deselectKeys $Colonel_Right_Arm_2
selectkeys $colonel_right_arm_2 currenttime
deleteKeys $colonel_right_arm_2 #selection
)
then i wired the peramiter of the 2nd weight in the rotation controller to the 1st weight using weight 1 = (((weight 0)-100)/-1) with a 1 way wire going from weight0 as the master controlling weight 1 (the weights are named 0 and 1 in the controller but in maxscript they are titled 1 and 2)
Oh sorry, thinking it was a Ca Def not a floating UI. You can’t is then the answer. What you really need is a call back that updates the UI as the time changes. This way you can just use the event handler to drive what ever you want.
Although a cleaner method would be to create a Ca Def that has the tracks that will be driven. Wire to those as you need and drive those Ca def attributes with the floating UI. You could directly connect to them and wouldn’t need the call back to update the spinners.
That sounds harsh.
Of course you can add custom attributes using the parameter editor and you don’t have to write them your self at all.