I’m working on a rigging system where one skeleton will be driven by another skeleton using orient constraints.
I’m used to Maya where it would be as simple as
orientConstraint <master> <slave>
I’m wrapping my brain around the Max script way , where (apparently) every type of controller has to first be explicitly instantiated before it can be assigned to anything.
I came up with this script to loop over the master bones and constrain the matching slave bones:
/*
given 2 skeletons:
'master' bones , systematically named and prefixed "master_*"
matching 'slave' bones, identincally named , but prefixed "Slave_*"
finds each "master_*" bone,
creates orient constraint
ads master as target
assigns orient control to paired slave bone.
*/
masterBones=$master_*
for master in masterbones do
(
slaveName= substituteString master.name "master_" "slave_"
slave= getNodeByName slaveName
orientCtrl =orientation_constraint()
orientCtrl.appendTarget master 100.0
slave.rotation.controller=orientCtrl
)
it seems to work on a simple test rig.
I’m posting just for an ‘idiot check’, being new to the max script way of doing things I want to be sure I’m not making any obvious errors.
My one concern is how I would access these controls in a script after creation?
<rant>
Another thing I got used to in Maya was each command definition being followed by clear examples.
The hilighted 3 lines, where the actual constraining happens, were adapted from a CGtalk post,
because i just couldn’t make usable code based on the max script help pages, nor could I find an example of constraints in the tutorials.
I’m a very example-driven learner and there seems to be a lack of “here’s what using this code actually looks like” examples in MaxScript help
If I am missing the secret gold mine of practical max script examples , - or at least a very high level overview of scripting controllers - please clue me in
</rant>