I have this script in Python which I'm running into a maya file from a
command line:
import maya.standalone
maya.standalone.initialize("Python")import maya.cmds as cmdsfrom maya import
cmdsimport maya.mel as melimport 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' )
But I get this error when I try to run the batch file:
File "/Users/../Scripts/MayaVectorScript.py", line 23, in materialFile
cmds.sets( e=True, forceElement= myMaterial + 'SG' ) TypeError: No
object matches name: BlueGlassSG
In the Hypershade, the shader BlueGlass is connected to a shader group (SG)
with the same name BlueglassSG and the script works from the UI inside maya.
Do I need to load a plugin or something in the script to make it run in the
batch file?
--
You received this message because you are subscribed to the Google Groups
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/python_inside_maya/8b45e326-034e-4c65-959e-be9ea2adafa6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.