Joint rotate order

194 views
Skip to first unread message

matthew park

unread,
Nov 6, 2013, 1:10:30 PM11/6/13
to python_in...@googlegroups.com
Hi there,

since I am pretty new to Maya python api, I wonder how to set up the joint rotation order.  as you know default is xyz. 
In a python plug-in code,  I created joints and manipulate them. I want to set rotation order for the joints but when I looked up the api ref, it said rotation order should be set in MFnTransform function class not in MFnIkJoint with method. sounds like MFnTransform class is for any dag node needs to move and wonder how I can I use this or if my guess is right or not? using script flag could be another way, but as purpose of learning api to build a plug-in, I want to know about using lower level.

Any help will be much appreciate it!


Thanks a lot!

Matt,

       OMA ==> OpenMayaAnim

        jointFn = OMA.MFnIkJoint()

        for i in range(1, len(self.jointObjects)):
            jointFn.setObject(self.jointObjects[i])

            OpenMaya.MFnTransform.setRotationOrder(self, order, reorder)  <===?
            rotationAngle = OM.MAngle(self.jointOrientation, OM.MAngle.kDegrees)
            jointFn.setOrientation(OM.MEulerRotation(rotationAngle.asRadians(), 0, 0, self.rotOrder))
            translationVector = OM.MVector(0, self.jointDistance, 0)
            jointFn.setTranslation(translationVector, OM.MSpace.kTransform)

br...@meljunky.com

unread,
Nov 6, 2013, 1:44:17 PM11/6/13
to python_in...@googlegroups.com
You need to create an instance of MFnTransform with a MObject or MDagPath before you can call setRotationOrder.

-brian


--
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CAMczULY5WmrNZx_q1kwzi5%3Dyni8VubjtPJHTxaaz-0ooD-1L-g%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.

matthew park

unread,
Nov 6, 2013, 2:07:24 PM11/6/13
to python_in...@googlegroups.com
Hi Brian, 
Thanks for the quick reply.
Before I try, can you send me simple code hierarchy? peusdo is great enough for me.
Thanks for helping a starter!

Matt,


br...@meljunky.com

unread,
Nov 6, 2013, 3:02:37 PM11/6/13
to python_in...@googlegroups.com
Looking at the help docs for MFnIkJoint inheritance diagram, you already have access to the class MFnTransform and the method setOrientation.

You can just use:
jointFn.setOrientation(...)

without creating an instance of MFnTransform

-brian

matthew park

unread,
Nov 6, 2013, 3:28:56 PM11/6/13
to python_in...@googlegroups.com
Thanks brian, but jointFn.setOrientation(rotation, rotation order) seemed not working. I already tried with variable of flag if you see my code.
 jointFn.setOrientation(OM.MEulerRotation(rotationAngle.asRadians(), 0, 0, self.rotOrder))

Thanks anyway, I will look into it further.

Matt,


Reply all
Reply to author
Forward
0 new messages