Lately I´ve been writing a script that takes an existing joint chain and creates a series of control arms for it. Initially, my idea was to take the existing chain and recreate a control chain on top of it, using the position, joint orient, and rotation axis of the existing chain to re-align the new chain I created. HOWEVER, this never gave predictable results; it only gave correct results when the chain was initially created in a certain way (all joint lying on one axis, for example). In my case, the script had to work in ALL cases.
Try this as an example to see what I mean:
-Create a random chain with 3-4 joints.
-Rotate each joint randomly.
-Freeze rotations on all joints.
-reorient the chain (joint -e -zso -ch -oj xyz <jointname>)
-Now orient the local rotational axis manually in some way (for example, say you were creating an arm).
-Now try and create a new chain on top of this chain, using the position, joint orient, and rotation axis of the first chain as input variables to create the second chain.
This NEVER produces predictable results for me in a consistent way. Sometimes it works, but rarely. Which leads me to the following question: is it even possible in MEL to create a joint chain and make sure the joint orientations are aligned correctly?
It seems the answer is NO. :( I would appreciate comments here.
HOWEVER, I did finally get my script working by simply duplicating the existing chain, and reworking some of the joints to fit my control rig. This was the only way scripting a control rig worked for me.
If you guys have tried this I´d appreciate hearing your feedback.