Hey guys,

That's probably a silly question but I've been wondering this for a while
and always figured something else, but now i'm kinda stucked. Using Maya
2018 / Windows

How do get/set small arrays within the Python API ?
For example, MfnTransform has the following function prototype:
MStatus
<https://download.autodesk.com/us/maya/2009help/API/class_m_status.html>
getScale
<https://download.autodesk.com/us/maya/2009help/API/class_m_fn_transform.html#a142c550cb690c8e1f4a3a15a75fa627>
(double scale[3]) const

And when calling it from the Python API returns the same prototype:

in method 'MFnTransform_getScale', argument 2 of type 'double [3]' //


According to SWIG documentation
<http://www.swig.org/Doc1.3/Python.html#Python_nn62> (which Autodesk used
for its Python bindings), one should use tuples to do it (but it has to be
implemented on the API side)

Here is what I tried:


import maya.OpenMaya as om

selList = om.MSelectionList()
selList.add('joint1')
oNode = om.MObject()
selList.getDependNode(0, oNode)
joint = om.MFnTransform(oNode)
scale = (0, 0, 0)
joint.getScale(scale)

But I always get the following error:

# TypeError: in method 'MFnTransform_getScale', argument 2 of type 'double
[3]' //

Tried with [], [0, 0, 0], om.MFloatArray(), None... but was never able to
query that property correctly. What's the supposed way of making this work
? Or does it just nit work at all and I'm obliged to use PyMel for those ?

Any insights appreciated
N.

-- 
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_maya+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/CAFS5DCZ33ns27Gatp35Xp5Je%2B%3Db%3DfAVWsR1J0e%3DzF7BCSFAJ4A%40mail.gmail.com.

Reply via email to