On Mon, May 11, 2009 at 14:54, hapgilmore <[email protected]> wrote:
>
> #get shell uv
> floatArray = OpenMaya.MScriptUtil()
> floatArray.createFromList([0.0,0.0],2)
> shellUVptr = floatArray.asFloat2Ptr()
[...]
> shellU = OpenMaya.MScriptUtil().getFloatArrayItem(shellUVptr,0)
To Python an array of float and an array of float2 are different
things. So you want to use getFloat2ArrayItem(). E.g:
shellU = OpenMaya.MScriptUtil().getFloatArray2Item(shellUVptr, 0, 0)
shellV = OpenMaya.MScriptUtil().getFloatArray2Item(shellUVptr, 0, 1)
Note that 'getFloatArray2Item' is a class method. By putting
parentheses after 'MScriptUtil' you are creating an new, empty
MScriptUtil object, which is unnecessary and inefficient. Better to
just do:
shellU = OpenMaya.MScriptUtil.getFloatArray2Item(shellUVptr, 0, 0)
shellV = OpenMaya.MScriptUtil.getFloatArray2Item(shellUVptr, 0, 1)
If you want to save yourself some typing you could also make use of
the fact that each MScriptUtil object has access to all of the class
methods, so:
shellU = shellUVptr.getFloatArray2Item(shellUVptr, 0, 0)
shellV = shellUVptr.getFloatArray2Item(shellUVptr, 0, 1)
--
-deane
--~--~---------~--~----~------------~-------~--~----~
http://groups.google.com/group/python_inside_maya
-~----------~----~----~----~------~----~------~--~---