【发布时间】:2015-08-19 18:24:06
【问题描述】:
我无法让导出功能正常工作,而且我确信我只是有愚蠢的语法或某处。基本上我正在打开一个 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
【问题讨论】:
-
尝试全部导出而不是选择并导出选定的......?
-
原谅我的无知,只是想验证一下,这样可以导出:mc.file(path,pr=1,typ="OBJexport",ea=True,op="groups=0 ;ptgroups=0;materials=0;smoothing=0;normals=0")