C++ API Reference
MRampAttribute Class Reference

Create and manipulate ramp attributes. More...

#include <MRampAttribute.h>

Public Types

enum  MInterpolation { kNone = 0, kLinear = 1, kSmooth = 2, kSpline = 3 }
 Interpolation methods. More...
 

Public Member Functions

 MRampAttribute ()
 Creates an emptry Ramp Attribute class. More...
 
 MRampAttribute (const MRampAttribute &other)
 Copy constructor operator. More...
 
 MRampAttribute (const MPlug &obj, MStatus *ReturnStatus=nullptr)
 Creates a new Ramp Attribute class. More...
 
 MRampAttribute (const MObject &node, const MObject &attr, MStatus *ReturnStatus=nullptr)
 Creates a new Ramp Attribute class. More...
 
MRampAttributeoperator= (const MRampAttribute &other)
 Assignment operator. More...
 
 ~MRampAttribute ()
 Destructor.
 
unsigned int getNumEntries (MStatus *ReturnStatus=nullptr)
 Gets the number of entries in the ramp attribute. More...
 
void getEntries (MIntArray &indexes, MFloatArray &positions, MFloatArray &values, MIntArray &interps, MStatus *ReturnStatus=nullptr)
 Gets all the entries in a ramp attribute. More...
 
void getEntries (MIntArray &indexes, MFloatArray &positions, MColorArray &colors, MIntArray &interps, MStatus *ReturnStatus=nullptr)
 Gets all the entries in a ramp attribute. More...
 
void addEntries (MFloatArray &positions, MColorArray &values, MIntArray &interps, MStatus *ReturnStatus=nullptr)
 Adds entries into a ramp attribute. More...
 
void addEntries (MFloatArray &positions, MFloatArray &values, MIntArray &interps, MStatus *ReturnStatus=nullptr)
 Adds entries into a ramp attribute. More...
 
void deleteEntries (MIntArray &indexes, MStatus *ReturnStatus=nullptr)
 Deletes entries in the ramp attribute. More...
 
void setColorAtIndex (MColor &color, unsigned int index, MStatus *ReturnStatus=nullptr)
 Sets the color of a given entry. More...
 
void setValueAtIndex (float value, unsigned int index, MStatus *ReturnStatus=nullptr)
 Sets the value of a given entry. More...
 
void setPositionAtIndex (float position, unsigned int index, MStatus *ReturnStatus=nullptr)
 Sets the position of a given entry. More...
 
void setInterpolationAtIndex (MRampAttribute::MInterpolation interp, unsigned int index, MStatus *ReturnStatus=nullptr)
 Sets the interpolation of a given entry. More...
 
bool isColorRamp (MStatus *ReturnStatus=nullptr) const
 Checks to see whether this ramp is a color ramp. More...
 
bool isCurveRamp (MStatus *ReturnStatus=nullptr) const
 Checks to see whether this ramp is a curve ramp. More...
 
void getColorAtPosition (float position, MColor &color, MStatus *ReturnStatus=nullptr)
 Gets the color at a position in the current evaluation context. More...
 
void getValueAtPosition (float position, float &value, MStatus *ReturnStatus=nullptr)
 Gets the value at position in the current evaluation context. More...
 
void sampleColorRamp (unsigned int numberOfSamples, MColorArray &colors, MStatus *ReturnStatus=nullptr)
 Perform a linear sampling of this color ramp at the current evaluation context and return the results. More...
 
void sampleValueRamp (unsigned int numberOfSamples, MFloatArray &values, MStatus *ReturnStatus=nullptr)
 Perform a linear sampling of this curve ramp in the current evaluation context and return the results. More...
 
bool hasIndex (unsigned int index, MStatus *ReturnStatus=nullptr) const
 Returns true if this ramp attribute has an entry defined with a given index. More...
 
MStatus sort (bool ascending=true)
 Sort the ramp attribute entries by position in ascending or descending order, other arrays are sorted accordingly. More...
 
MStatus pack ()
 Change the indices numbering by re-ordering them from 0. More...
 
MStatus setRamp (float value, float position=1.0f, MInterpolation interp=kLinear)
 Sets this ramp attribute with one entry defined from a float, position and interpolation value. More...
 
