MRampAttribute

Base Class

None.

Constants

NameTypeDescription
Interpolation Types
kNone int  
kLinear int  
kSmooth int  
kSpline int  

Static Methods

NameParametersReturnsDescription
createColorRamp(longName, shortName) longName - string
shortName - string
MObject Creates and returns a new color ramp attribute.
createCurveRamp(longName, shortName) longName - string
shortName - string
MObject Creates and returns a new curve ramp attribute.

Constructors

SignatureParametersDescription
MRampAttribute()   Default constructor. Returns a new, empty MRampAttribute object.
MRampAttribute(src) src - MRampAttribute Copy constructor. Returns a new MRampAttribute referencing the same attribute as src.
MRampAttribute(plug) plug - MPlug Returns a new MRampAttribute referencing the same attribute as plug. Raises a TypeError if plug's attribute is not a ramp.
MRampAttribute(node, attribute) node - MObject
attribute - MObject
Returns a new MRampAttribute referencing the specified attribute of the given node. Raises a TypeError if attribute is not a ramp.

Object Methods

SignatureParametersReturnsDescription
addEntries(positions, values, interps) positions - sequence of floats
values - sequence of floats or MColors
interps - sequence of Interpolation Type constants
Reference to self. Adds entries to the ramp. For a curve ramp values must be a sequence of floats, for color ramps it must be a sequence of MColors. A TypeError will be raised if the wrong type of values are supplied.
deleteEntries(indices) indices - sequence of ints Reference to self. Removes from the ramp those entries with the specified indices. Raises a ValueError if an attempt is made to remove the last remaining entry from the ramp.
getEntries()   (indices, positions, values, interps) Returns a tuple containing all of the entries in the ramp. The first element of the tuple is an MIntArray containing the indices. The second element is an MFloatArray containing the positions. The third element is the values, which is an MFloatArray for a curve ramp or an MColorArray for a color ramp. The fourth and final element of the tuple is an MIntArray containing the interps, which are Interpolation Type constants.
getValueAtPosition(position) position - float float or MColor Returns the value of the entry at the given position. The value will be a float for a curve ramp or an MColor for a color ramp.
numEntries()   int Returns the number of entries in the ramp.
setInterpolationAtIndex(interp, index) interp - Interpolation Type constant
index - int
Reference to self. Sets the interpolation of the entry at the given index.
setPositionAtIndex(position, index) position - float
index - int
Reference to self. Sets the position of the entry at the given index.
setValueAtIndex(value, index) value - float or MColor
index - int
Reference to self. Sets the value of the entry at the given index. The value must be a float for a curve ramp or an MColor for a color ramp. A TypeError will be raised if the wrong type of value is supplied.

Object Attributes

NameTypeAccessDescription
isColorRamp bool R True if the attribute is a color ramp.
isCurveRamp bool R True if the attribute is a curve ramp.

Sequence Support

None.

Number Support

None.

Comparison Support

None.

© 2011 Autodesk, Inc. All rights reserved.