hi,
My setUp - Mac OS X, Maya 2013
1)I have a lot of Maya files of extension .ma and I am going to write a script to export all of them to FBX format.
2)And for some of the files, I want particular selections to be exported from each file. So, certain parameters need to be passed to the command line I guess.
My initial thought was to call subprocess.Popen constructor to create a child process which does the conversion for each .ma file coming out of a list of .ma files. but I got another suggestion that involving the pYTHON script through mayapy and the below code was suggested:
basic psuedo-code:
CODE:
import maya.standalone
import maya.cmds as cmds
import maya.mel as mm
import glob
maya.standalone.initialize( name=‘python’ )
def exportFBX():
for f in glob.iglob("/chosenDir//.ma"):
cmds.file (f, force=True, open=True)
#Insert any filter code here
mm.eval(“FBXExport -f %s.fbx;”%(f.rpartition(’.ma’)[0]))
exportFBX()
To run : mayapy this.py
##############
The initial goal was :
Recursively traverse a series of directories
- Locate all .ma (Maya) files within
- Export those files to FBX format using varying options depending on the directory path. (animations, models, environments, etc.)
- The varying options will mostly require particular selections to be exported from each file, but may have FBX-specific settings.
#############
So, even if you tell me the commands to do the export from command line in mAC os x, then I can automate the rocess using blog or os.walk and invoking this command for each .ma file.
Thanks,
Miku