Change animation curve colors

You can set default curve colors in the Preferences menu Color Settings window. You can also specify custom colors for the animation curves that appear in the Graph Editor. See Graph editor colors for an explanation of what the different colors represent.

Change individual animation curve colors from the Graph Editor

To change the color of individual animation curves

  1. In the Graph Editor, select the curves whose color you want to change.
  2. Select Edit > Change Curve Color > .

    The Change Curve Color Options window appears. (See Change Curve Color > in the Edit menu.)

  3. Set a new color for the animation curves you selected and do one of the following:
    • Click Color to apply the current color and close the Change Curve Color Options window.
    • Click Apply to apply the current color to the curves and keep the Change Curve Color Options window open for further editing.

    The colors of the selected curves change to the color you specified in the Change Curve Color Options window.

Associate curve colors with attribute names

To associate an attribute name with a curve color

  1. Select an object that has animation curves for the attribute(s) you want to assign with a curve color.
  2. In the Graph Editor (Window > Animation Editor > Graph Editor), select the attributes you want to associate with a color.
  3. From the Graph Editor menu bar, select Edit > Set Curve Colors.

    The Curve Colors window appears with the attributes you selected listed in the left panel.

    Tip:

    You can also select attributes in the Graph Editor’s Outliner at any time and click Add in the Curve Colors window to load them.

  4. Do the following for each attribute you want to assign with its own color:
    • Select the attribute in the Curve Colors window.
    • Click the color swatch to open the Color History settings.
    • Choose the color you want in the Curve Colors window.

    The animation curves controlling this attribute are now set to the color you have assigned.

To reset the curve color

  1. Select the attribute in the Graph Editor’s Outliner, then select Edit > Set Curve Colors.
  2. Select the attribute name in the Curve Colors window that appears.
  3. Click Remove.

    The animation curve is reset to its default color.

Change animation curve colors through the Attribute Editor or with MEL

With the UseCurve Color and Curve Color attributes you can set the colors for individual curves or use more global operations such as coloring a curve based on which characters they drive to color groups of curves at a time. This type of global operation can be achieved through MEL scripts. For a sample MEL script, see Example MEL procedure for customizing the color of multiple animation curves.

All user-defined color settings for animation curves appear in both the Graph Editor’s Outliner and Curve View. The Use Curve Color checkbox and Curve Color swatch are located in the Anim Curve Attributes section of each animation curve node (for example, animCurven).

Note:

The maximum number of custom colored curves that can be displayed at any one time is 20. When this number is exceeded, curves are displayed using their default colors.

To toggle between custom colors and the default curve colors

  1. Turn the Use Curve Color attribute on or off.

    Use Curve Color is located in the Anim Curve Attributes section of each animation curve node (for example, animCurven). See the following procedure.

To set custom animation curve colors

  1. Select the animated object.
  2. Open the Graph Editor.
  3. In the graph view, select the animation curve.
  4. Select Curves > Spreadsheet.

    The Attribute Editor opens.

  5. In the Anim Curve Attributes section of the animCurven tab, turn on Use Curve Color.
  6. Click the color swatch to launch the Color History settings.
  7. In the Color History settings, select a custom color for the curve.

The color you selected appears in the Curve Color swatch. In the Graph Editor’s Curve View, the animation curve is now the color of the Curve Color swatch.

Example MEL procedure for customizing the color of multiple animation curves

//+
//************************************************************************
//
// Synopsis:
// global proc int colourSelectedCurves( int $how, float $r,
// float $g, float $b )
//
// Description:
// This MEL procedure assigns a curve display color to all
// selected curves and curves connected to selected nodes. The curve display
// color is used for drawing curves in the Graph Editor and for labelling
// curves in the Dope Sheet.
// The following example creates a cube, torus, and sphere, animates them by
// creating translation curves for each, then selects the cube and sphere and
// sets their curve colors as magenta. 
// If you then select all three objects and open the Graph Editor, the curves
// associated with the cube and sphere appear magenta and the curves
// associated with the torus appear their default colours.

// Parameters:
// int $how : (in) Specifies how the "useCurveColour"
// attribute is set for each curve.
// If 1, curves will display with the
// newly assigned colour; if 0, curves
// will display in default colour.
// float $r : (in) Red component of colour to assign.
// float $g : (in) Green component of colour to assign.
// float $b : (in) Blue component of colour to assign.
//
// Returns:
// int numCurves : Returns the number of curves a colour
// was assigned to.
//
//************************************************************************
//-
global proc int colourSelectedCurves( int $how, float $r, float $g,
 float $b )
{
 int $count;
 int $i;
 int $j;
 // Get the list of selected nodes.
 //
 string $selectionList[] = `ls -sl`;
 // Assign colours based on the selected set of nodes.
 //
 $count = 0;
 for ( $i = 0; $i < size( $selectionList ); $i++ ) {
 string $s = $selectionList[$i];
 string $isCurve[] = `ls -type "animCurve" $s`;
 if ( size( $isCurve ) != 0 ) {
 // A curve is selected: assign it the specified colour.
 //
 setAttr ($s + ".useCurveColor") $how;
 setAttr ($s + ".curveColorR") $r;
 setAttr ($s + ".curveColorG") $g;
 setAttr ($s + ".curveColorB") $b;
 $count++;
 } else {
 // A non-curve node is selected: assign all curves which
 // are directly connected to it the specified colour.
 //
 string $connectedNodes[] = `listConnections $s`;
 for ( $j = 0; $j < size( $connectedNodes ); $j++ ) {
 string $c = $connectedNodes[$j];
 string $isCurve[] = `ls -type "animCurve" $c`;
 if ( size( $isCurve ) != 0 ) {
 // We are connected to a curve; assign it the
 // specified curve colour.
 //
 setAttr ($c + ".useCurveColor") $how;
 setAttr ($c + ".curveColorR") $r;
 setAttr ($c + ".curveColorG") $g;
 setAttr ($c + ".curveColorB") $b;
 $count++;
 // Return the number of curves we set the colour on.
 //
 return( $count );
Here is an example of how to test the above procedure:
// Create three animated objects
//
string $c[] = `polyCube`;
move 10 2 3;
setKeyframe ($c[0]+".t");
currentTime 16;
move 10 -2 3;
setKeyframe ($c[0]+".t");
string $t[] = `torus`;
currentTime 1;
move -10 -2 -3;
setKeyframe ($t[0]+".t");
currentTime 16;
move 10 -2 -3;
setKeyframe ($t[0]+".t");
string $s[] = `sphere`;
currentTime 1;
move -10 -2 3;
setKeyframe ($s[0]+".t");
currentTime 16;
move 10 -2 -3;
setKeyframe ($s[0]+".t");
// Set the colour of the cube and sphere to magenta,
//
select $c[0] $s[0];
colourSelectedCurves( 1, 1.0, 0.0, 1.0 );