Python 1.0 - AttributeError: OpenMaya.py line 54: rotationComponents

Python 1.0 - AttributeError: OpenMaya.py line 54: rotationComponents

Anonymous
Not applicable
913 Views
2 Replies
Message 1 of 3

Python 1.0 - AttributeError: OpenMaya.py line 54: rotationComponents

Anonymous
Not applicable

Hi everyone,

 

So, I am a student trying to code a plugin for Maya for my final project.

I'm using almost exclusively OpenMaya, because honestly, I find MEL a readability nightmare.

 

I need to access current Euler Rotation Values on a DAG Node

 

jointMatrix = jointDagNodeFn.transformationMatrix()
rotList = []
rotList = jointMatrix.rotationComponents(asQuaternion=True)

I get this error:

AttributeError: file S:\Maya_2016_DI\build\Release\runTime\Python\Lib\site-packages\maya\OpenMaya.py line 54: rotationComponents

 

The most similar errors I can find online is a bug report here.

I'm using Maya 2016.

Can anyone give me advice on how to progress?
Is my syntax incorrect somehow?
Am I simply accessing the function incorrectly?
Or if it's a genuine bug in the API, how on earth do I work around that?

0 Likes
Accepted solutions (1)
914 Views
2 Replies
Replies (2)
Message 2 of 3

RFlannery1
Collaborator
Collaborator
Accepted solution

My guess is that "jointMatrix" is a MMatrix instead of a MTransformationMatrix.  Try this and see if it works any better:

jointMatrix = jointDagNodeFn.transformationMatrix()
jointXformMatrix = om.MTransformationMatrix(jointMatrix) rotList = jointMatrix.rotationComponents(asQuaternion=True)
0 Likes
Message 3 of 3

Anonymous
Not applicable

it seems insane to me that a command like .MTransformationMatrix() returns a different type of matrix from the one implied in the name... 😐

0 Likes