PDA

View Full Version : linking to controllers


scottJ999
11-07-2010, 01:37 AM
I have been at this for a while now and am strugling a bit, before I go into the problem I have to stress I am not a programmer and this is my first time with scripting.

I am trying to make a custom UI in which a rig can be controlled, I chose to do max script as the atribute holder in max did not produce nice looking results and wanted a better solution.

So far I have created the UI and have got a few features working such as rollouts being made and removed to keep things nice and tidy.

I am now at the stage where I need to link the objects in the UI such as sliders and spinners etc. to the apropriate objects in max.

currently I am trying to control an orientation constraint weighting between 2 targets, as practice I tried head first to go for a link and failed, so went back a few steps and linked a max script UI slider to a viewport slider and was successfull, I was able to make it update the viewport and grab the current value before opening.

with this in mind I went back and tried a few other possibilites to linking the weight of an orientation constraint to a slider in max script and still having issues.

is there a list (for beginners) of how to access the needed position, rotation and scale values of each object?

this is what I last tried

$Object.Transform.Orientation_constraint.Orientation_Weight_0 = val.

On a side note, not sure if I will be needing this but would be a nice feature, I am trying to get the max script slider to update in real time with the viewport slider, I have tried the following to get that working.

slider sld5 "Slider" pos:[45,34] width:200 height:44 range:[0,100.0,dependson $Slider01.value]

as I was told that dependsOn updates the max script (knowing it workes without the depensOn part)

Any help on these issues would be helpfull and thanks in advanced for your time.

JHN
11-07-2010, 04:56 PM
Even though I don't fully understand your question, any controller can be queried using the .value propery of that controller.

$.transform.controller.value
$.rotation.controller.value
$.rotation.controlller[#x_rotation].controller.value

etc. It works on both on subAnims and controllers.

I know it's not all the answers you're looking for, but hopefully it's of some help,

-Johan

jonahhawk
11-07-2010, 05:12 PM
I'm not a master rigger so I'm not sure what the goal of orienting the head to two targets is.

I have a box with an orientation constraint equally weighted to two Point Helpers. 50/50
The code:
(
try DestroyDialog rol_Test catch()
rollout rol_Test "Test"
(
slider sld_P1W "Point1 Weight:" range:[0,100,50]
slider sld_P2W "Point2 Weight:" range:[0,100,50]

on rol_Test open do
(
sld_P1W.value = $Box01.transform.controller.rotation.controller.orientation_constraint.weight[1]
sld_P2W.value = $Box01.transform.controller.rotation.controller.orientation_constraint.weight[2]
)

on sld_P1W changed arg do
(
$Box01.transform.controller.rotation.controller.orientation_constraint.weight[1] = sld_P1W.value
$Slider01.value = sld_P1W.value
sld_P2W.value = 100 - sld_P1W.value
)

on sld_P2W changed arg do
(
$Box01.transform.controller.rotation.controller.orientation_constraint.weight[2] = sld_P2W.value
$Slider01.value = sld_P2W.value
sld_P1W.value = 100 - sld_P2W.value
)
)
CreateDialog rol_Test
)

scottJ999
11-07-2010, 05:32 PM
thanks for th help guys, srry i was not clear in what I am trying to do.

JHN, I think you got the idea, though I am not sure if what you gave me is exactly what I need.

I am after the value property of the orientation weight

I want to controll the wight of the constraint with a slider, this is for an IK/FK blend.

I have linked the FK and IK to the rigging bone, both weighted at 50%, I want to now control this weight in max script through a slider, to do so I need the value of the weight.

though I think jonahhawk, your solution may be another work around if I can not access this value from max.

Edit*
I also found a usefull tool in max, the ExposeTm helper object copies the code needed for the transformation values.

and on another note, a suggestion has been made to link the script slider to a viewport slider wich in tern controls the weighting of the blend but have it hidden. bit of a nasty work around but should work.

jonahhawk
11-07-2010, 06:53 PM
My script does exactly that. It controls the Weight Value of the Orientation constraint.
$Box01.transform.controller.rotation.controller.orientation_constraint.weight[1]

gives you the weight value of the first target.

$Box01.transform.controller.rotation.controller.orientation_constraint.weight[2]

gives the weight of the second target...

I must be missing something if this is not what you are looking for...

Edit: I'm not sure why it is messing up the word orientation in some of my posts...

scottJ999
11-07-2010, 07:03 PM
ahh, sorry, I think you are correct, looking at that, it seems like it may be just what I am after, will give it ago, thanks :)

CGTalk Moderation
11-07-2010, 07:03 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.