Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save manhha00/90b5a7d071a69f83df63dac7307d2b7a to your computer and use it in GitHub Desktop.
Save manhha00/90b5a7d071a69f83df63dac7307d2b7a to your computer and use it in GitHub Desktop.
maya - python - expresison - scriptJob change color when change attribute
import maya.cmds as cmds
def colorChange() :
if cmds.getAttr('pSphere1.color')==0 : # attribut a Blue
cmds.polyColorPerVertex(r=.159,g=.3811,b=.86,a=1,cdo=True)
elif cmds.getAttr('pSphere1.color')==1 : # attribut a Red
cmds.polyColorPerVertex(r=.86,g=.159,b=.3811,a=1,cdo=True)
elif cmds.getAttr('pSphere1.color')==2 : # attribut a Green
cmds.polyColorPerVertex(r=.3811,g=.86,b=.159,a=1,cdo=True)
cmds.scriptJob(attributeChange=['pSphere1.color',colorChange])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment