Hello lovely peeps,
I'm very new to writing scripts but have always wanted to get more into it!
I'm currently trying to write a MEL script that selects all objects with the suffix of hg in the mesh name, adds the existing lambert to all, polySoftEdges everything, deletes input history, and cleans up the scene. I've added the lambert mat part specifically due to work reasons heh-
I'm having problems with trying to figure out a way to get polySoftEdge to work. Currently when I run this script:
select -r "hg*";
sets -e -forceElement initialShadingGroup;
polySoftEdge -a 180 -ch 1;
delete -ch;
performCleanUpScene()
it gives me the Error of how line 3 Doesn't work with multiple objects selected.
Is there a way to get around this?
Much appreciated and thank you for your time~
Zuna
Replies
import maya.cmds as cmds
import maya.mel as mel
cmds.select("*hg*");
models = cmds.ls(sl=True)
for m in models:
cmds.polySoftEdge( a=180 );
cmds.delete(all=True, ch=True);
mel.eval("cleanUpScene 3")
It still does the same thing with the error of doesn't work with multiple objects selected.
Either response in MEL or Python would be much appreciated~