我无法使导出功能正常工作,我确信我只是在某处使用愚蠢的语法或某种东西。基本上我打开一个OBJ文件,操作它,并将其保存到另一个OBJ文件。一切正常,直到最终出口。关于可能的语法问题的任何想法?当我回到我的工作计算机时,如果需要,我可以从控制台提供错误反馈。谢谢你的帮助!
import maya.cmds as mc
#one two skip a few
#open the file
mc.file(mayaFiles[i], open = True, force = True)
#do some things to the file
#now let's save it!
mc.select( all=True )
outputDir = mc.workspace (query = True, fileRule = True)
path = "Users/MyName/MyPath/Object.obj"
mc.file(path,pr=1,typ="OBJexport",es=1,op="groups=0; ptgroups=0; materials=0; smoothing=0; normals=0")
print path;
编辑:在@brycelynch和其他人的一些想法以及我自己的一些实验之后,我现在带着我的导出代码:
c.select( all=True )
outputDir = mc.workspace (query = True, dir = True)
path = os.path.join(outputDir+"/objExp/","Object"+str(i)+".obj")
print outputDir
mc.loadPlugin('objExport')
mc.file(path,pr=1,typ="OBJ",es=1,op="groups=0; ptgroups=0;materials=0; smoothing=0; normals=0")
我目前得到的错误是:
Could not save file "/Users/myPath/objExp/Object0.obj
答案 0 :(得分:0)
试试这个:
import maya.cmds as mc
import os.path
mc.select( all=True )
outputDir = mc.workspace (query = True, dir = True)
path = os.path.join(outputDir,"Object.obj")
print outputDir;
mc.file(path,pr=1,typ="OBJexport",es=1,op="groups=0; ptgroups=0;materials=0; smoothing=0; normals=0")
print path;
答案 1 :(得分:0)
#delete nondeformer history since objs can be funky
mel.eval('doBakeNonDefHistory( 1, {"prePost" });')
#make sure obj plugin is included
mc.loadPlugin('objExport')
#export that sucker
mel.eval('file -force -options "groups=1;ptgroups=1;materials=1;smoothing=1;normals=1" -type "OBJexport" -pr -ea "/Users/myane/mypath/objExp/%s.obj";'%("myFileName"))