class MRampAttribute

Jump to documentation

Ramp data attribute function wrapper class. (OpenMaya) (OpenMaya.py)

public members:

MRampAttribute ()
MRampAttribute (const MRampAttribute & other)
MRampAttribute (const MPlug & obj, MStatus * ReturnStatus = NULL)
MRampAttribute (const MObject & node, const MObject & attr, MStatus * ReturnStatus = NULL)
MRampAttribute & operator = ( const MRampAttribute & other )
~MRampAttribute ()
enum MInterpolation
kLinear
kNone
kSpline
kSmooth
unsigned int getNumEntries ( MStatus * returnStatus = NULL)
void getEntries ( MIntArray & indexes, MFloatArray & positions, MFloatArray & values, MIntArray & interps, MStatus * returnStatus = NULL)
void getEntries ( MIntArray & indexes, MFloatArray & positions, MColorArray & colors, MIntArray & interps, MStatus * returnStatus = NULL)
void addEntries ( MFloatArray & positions, MColorArray & values, MIntArray & interps, MStatus * returnStatus = NULL)
void addEntries ( MFloatArray & positions, MFloatArray & values, MIntArray & interps, MStatus * returnStatus = NULL)
void deleteEntries ( MIntArray & indexes, MStatus * returnStatus = NULL)
void setColorAtIndex ( MColor & color, unsigned int index, MStatus * returnStatus = NULL)
void setValueAtIndex (float value, unsigned int index, MStatus * returnStatus = NULL)
void setPositionAtIndex (float position, unsigned int index, MStatus * returnStatus = NULL)
void setInterpolationAtIndex ( MRampAttribute::MInterpolation interp, unsigned int index, MStatus * returnStatus = NULL)
bool isColorRamp ( MStatus * returnStatus = NULL)
bool isCurveRamp ( MStatus * returnStatus = NULL)
void getColorAtPosition (float position, MColor & color, MStatus * returnStatus = NULL, MDGContext & = MDGContext::fsNormal )
void getValueAtPosition (float position, float& value, MStatus * returnStatus = NULL, MDGContext & = MDGContext::fsNormal )
static MObject createCurveRamp (const MString & attrLongName, const MString & attrShortName, MStatus * ReturnStatus = NULL)
static MObject createColorRamp (const MString & attrLongName, const MString & attrShortName, MStatus * ReturnStatus = NULL)

Documentation

Wrapper class for ramp data attributes.
Description

Function object for RampData attributes. A RampData attribute describes a ramp specified by a set of positions and values. Currently there is support for curve ramps and color ramps.

Functions

MRampAttribute:: MRampAttribute ()

Description

Creates an emptry Ramp Attribute class.

Initializes it as a null Object.

Arguments

None

Status Codes

None

MRampAttribute:: MRampAttribute (const MPlug & obj, MStatus * ReturnStatus)

Description

Creates a new Ramp Attribute class. If the plug is not of a ramp, then the constructor will return a failure.

Arguments

  • obj Plug of a ramp
  • ReturnStatus return 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:: MRampAttribute (const MObject & node, const MObject & attr, MStatus * ReturnStatus)

Description

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.

Arguments

  • node Node that contains a ramp attribute
  • attr The ramp attribute
  • ReturnStatus return 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 & MRampAttribute:: operator= (const MRampAttribute &other)

Description

Assignment operator. Copies one ramp attribute to another.

Arguments

  • other Ramp attribute to be copied

Return Value

  • MRampAttribute A reference to the copied ramp attribute

MRampAttribute:: MRampAttribute (const MRampAttribute & other)

Description

Copy constructor operator. Duplicates the given ramp attribute.

Arguments

  • other Ramp attribute to be copied

Return Value

  • MRampAttribute A reference to the copied ramp attribute

MRampAttribute:: ~MRampAttribute ()

Description

Destructor

unsigned int MRampAttribute:: getNumEntries ( MStatus * ReturnStatus)

Description

Gets the number of entries in the ramp attribute.

Arguments

  • ReturnStatus return status

Status Codes

  • MS::kSuccess operation successful
  • MS::kFailure an error occurred while querying the ramp

Return Value

  • unsigned int The number of entries in the ramp attribute

void MRampAttribute:: getEntries ( MIntArray & indices, MFloatArray & positions, MFloatArray & values, MIntArray & interps, MStatus * ReturnStatus)

Description

Gets all the entries in a ramp attribute. If the ramp is a color ramp, then this function will return a failure.

Arguments

  • index unique values that specify each entry in the ramp
  • position the positions of each entry (can range from 0 to 1)
  • value the values of the entrys at each position (can range from 0 to 1)
  • value the interpolations of the entrys at each position. Possible values:
    • MRampAttribute::kSpline
    • MRampAttribute::kSmooth
    • MRampAttribute::kLinear
    • MRampAttribute::kNone
  • ReturnStatus return status

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

void MRampAttribute:: getEntries ( MIntArray & indices, MFloatArray & positions, MColorArray & colors, MIntArray & interps, MStatus * ReturnStatus)

Description

Gets all the entries in a ramp attribute. If the ramp is a curve ramp, then this function will return a failure.

