MVector class using MScriptUtil()

March 5, 2012
As per the example in the previous blog entry. You can use one of Mayas API classes to translate a python array data variable to something that the MVector class can read. (remember SWIG and C++ ...)

import maya.OpenMaya as ommyArray= om.MScriptUtil()
myArray.createFromList([1.0, 1.0, 1.0], 3)

vec= om.MVector( myArray.asDoublePtr() )
print vec.x vec.y, vec.z
Done.  
 

The MVector class in Python

February 27, 2012
Ok, so we're trying to use a vector data variable within our tool development using Maya API. 

import maya.OpenMaya as om
 
myVec= [ 0.0, 1.0, 2.0 ]
VecA= om.MVector( myVec )

# Error: Wrong number of arguments for overloaded function 'new_MVector'.
This would work if we directly parse arguments into the MVector class with:

VecA= om.MVector ( 0.0, 1.0, 2.0 ) 

This is because the Maya API is written in C++. The python component translated into the API is being handled by SWIG within ...

Continue reading...
 

Introduction - Maya API

February 27, 2012
This webpage of Maya tutorials is set to in a blog format. At the moment, I am teaching myself Maya API in Python, to become more a proficient as a Character/Creature Technical Director. The Maya API will provide many tools more so than what MEL commands can provide. This will allow a more efficient toolset to a specific task. Feel free to leave some comments.

Continue reading...
 

About Me


Character TD and Creature TD with some generalist skills