Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Maya AbcExport with Python

I have the script to export an Alembic from Maya with MEL :

AbcExport(-frameRange 31 41 -writeVisibility -dataFormat ogawa -root |myChar:char|myChar:GEOchar -file E:/test.abc)

I would like to do the same with Python. Something like :

cmds.AbcExport(...)

I can't find any documentation about it... Any idea?

Thank you a lot!

like image 981
Caryluna Avatar asked Apr 25 '17 13:04

Caryluna


2 Answers

You can run this command on Python using the jobArg flag:

import maya.cmds as cmd

start = 0
end = 120
root = "-root pSphere1 -root pCube1"
save_name = "c:\documents\maya\project\default\cache\alembicTest.abc"

command = "-frameRange " + start + " " + end +" -uvWrite -worldSpace " + root + " -file " + save_name
cmd.AbcExport ( j = command )

Just tested this with Maya 2016.5, and it works for me.

Like you, I could not find any official documentation showing this, only unofficial sources like these:

http://www.wenie.net/notes/alembic-cache-script-via-python (where I found the example code)

http://forums.cgsociety.org/archive/index.php?t-1156807.html (the python format is used on the bottom post, which means this exists back to Maya 2015, if one is still using it)

like image 161
beisbeis Avatar answered Nov 15 '22 04:11

beisbeis


You can find help for cmds.AbcExport and cmds.AbcImport by instantiating them with the h arg set to True. The following commands will print help docs:

maya.cmds.AbcExport(h=True)
maya.cmds.AbcImport(h=True)
like image 30
ahfx Avatar answered Nov 15 '22 05:11

ahfx