MStatus setRamp (const MColor &color, float position=1.0f, MInterpolation interp=kLinear)
 Sets this ramp attribute with one entry defined from a color, position and interpolation value. More...
 
MStatus setRamp (const MFloatArray &values, const MFloatArray &positions, const MIntArray &interps)
 Sets this ramp attribute with entries defined from a set of float, position and interpolation value arrays. More...
 
MStatus setRamp (const MColorArray &values, const MFloatArray &positions, const MIntArray &interps)
 Sets this ramp attribute with entries defined from a set of color, position and interpolation value arrays. More...
 
void getColorAtPosition (float position, MColor &color, MStatus *ReturnStatus, MDGContext &)
 This method is obsolete. More...
 
void getValueAtPosition (float position, float &value, MStatus *ReturnStatus, MDGContext &)
 This method is obsolete. More...
 
void sampleColorRamp (unsigned int numberOfSamples, MColorArray &colors, MStatus *ReturnStatus, MDGContext &)
 This method is obsolete. More...
 
void sampleValueRamp (unsigned int numberOfSamples, MFloatArray &values, MStatus *ReturnStatus, MDGContext &)
 This method is obsolete. More...
 

Static Public Member Functions

static MObject createCurveRamp (const MString &attrLongName, const MString &attrShortName, MStatus *ReturnStatus=nullptr)
 This function creates the curve ramp attribute. More...
 
static MObject createColorRamp (const MString &attrLongName, const MString &attrShortName, MStatus *ReturnStatus=nullptr)
 This function creates the color ramp attribute. More...
 
static MObject createRamp (const MString &attrLongName, const MString &attrShortName, const MObject &node, float val, float pos=1.f, MInterpolation interp=kLinear, MStatus *ReturnStatus=nullptr)
 Creates a new curve ramp attribute initialized with an entry defined from a float, position and interpolation value. More...
 
static MObject createRamp (const MString &attrLongName, const MString &attrShortName, const MObject &node, const MColor &color, float pos=1.0f, MInterpolation interp=kLinear, MStatus *ReturnStatus=nullptr)
 Creates a new color ramp attribute initialized with one entry defined from a color, position and interpolation value. More...
 
static MObject createRamp (const MString &attrLongName, const MString &attrShortName, const MObject &node, const MFloatArray &values, const MFloatArray &positions, const MIntArray &interps, MStatus *ReturnStatus=nullptr)
 Creates a new curve ramp attribute initialized with entries defined from a set of float, position and interpolation value arrays. More...
 
static MObject createRamp (const MString &attrLongName, const MString &attrShortName, const MObject &node, const MColorArray &colors, const MFloatArray &positions, const MIntArray &interps, MStatus *ReturnStatus=nullptr)
 Creates a new curve ramp attribute initialized with entries defined from a set of color, position and interpolation value arrays. More...
 
static const char * className ()
 Returns the name of this class. More...
 

Detailed Description

Create and manipulate ramp attributes.

A ramp attribute consists of a set of entries describing a curve which is used to map an input value onto an output value. Each entry consists of an input position ranging from 0 to 1, an output value that position maps onto, and an enumerator indicating the type of interpolation to use between that position and the next.

Currently two types of output values are a supported: a float, in which case the attribute is displayed as a curve in the Attribute Editor, or a color, in which case the attribute is displayed as a color gradient, similar to how a ramp texture node is displayed.

The preferred way of creating a ramp is to use the createRamp set of methods. These methods will initialize the newly-created ramp with input values.

A ramp must always have at least one entry. Ramp attributes created with the createCurveRamp and creatColorRamp methods will automatically be given a default entry at position 0.0 with a value of 0.0 or black, depending upon the ramp type.

Any attempt to delete the last of a ramp's entries will fail. This means that if you want to initialize a newly-created ramp attribute with a specific set of entries you must add at least one of your new entries first before deleting the default entry. Alternatively, you can modify the default entry to match one of your new entries and then add your remaining entries.

The setRamp set of methods can be used for setting existing ramps with new entries, current entries are automatically removed and replaced with the new ones. setRamp is perfect for initializing ramps created with the createCurveRamp and creatColorRamp.

Examples:
volumeLightCmd/volumeLightCmd.cpp.

Member Enumeration Documentation

Interpolation methods.

Enumerator
kNone 

 

kLinear 

 

