Created
November 28, 2017 02:14
-
-
Save manhha00/90b5a7d071a69f83df63dac7307d2b7a to your computer and use it in GitHub Desktop.
maya - python - expresison - scriptJob change color when change attribute
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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