Hey Chad, thanks for your quick answer. It works the way you said,
awesome, thanks! But still, I have to write all this!?:
rotValues = OpenMaya.MScriptUtil()
rotValues.createFromDouble(0)
rotValuesPtr = rotValues.asDoublePtr()
matchQuaternion.get(rotValuesPtr)
print "x:%s, y:%s, z:%s" % (matchQuaternion.x,
matchQuaternion.y,
matchQuaternion.z)
I need to define a pointer to pass to the get() function although I
dont need it at the end!? Is that correct or can I skip some stuff
from my code?
thanks for your help
On 8 Apr., 00:04, Chad Vernon <[email protected]> wrote:
> You should just be able to do:
> x = matchQuaternion.x
> y = matchQuaternion.y
> z = matchQuaternion.z
>
> On Wed, Apr 7, 2010 at 2:47 PM, Visor66 <[email protected]>wrote:
>
> > Hello everyone,
>
> > im trying to use the MQuaternion.get() function to extract x,y,z
> > values from a quaternion. Documentation says its giving me back an
> > array with 4 doubles. Whats the right way to use MScriptUtil() to
> > prepare a python variable to work with this function. This is how I
> > thought it could work:
>
> > rotValues = OpenMaya.MScriptUtil()
> > rotValues.createFromList([0.0,0.0,0.0,0.0],4)
> > rotValuesPtr = rotValues.asDouble4Ptr()
> > matchQuaternion.get(rotValuesPtr)
>
> > Im getting back this error message:
>
> > # Error: TypeError: in method 'MQuaternion_get', argument 2 of type
> > 'double [4]' #
>
> > The funny thing is, when I use rotValuesPtr = rotValues.asDoublePtr()
> > it works, but I only get the x value. So how would it be correct to
> > actually get all values from get() ?
>
> > thanks for any help!
>
> > --
> >http://groups.google.com/group/python_inside_maya
>
> > To unsubscribe, reply using "remove me" as the subject.
>
>
--
http://groups.google.com/group/python_inside_maya