Arguments

  • index unique values that specify each entry in the ramp
  • position the positions of each entry (can range from 0 to 1)
  • color the colors of the entrys at each position
  • value the interpolations of the entrys at each position. Possible values:
    • MRampAttribute::kSpline
    • MRampAttribute::kSmooth
    • MRampAttribute::kLinear
    • MRampAttribute::kNone
  • ReturnStatus return status

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 MRampAttribute:: addEntries ( MFloatArray & positions, MFloatArray & values, MIntArray & interps, MStatus * ReturnStatus)

Description

Adds entries into a ramp attribute. If the ramp is a color ramp, then this function will return a failure.

Arguments

  • position the positions of the new entrys (can range from 0 to 1)
  • color the values of the new entry at each position
  • value the interpolations of the new entry at each position. Possible values:
    • MRampAttribute::kSpline
    • MRampAttribute::kSmooth
    • MRampAttribute::kLinear
    • MRampAttribute::kNone
  • ReturnStatus return status

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 MRampAttribute:: addEntries ( MFloatArray & positions, MColorArray & colors, MIntArray & interps, MStatus * ReturnStatus)

Description

Adds entries into a ramp attribute. If the ramp is a curve ramp, then this function will return a failure.

Arguments

  • positions the positions of the new entrys (can range from 0 to 1)
  • colors the colors of the new entrys at each position
  • values the interpolations of the new entrys at each position. Possible values:
    • MRampAttribute::kSpline
    • MRampAttribute::kSmooth
    • MRampAttribute::kLinear
    • MRampAttribute::kNone
  • ReturnStatus return status

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

void MRampAttribute:: deleteEntries ( MIntArray & indices, MStatus * ReturnStatus)

Description

Deletes entries in the ramp attribute.

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

Arguments

  • indices the entries that need to be deleted
  • ReturnStatus return status

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.

void MRampAttribute:: setColorAtIndex ( MColor & color, unsigned int index, MStatus * ReturnStatus)

Description

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.

Arguments

  • color the new color for the entry
  • ReturnStatus return 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.

void MRampAttribute:: setValueAtIndex (float value, unsigned int index, MStatus * ReturnStatus)

Description

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.

Arguments

  • color the new value for the entry
  • ReturnStatus return 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.

void MRampAttribute:: setPositionAtIndex (float position, unsigned int index, MStatus * ReturnStatus)

Description

Sets the position of a given entry

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

Arguments

  • color the new position for the entry
  • ReturnStatus return 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.

void MRampAttribute:: setInterpolationAtIndex ( MRampAttribute::MInterpolation interp, unsigned int index, MStatus * ReturnStatus)

Description

Sets the interpolation of a given entry

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

Arguments

  • interp the new interpolation for the entry
  • ReturnStatus return 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.

bool MRampAttribute:: isColorRamp ( MStatus * ReturnStatus)

Description

Checks to see whether this ramp is a color ramp.

Arguments

  • ReturnStatus return status

Return Value

  • bool true, if the ramp is a color ramp

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 MRampAttribute:: isCurveRamp ( MStatus * ReturnStatus)

Description

Checks to see whether this ramp is a curve ramp.

Arguments

  • ReturnStatus return status

Return Value

  • bool true, if the ramp is a curve ramp

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 MRampAttribute:: getColorAtPosition (float position, MColor & color, MStatus * ReturnStatus, MDGContext & context)

Description

Gets the color at a position

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.

Arguments

  • position the desired position
  • color the color at the position
  • ReturnStatus return status

Status Codes

  • MS::kSuccess operation successful
  • MS::kFailure this was not a color ramp, or the ramp was empty

void MRampAttribute:: getValueAtPosition (float position, float &value, MStatus * ReturnStatus, MDGContext & context)

Description

Gets the value at position

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.

Arguments

  • position the desired position
  • value the value at the position
  • ReturnStatus return status

Status Codes

  • MS::kSuccess operation successful
  • MS::kFailure this was not a curve ramp, or the ramp was empty

MObject MRampAttribute:: createCurveRamp (const MString & attrLongName, const MString & attrShortName, MStatus * ReturnStatus)

Description

This function creates the curve ramp attribute.

Arguments

  • attrLongName Long name of the curve ramp attribute
  • attrShortName Short name of the curve ramp attribute
  • ReturnStatus return status

Return Value

  • Curve ramp attribute, returned as MObject.

Status Codes

  • MS::kSuccess operation successful
  • MS::kFailure when the creation of the attr fails

MObject MRampAttribute:: createColorRamp (const MString & attrLongName, const MString & attrShortName, MStatus * ReturnStatus)

Description

This function creates the color ramp attribute.

Arguments

  • attrLongName Long name of the curve ramp attribute
  • attrShortName Short name of the curve ramp attribute
  • ReturnStatus return status

Return Value

  • Color ramp attribute, returned as MObject.

Status Codes

  • MS::kSuccess operation successful
  • MS::kFailure when the creation of the attr fails

This class has no child classes.


Autodesk® Maya® 2008 © 1997-2007 Autodesk, Inc. All rights reserved. doc++ Copyright