kSmooth 

 

kSpline 

 

Constructor & Destructor Documentation

OPENMAYA_MAJOR_NAMESPACE_OPEN MRampAttribute ( )

Creates an emptry Ramp Attribute class.

Initializes it as a null Object.

Status Codes:
None
MRampAttribute ( const MRampAttribute other)

Copy constructor operator.

Duplicates the given ramp attribute.

Parameters
[in]otherRamp attribute to be copied
Returns
A reference to the copied ramp attribute
MRampAttribute ( const MPlug obj,
MStatus ReturnStatus = nullptr 
)

Creates a new Ramp Attribute class.

If the plug is not of a ramp, then the constructor will return a failure.

Parameters
[in]objPlug of a ramp
[out]ReturnStatusreturn status
Status Codes:
  • MS::kSuccess operation successful
  • MS::kFailure the new node could not be added to the model, or the function set could not be properly initialized with the new object.
MRampAttribute ( const MObject node,
const MObject attr,
MStatus ReturnStatus = nullptr 
)

Creates a new Ramp Attribute class.

If the node does not have that attribute then the constructor will return a failure. If the attribute is not of a ramp the constructor will also fail.

Parameters
[in]nodeNode that contains a ramp attribute
[in]attrThe ramp attribute
[out]ReturnStatusreturn status
Status Codes:
  • MS::kSuccess operation successful
  • MS::kFailure the new node could not be added to the model, or the function set could not be properly initialized with the new object.

Member Function Documentation

MRampAttribute & operator= ( const MRampAttribute other)

Assignment operator.

Copies one ramp attribute to another.

Parameters
[in]otherRamp attribute to be copied
Returns
A reference to the copied ramp attribute
unsigned int getNumEntries ( MStatus ReturnStatus = nullptr)

Gets the number of entries in the ramp attribute.

Parameters
[out]ReturnStatusreturn status
Status Codes:
  • MS::kSuccess operation successful
  • MS::kFailure an error occurred while querying the ramp
Returns
The number of entries in the ramp attribute
void getEntries ( MIntArray indices,
MFloatArray positions,
MFloatArray values,
MIntArray interps,
MStatus ReturnStatus = nullptr 
)

Gets all the entries in a ramp attribute.

If the ramp is a color ramp, then this function will return a failure.

Parameters
[out]indicesunique values that specify each entry in the ramp
[out]positionsthe positions of each entry (can range from 0 to 1)
[out]valuesthe values of the entries at each position (can range from 0 to 1)
[out]interpsarray of MRampAttribute::MInterpolation values giving the interpolations of the entries at each position.
[out]ReturnStatusStatus code.
Status Codes:
  • MS::kSuccess operation successful
  • MS::kInvalidParameter the specified attribute is not a curve ramp attribute
  • MS::kFailure an error occurred while retrieving the ramp entries
Examples:
volumeLightCmd/volumeLightCmd.cpp.
void getEntries ( MIntArray indices,
MFloatArray positions,
MColorArray colors,
MIntArray interps,
MStatus ReturnStatus = nullptr 
)

Gets all the entries in a ramp attribute.

If the ramp is a curve ramp, then this function will return a failure.

Parameters
[out]indicesunique values that specify each entry in the ramp
[out]positionsthe positions of each entry (can range from 0 to 1)
[out]colorsthe colors of the entries at each position
[out]interpsarray of MRampAttribute::MInterpolation values giving the interpolations of the entries at each position.
[out]ReturnStatusStatus code.
Status Codes:
  • MS::kSuccess operation successful
  • MS::kInvalidParameter the specified attribute is not a color ramp attribute
  • MS::kFailure an error occurred while retrieving the ramp entries
void addEntries ( MFloatArray positions,
MColorArray colors,
MIntArray interps,
MStatus ReturnStatus = nullptr 
)

Adds entries into a ramp attribute.

If the ramp is a curve ramp, then this function will return a failure.

Parameters
[in]positionsthe positions of the new entries (can range from 0 to 1)
[in]colorsthe colors of the new entries at each position
[in]interpsarray of MRampAttribute::MInterpolation values giving the interpolations of the entries at each position.
[out]ReturnStatusStatus code.
Status Codes:
  • MS::kSuccess operation successful
  • MS::kInvalidParameter the attribute is not a color ramp attribute or array sizes do not match
  • MS::kFailure an error occurred while adding ramp entries
