I am trying to list colorSet names in order to control how many of them I have on a given mesh. I can't seem to pass the right variable to the cmds.ls for it to recognize colorSet
I've read around and it seems like mostly cmds.ls is used for meshes but with correct attributes it can be used to list pretty much anything
import maya.cmds as cmds
colorList = cmds.ls('colorSet*', sl=True, long=True)
objects = cmds.ls( sl=True, long=True)
if len(objects) > 0:
if len(colorList) > 0:
cmds.delete(colorList)
result=cmds.polyColorSet(cr=True, colorSet='colorSet')
result=cmds.polyColorSet(cr=True, colorSet='colorSet')
The code ends up ignoring my if statement and continues to create colorSets indefinitely. How do I make my code delete old ones before creating new ones?