2010年9月6日月曜日

Implement Python Threading Module in Maya

I had run several funny experimental scripts on MAYA with Python's threading module.

The result was very very impressive.

First , a test with 1000000(1 Million) loop and without any extra print command.
0.219s (With Single-Threading)
0.078s (With Multi-Threading)
Multi was about 3x times faster than Single.

Second, a test with 8000 loop and with extra print command.
115.187 (With Single-Threading)
60.001 (With Multi-Threading)
Multi was about 2x times faster than Single.

Only strange thing was, apparently if you attempt to use “maya.cmds” directly in a python “class” scope that will return a error message to you.(like cmds.ls)

My issue is using OpenMaya API instead of “maya.cmds” , some like this
import maya.OpenMaya as OpenMaya
instead of
import maya.cmds as cmds

Maybe I did some wrong , if anyone know other issue can fix or avoid it , please let me know , thanks in advance.

So , my next To-do list will be writing a custom plug-ins with Python's threading module , that can allow me to export Maya's Fluid data(like Density , Velocity and so on) to Krakatoa. Ya, you can use Maya's fluidVoxelInfo command, but if with a higher resolution that will become you nightmare ;)