Examples:
volumeLightCmd/volumeLightCmd.cpp.
void addEntries ( MFloatArray positions,
MFloatArray values,
MIntArray interps,
MStatus ReturnStatus = nullptr 
)

Adds entries into a ramp attribute.

If the ramp is a color ramp, then this function will return a failure.

Parameters
[in]positionsthe positions of the new entries (can range from 0 to 1)
[in]valuesthe values of the new entry at each position
[in]interpsarray of MRampAttribute::MInterpolation values giving the interpolations of the entries at each position.
[out]ReturnStatusStatus code.
Status Codes:
  • MS::kSuccess operation successful
  • MS::kInvalidParameter the attribute is not a curve ramp attribute or array sizes do not match
  • MS::kFailure an error occurred while adding ramp entries
void deleteEntries ( MIntArray indices,
MStatus ReturnStatus = nullptr 
)

Deletes entries in the ramp attribute.

If any one of the indices is incorrect, then this function will not delete any of the entries.

A ramp attribute must always have at least one entry. Any attempt to delete the last remaining entry will fail.

Parameters
[in]indicesthe entries that need to be deleted
[out]ReturnStatusStatus code.
Status Codes:
  • MS::kSuccess operation successful
  • MS::kFailure an error occured while deleting ramp entries. It is not valid to delete all entries in a ramp.
Examples:
volumeLightCmd/volumeLightCmd.cpp.
void setColorAtIndex ( MColor color,
unsigned int  index,
MStatus ReturnStatus = nullptr 
)

Sets the color of a given entry.

If there is no entry at the given index, then this method will return a failure. If this ramp is a curve ramp, then this method will return a failure.

Parameters
[in]colorthe new color for the entry
[in]indexindex of entry to change
[out]ReturnStatusreturn status
Status Codes:
  • MS::kSuccess operation successful
  • MS::kFailure the new node could not be added to the model, or the function set could not be properly initialized with the new object.
Examples:
volumeLightCmd/volumeLightCmd.cpp.
void setValueAtIndex ( float  value,
unsigned int  index,
MStatus ReturnStatus = nullptr 
)

Sets the value of a given entry.

If there is no entry at the given index, then this method will return a failure. If this ramp is a color ramp, then this method will return a failure.

Parameters
[in]valuethe new value for the entry
[in]indexindex of entry to change
[out]ReturnStatusreturn status
Status Codes:
  • MS::kSuccess operation successful
  • MS::kFailure the new node could not be added to the model, or the function set could not be properly initialized with the new object.
Examples:
volumeLightCmd/volumeLightCmd.cpp.
void setPositionAtIndex ( float  position,
unsigned int  index,
MStatus ReturnStatus = nullptr 
)

Sets the position of a given entry.

If there is no entry at the given index, then this method will return a failure.

Parameters
[in]positionthe new position for the entry
[in]indexindex of entry to change
[out]ReturnStatusreturn status
Status Codes:
  • MS::kSuccess operation successful
  • MS::kFailure the new node could not be added to the model, or the function set could not be properly initialized with the new object.
Examples:
volumeLightCmd/volumeLightCmd.cpp.
void setInterpolationAtIndex ( MRampAttribute::MInterpolation  interp,
unsigned int  index,
MStatus ReturnStatus = nullptr 
)

Sets the interpolation of a given entry.

If there is no entry at the given index, then this method will return a failure.

Parameters
[in]interpthe new interpolation for the entry
[in]indexindex of entry to change
[out]ReturnStatusreturn status
Status Codes:
  • MS::kSuccess operation successful
  • MS::kFailure the new node could not be added to the model, or the function set could not be properly initialized with the new object.
Examples:
volumeLightCmd/volumeLightCmd.cpp.
bool isColorRamp ( MStatus ReturnStatus = nullptr) const

Checks to see whether this ramp is a color ramp.

Parameters
[out]ReturnStatusreturn status
Returns
true if the ramp is a color ramp, false otherwise
Status Codes:
  • MS::kSuccess operation successful
  • MS::kFailure the new node could not be added to the model, or the function set could not be properly initialized with the new object.
bool isCurveRamp ( MStatus ReturnStatus = nullptr) const

