• Fernanda

Changing Control Color with PyMEL | Tech Art Bites

Ever tried changing control color through code in Maya? It's specially useful when writing an autorigger!

You can change the color of the curve through the .overrideColor attribute of nurbsCurves.


The attribute is set with integers that correspond to colors in Maya:

colorList = {"BLACK" : 1, "GREY" : 3, "DARK RED" : 4, "DARK BLUE" : 5, "BLUE" : 6, "DARK GREEN" : 7, "DARK PURPLE" : 8, "HOT PINK" : 9, "BROWN" : 10, "DARK BROWN" : 11, "BRIGHT RED" : 13, "NEON GREEN" : 14, "NAVY BLUE" : 15, "WHITE" : 16, "YELLOW" : 17, "LIGHT BLUE" : 18, "TURQUOISE" : 19, "LIGHT BROWN" : 21, "PURPLE" : 30}
curv = [control curve]
# grab the shape node with pickWalk(direction = "down")
curvShape = pm.pickWalk(curv, direction = "down", type = "nodes") [0]
pm.setAttr(str(curvShape) + ".overrideEnabled", 1)
pm.setAttr(str(curvShape) + ".overrideColor", colorList[color])

I usually have this as a staticmethod inside a class. The curv can be whatever curve the user has selected at the time the function is called.


Hope this helps!

-Fernanda



49 views0 comments

Recent Posts

See All

On the Subject of Resumes

Thank you again Sonia Michaels for providing some great material I could use for this post, and also @slizagna on twitter for a very helpful thread! Always keep your resume updated! I don't care if yo

Tech Art Tomfoolery: Unreal VR and glsl

Happy Tech Art Tuesday! My Youtube Channel has 200 subs now! That means I'm famous! I don't have a tutorial today but I did want to showcase some of the stuff I did this weekend. On Saturday morning I