我有這個腳本在Python這我遇到一個瑪雅文件從一個命令行的Python腳本時:對象匹配誤差從命令行運行瑪雅
import maya.standalone
maya.standalone.initialize("Python")
import maya.cmds as cmds
from maya import cmds
import maya.mel as mel
import glob
def importFile(i):
cmds.file(i, i=True, groupReference=True, groupName="myobj")
def materialFile():
if cmds.objExists('Panel*'):
cmds.select("Panel*", replace=True)
myMaterial = "BlueGlass"
cmds.sets(e=True, forceElement= myMaterial + 'SG')
if cmds.objExists('Body*'):
cmds.select("Body*", replace=True)
myMaterial3 = "Silver"
cmds.sets(e=True, forceElement= myMaterial3 + 'SG')
但是當我嘗試我得到這個錯誤運行該批處理文件:
File "/Users/../Scripts/MayaVectorScript.py", line 23, in materialFile
cmds.sets(e=True, forceElement= myMaterial + 'SG')
TypeError: No object matches name: BlueGlassSG
在材質編輯,着色器BlueGlass連接到着色組(SG)具有相同的名稱BlueglassSG和腳本在Maya中的UI工作。
是否需要在腳本中加載插件或其他東西才能使其在批處理文件中運行?
着色器組被稱爲「BlueglassSG」,你正在尋找「BlueGlassSG」明白了嗎? –
@AriGold嗯,我想我需要在Python中找到它。但是,如何? – jpits
myMaterial =「BlueGlass」to myMaterial =「Blueglass」?我認爲這就是阿里正在談論的。 – Achayan