Checks to see whether this ramp is a curve ramp.

Parameters
[out]ReturnStatusreturn status
Returns
true if the ramp is a curve ramp, false otherwise
Status Codes:
  • MS::kSuccess operation successful
  • MS::kFailure the new node could not be added to the model, or the function set could not be properly initialized with the new object.
void getColorAtPosition ( float  position,
MColor color,
MStatus ReturnStatus = nullptr 
)

Gets the color at a position in the current evaluation context.

Only use this version if you need to deliberately change the context of evaluation, e.g. to evaluate at a different time.

If this ramp is a curve ramp, then this method will return a failure. If this ramp is empty, then this method will return a failure. If the position is out of range, either the start or end value will be returned.

Parameters
[in]positionthe desired position
[in]colorthe color at the position
[out]ReturnStatusStatus code
Status Codes:
  • MS::kSuccess operation successful
  • MS::kFailure this was not a color ramp, or the ramp was empty
Examples:
volumeLightCmd/volumeLightCmd.cpp.
void getValueAtPosition ( float  position,
float &  value,
MStatus ReturnStatus = nullptr 
)

Gets the value at position in the current evaluation context.

If this ramp is a color ramp, then this method will return a failure. If this ramp is empty, then this method will return a failure. If the position is out of range, either the start or end value will be returned.

Parameters
[in]positionthe desired position
[in]valuethe value at the position
[out]ReturnStatus
Status Codes:
  • MS::kSuccess operation successful
  • MS::kFailure this was not a curve ramp, or the ramp was empty
Examples:
volumeLightCmd/volumeLightCmd.cpp.
void sampleColorRamp ( unsigned int  numberOfSamples,
MColorArray colors,
MStatus ReturnStatus = nullptr 
)

Perform a linear sampling of this color ramp at the current evaluation context and return the results.

If this ramp is a curve ramp, then this method will return a failure. If this ramp is empty, then this method will return a failure. If the number of samples is less than two this method will return a failure.

Parameters
[in]numberOfSamplesThe number of times to sample the ramp
[out]colorsThe returned ramp samples
[out]ReturnStatusStatus code
Status Codes:
  • MS::kSuccess Operation successful
  • MS::kFailure This was not a color ramp, the ramp was empty, or too few samples were specified.
void sampleValueRamp ( unsigned int  numberOfSamples,
MFloatArray values,
MStatus ReturnStatus = nullptr 
)

Perform a linear sampling of this curve ramp in the current evaluation context and return the results.

If this ramp is a color ramp, then this method will return a failure. If this ramp is empty, then this method will return a failure. If the number of samples is less than two this method will return a failure.

Parameters
[in]numberOfSamplesThe number of times to sample the ramp
[out]valuesThe returned ramp samples
[out]ReturnStatusStatus code
Status Codes:
  • MS::kSuccess Operation successful
  • MS::kFailure This was not a curve ramp, the ramp was empty, or too few samples were specified.
bool hasIndex ( unsigned int  index,
MStatus ReturnStatus = nullptr 
) const

Returns true if this ramp attribute has an entry defined with a given index.

Parameters
[in]indexIndex to query.
[out]ReturnStatusStatus code
Returns
True if the index exists, false otherwise.
Status Codes:
  • MS::kSuccess Index found.
  • MS::kFailure Underlying object is invalid. No failure is raised if the index is not found.
Examples:
volumeLightCmd/volumeLightCmd.cpp.
MStatus sort ( bool  ascending = true)

Sort the ramp attribute entries by position in ascending or descending order, other arrays are sorted accordingly.

Indices are also compressed during the operation.

Parameters
[in]ascendingOption for sorting in ascending (default) or descending order.
Returns
Status code
Status Codes:
  • MS::kSuccess Operation successful.
  • MS::kFailure Underlying object is invalid or error while querying the ramp.
Examples:
volumeLightCmd/volumeLightCmd.cpp.
MStatus pack ( )

Change the indices numbering by re-ordering them from 0.

Returns
Status code
Status Codes:
  • MS::kSuccess Operation successful.
  • MS::kFailure Underlying object is invalid.
MStatus setRamp ( float  value,
float  position = 1.0f,
MInterpolation  interp = kLinear 
)

Sets this ramp attribute with one entry defined from a float, position and interpolation value.

