Showing category "Maya API in Python" (Show all posts)

Maya's Python API 2.0.

Posted by Jeremy YeoKhoo on Thursday, April 17, 2014, In : Maya API in Python 
This is by now a bit of old news. But I am going to spend more time on this blog updating and releasing more of my code onto the interwebs. So here it is. Autodesk Maya has released a new python friendly API since their Maya 2013 release where you can easily access by importing their module 

import maya.api.OpenMaya as api
To this effect, they claim that using their python api is virtually 2 to 3 times faster than using their old api version. Remember that the original API is a python wr...
Continue reading ...

MVector class using MScriptUtil()

Posted by Jeremy YeoKhoo on Monday, March 5, 2012, In : Maya API in Python 
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
Continue reading ...

The MVector class in Python

Posted by Jeremy YeoKhoo on Monday, February 27, 2012, In : Maya API in Python 
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 ...

About Me

Character TD and Creature TD with some generalist skills