Change animation curve colors
 
 
 

You can specify custom colors for the animation curves that appear in the Graph Editor.

Change animation curve colors from the Graph Editor

To change the color of 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.

Change animation curve colors through the Attribute Editor or with MEL

With the Use Curve 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” later in this section.

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).

NoteThe 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. Double-click the color swatch to launch the Color Chooser.
  7. In the Color Chooser, select a custom color for the curve and click Accept.

The color you selected with the Color Chooser 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 );