Existing entries are deleted before the new one is added.

Parameters
[in]valueFloat value
[in]positionDesired position (defaults to 1.0)
[in]interpInterpolation value (defaults to MInterpolation::kLinear)
Returns
Status code
Status Codes:
  • MS::kSuccess operation successful
  • MS::kFailure Not a curve ramp.
Examples:
volumeLightCmd/volumeLightCmd.cpp.
MStatus setRamp ( const MColor color,
float  position = 1.0f,
MInterpolation  interp = kLinear 
)

Sets this ramp attribute with one entry defined from a color, position and interpolation value.

Existing entries are deleted before the new one is added.

Parameters
[in]colorColor value
[in]positionDesired position (defaults to 1.0)
[in]interpInterpolation value (defaults to MInterpolation::kLinear)
Returns
Status code
Status Codes:
  • MS::kSuccess Operation successful
  • MS::kFailure Not a color ramp.
MStatus setRamp ( const MFloatArray values,
const MFloatArray positions,
const MIntArray interps 
)

Sets this ramp attribute with entries defined from a set of float, position and interpolation value arrays.

Existing entries are deleted before the new ones are added.

Parameters
[in]valuesArray of float value.
[in]positionsArray of desired positions.
[in]interpsArray of interpolation values.
Returns
Status code
Status Codes:
  • MS::kSuccess Operation successful
  • MS::kFailure Not a curve ramp.
  • MS::kInvalidParameter Array sizes don't match.
MStatus setRamp ( const MColorArray colors,
const MFloatArray positions,
const MIntArray interps 
)

Sets this ramp attribute with entries defined from a set of color, position and interpolation value arrays.

Existing entries are deleted before the new ones are added.

Parameters
[in]colorsArray of color values.
[in]positionsArray of desired positions.
[in]interpsArray of interpolation values.
Returns
Status code
Status Codes:
  • MS::kSuccess Operation successful
  • MS::kFailure Not a color ramp.
  • MS::kInvalidParameter Array sizes don't match.
MObject createCurveRamp ( const MString attrLongName,
const MString attrShortName,
MStatus ReturnStatus = nullptr 
)
static

This function creates the curve ramp attribute.

Parameters
[in]attrLongNameLong name of the curve ramp attribute
[in]attrShortNameShort name of the curve ramp attribute
[out]ReturnStatusReturn status
Returns
Curve ramp attribute, returned as MObject.
Status Codes:
  • MS::kSuccess operation successful
  • MS::kFailure when the creation of the attr fails
Examples:
exampleRampAttribute/exampleMRampAttribute.cpp.
MObject createColorRamp ( const MString attrLongName,
const MString attrShortName,
MStatus ReturnStatus = nullptr 
)
static

This function creates the color ramp attribute.

Parameters
[in]attrLongNameLong name of the curve ramp attribute
[in]attrShortNameShort name of the curve ramp attribute
[out]ReturnStatusreturn status
Returns
Color ramp attribute, returned as MObject.
Status Codes:
  • MS::kSuccess operation successful
  • MS::kFailure when the creation of the attr fails
Examples:
exampleRampAttribute/exampleMRampAttribute.cpp.
MObject createRamp ( const MString attrLongName,
const MString attrShortName,
const MObject node,
float  value,
float  position = 1.f,
MInterpolation  interp = kLinear,
MStatus ReturnStatus = nullptr 
)
static

Creates a new curve ramp attribute initialized with an entry defined from a float, position and interpolation value.

Parameters
[in]attrLongNameLong name of the new curve ramp attribute
[in]attrShortNameShort name of the new curve ramp attribute
[in]nodeThe node to which the new ramp attribute will be added
[in]valueFloat value
[in]positionDesired position (defaults to 1.0)
[in]interpInterpolation value (defaults to MInterpolation::kLinear)
[out]ReturnStatusStatus code
Status Codes:
  • MS::kSuccess Operation successful
  • MS::kFailure Not a curve ramp or failure when adding the new entry.
  • MS::kInvalidParameter node is invalid
MObject createRamp ( const MString attrLongName,
const MString attrShortName,
const MObject node,
const MColor color,
float  position = 1.0f,
MInterpolation  interp = kLinear,
MStatus ReturnStatus = nullptr 
)
static

Creates a new color ramp attribute initialized with one entry defined from a color, position and interpolation value.

Parameters
[in]attrLongNameLong name of the new curve ramp attribute
[in]attrShortNameShort name of the new curve ramp attribute
[in]nodeThe node to which the new ramp attribute will be added
[in]colorMColor value
[in]positionDesired position (defaults to 1.0)
[in]interpInterpolation value (defaults to MInterpolation::kLinear)
[out]ReturnStatusStatus code
Status Codes:
  • MS::kSuccess Operation successful
  • MS::kFailure Not a color ramp
  • MS::kFailure Failure when adding the new entry
  • MS::kInvalidParameter node is invalid.
  • MS::kInvalidParameter Array sizes don't match.
MObject createRamp ( const MString attrLongName,
const MString attrShortName,
const MObject node,
const MFloatArray values,
const MFloatArray positions,
const MIntArray interps,
MStatus ReturnStatus = nullptr 
)
static

Creates a new curve ramp attribute initialized with entries defined from a set of float, position and interpolation value arrays.

Parameters
[in]attrLongNameLong name of the new curve ramp attribute
[in]attrShortNameShort name of the new curve ramp attribute
[in]nodeThe node to which the new ramp attribute will be added
[in]valuesArray of float value.
[in]positionsArray of desired positions.
[in]interpsArray of interpolation values.
[out]ReturnStatusStatus code
Status Codes:
  • MS::kSuccess Operation successful
  • MS::kFailure Not a curve ramp
  • MS::kFailure Failure when adding the new entry
  • MS::kInvalidParameter node is invalid
  • MS::kInvalidParameter Array sizes don't match.
MObject createRamp ( const MString attrLongName,
const MString attrShortName,
const MObject node,
const MColorArray colors,
const MFloatArray positions,
const MIntArray interps,
MStatus ReturnStatus = nullptr 
)
static

Creates a new curve ramp attribute initialized with entries defined from a set of color, position and interpolation value arrays.

Parameters
[in]attrLongNameLong name of the new curve ramp attribute
[in]attrShortNameShort name of the new curve ramp attribute
[in]nodeThe node to which the new ramp attribute will be added
[in]colorsArray of color values
[in]positionsArray of desired positions
[in]interpsArray of interpolation values
[out]ReturnStatusStatus code
Status Codes:
  • MS::kSuccess Operation successful
  • MS::kFailure Not a curve ramp
  • MS::kFailure Failure when adding the new entry
  • MS::kInvalidParameter node is invalid.
  • MS::kInvalidParameter Array sizes don't match.
const char * className ( )
static

Returns the name of this class.

Returns
The name of this class.
void getColorAtPosition ( float  position,
MColor color,
MStatus ReturnStatus,
MDGContext context 
)

This method is obsolete.

[From Maya 2018]

Deprecated:
Call getColorAtPosition(float, MColor&, MStatus*) instead. Use MDGContextGuard to switch the context if needed.
Parameters
[in]position
[in]color
[out]ReturnStatus
[in]context
void getValueAtPosition ( float  position,
float &  value,
MStatus ReturnStatus,
MDGContext context 
)

This method is obsolete.

[From Maya 2018]

Deprecated:
Call getValueAtPosition(float, float&, MStatus*) instead. Use MDGContextGuard to switch the context if needed.
Parameters
[in]position
[in]value
[out]ReturnStatus
[in]context
void sampleColorRamp ( unsigned int  numberOfSamples,
MColorArray colors,
MStatus ReturnStatus,
MDGContext context 
)

This method is obsolete.

[From Maya 2018]

Deprecated:
Call sampleColorRamp(unsigned int, MColorArray&, MStatus*) instead. Use MDGContextGuard to switch the context if needed.
Parameters
[in]numberOfSamples
[in]colors
[out]ReturnStatus
[in]context
void sampleValueRamp ( unsigned int  numberOfSamples,
MFloatArray values,
MStatus ReturnStatus,
MDGContext context 
)

This method is obsolete.

[From Maya 2018]

Deprecated:
Call sampleValueRamp(unsigned int, MFloatArray&, MStatus*) instead. Use MDGContextGuard to switch the context if needed.
Parameters
[in]numberOfSamples
[in]values
[out]ReturnStatus
[in]context

The documentation for this class was generated from the following files: