Hey there, I am still busy with accessing quaternions in Maya. The
thing is, I'm looking for an elegant way to get the rotation
quaternion of an object's transformation in world space. Here is what
I have so far:



PyMel issues:

Transform.getRotation() offers the possibility to get world space
data. Docs say it is supposed to return a quaternion, which it does
not. In fact it returns an Euler representation in list form [x, y,
z].

Transform.getRotationQuaternion() returns a pseudo quaternion (list of
[x, y, z, w] instead of a proper quaternion class object). Also, this
version of getRotationQuaternion() comes with no option to specify
world space, and I'd very much like to avoid multiplying the
transformation matrices myself all from the depths of my scene until I
hit the hierachy's surface.

Transform.getTransformation() returns a proper TransformationMatrix
object which would enable me to properly deal with quaternions, but
obviously in object space only, so I again would have to do the
iterative matrix multiplications myself.



API issues:

MFnTransform.getRotation(), now, there are two of them in the docs.
For one it claims I'll get a quaternion, for the other it says I'll
get Euler. Why are there two functions with the same name here?!
Unfortunately, the latter version is what I get in Python, so no
quaternions here for me.

MFnTransform.getRotationQuaternion() uses individual output arguments
for xyzw, instead of directly writing into a MQuaternion. This is a
pain in itself. Furthermore, also by using the MScriptUtil() class to
deal with the simple-type values which need to be passed as a pointer
I can't get it to work. This piece of code just fails with a
"(kInvalidParameter): Object is incompatible with this method #" error
message:

  utilx = api.MScriptUtil(0.0)
  ptrx = utilx.asDoublePtr()

  utily = api.MScriptUtil(0.0)
  ptry = utily.asDoublePtr()

  utilz = api.MScriptUtil(0.0)
  ptrz = utilz.asDoublePtr()

  utilw = api.MScriptUtil(0.0)
  ptrw = utilw.asDoublePtr()

  TransformSource0.getRotationQuaternion(ptrx, ptry, ptrz, ptrw,
api.MSpace.kWorld)



API 2 issues:

Good news, I got the slerp working in there. Also, API 2 looks a lot
nicer than API 1. Unfortunately API 2 is not compatible with API 1,
and lot's of functionality I need is not yet implemented (like proper
selection list handling).



I'm still rather new to Maya, so I wonder if there is something I do
fundamentally wrong, or is the SDK really this painful?

Any hint is greatly appreciated, cheers!

  -André

-- 
view archives: http://groups.google.com/group/python_inside_maya
change your subscription settings: 
http://groups.google.com/group/python_inside_maya/subscribe

Reply via email to