It’s the little things

Sometimes when I’m working along in Maya I come across some little issue that could easily be resolved if the object was either transparent or another color, enabling me to view it against a background or objects in the scene. In this particular case I was trying to learn about xGen’s hair system and applying different dynamic properties to it. My object was blue, and the Maya work-space color is blue(ish), and deselected curves are again, blue, so it can get pretty muddy.

To fix this I will often grab all the objects and do a mass change on them while working to make it easier to see what I’m doing. In this case I only had about 20+ hair curves to update, but obviously I still didn’t want to go through and do it manually! Using python or MEL I can write a bit of code and loop through all the hair curves colors to see what works best. The result makes it very simple to see all the dynamic changes being applied.

Use the code below to change the colors of a lot of curves all at once. This will also change poly edge colors (and I’m sure many other objects as long as it’s shape layer has the attribute “Drawing Overrides” in it):


#change all curves to a new color
import maya.cmds as mc
getCurves = mc.ls(sl=True, o=True, dag=True, s=True)
for curve in getCurves:
     mc.setAttr(curve + ".overrideEnabled", 1)
     #overrideColor is the command to change the color value, 13 red.
     mc.setAttr(curve + ".overrideColor", 13)

If you copy and apply this in the script editor in Maya you might find it doesn't work because of the formatting. Start by removing the indent in the loop and adding it again.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Powered by WordPress.com.

Up ↑

%d bloggers like this: