- Main Page
- Related Pages
- Modules
- Classes
- Examples

- Class List
- Class Hierarchy
- Class Members

Public Member Functions | Protected Member Functions

# MFnEnumAttribute Class Reference
OpenMaya - API module for common classes | FunctionSet classes

Search for all occurrences

## Detailed Description

Enumerated attribute function set.

Function set for enumerated attributes. These attributes accept fields as input. Each field consists of a short and its associated string, which is a descriptive name for the field.

Examples:

  apiMeshCreator.cpp, buildRotationNode.cpp, GLSLShaderNode.cpp, meshOpNode.cpp, and quadricShape.cpp.

`#include <MFnEnumAttribute.h>`

Inheritance diagram for MFnEnumAttribute:
[legend]

List of all members.

## Public Member Functions
virtual MFn::Type | type () const
| Function set type.
virtual | ~MFnEnumAttribute ()
| Destructor.
| MFnEnumAttribute ()
| Default constructor.
| MFnEnumAttribute (MObject &object, MStatus *ReturnStatus=NULL)
| Constructor.
MObject | create (const MString &fullName, const MString &briefName, short defaultValue=0, MStatus *ReturnStatus=NULL)
| Creates an enumerated attribute object.
MStatus | addField (const MString &fieldString, short index)
| Add a field (a string/index pair) to the enumeration.
MString | fieldName (short index, MStatus *ReturnStatus=NULL) const
| Retrieve the string associated with a given index.
short | fieldIndex (const MString &fieldString, MStatus *ReturnStatus=NULL) const
| Retrieve the index associated with a given string.
MStatus | getMin (short &minValue) const
| Return the minimum value for this attribute.
MStatus | getMax (short &maxValue) const
| Return the maximum value for this attribute.
MStatus | setDefault (short index)
| Set a new default value for this enum attribute.
MStatus | setDefault (const MString &fieldString)
| Set a new default value for this enum attribute.
MStatus | getDefault (short &index) const
| Get the default value for the enum attribute.
MString | defaultValue (MStatus *ReturnStatus=NULL) const
| Get the default value for the enum attribute.
| MFnEnumAttribute (const MObject &object, MStatus *ReturnStatus=NULL)
| Constructor.
MStatus | getDefault (MString &fieldString) const
| NO SCRIPT SUPPORT.
## Protected Member Functions
virtual const char * | className () const
| Class name.

## Constructor & Destructor Documentation

MFnEnumAttribute | ( | MObject & | object,
|  | MStatus * | ReturnStatus = `NULL`
| ) |  |

Constructor.

Class constructor that initializes the function set to the given MObject.

Parameters:

  [in] | object | The MObject to attach the function set to
  [out] | ReturnStatus | the return status

Status Codes:
  - MS::kSuccess if the function set is successfully attached
  - MS::kInvalidParameter if the MObject does not represent a valid Maya object or if the function set is not allowed to attach to this MObject

MFnEnumAttribute | ( | const MObject & | object,
|  | MStatus * | ReturnStatus = `NULL`
| ) |  |

Constructor.

Class constructor that initializes the function set to the given MObject.

Parameters:

  [in] | object | The MObject to attach the function set to
  [out] | ReturnStatus | the return status

Status Codes:
  - MS::kSuccess if the function set is successfully attached
  - MS::kInvalidParameter if the MObject does not represent a valid Maya object or if the function set is not allowed to attach to this MObject

## Member Function Documentation

MFn::Type type | ( |  | ) | const`[virtual]`

Search for all occurrences

Function set type.

Return the class type : MFn::kEnumAttribute.

Reimplemented from MFnAttribute.

const char * className | ( |  | ) | const`[protected, virtual]`

Search for all occurrences

Class name.

Return the class name : "MFnEnumAttribute".

Reimplemented from MFnAttribute.

MObject create | ( | const MString & | fullName,
|  | const MString & | briefName,
|  | short | defaultValue = `0`,
|  | MStatus * | ReturnStatus = `NULL`
| ) |  |

Search for all occurrences

Creates an enumerated attribute object.

The create method needs to be called on a per node basis. That means if you want to create and add the same attribute to multiple nodes, you need to call the create method for each node to get a unique MObject back. If you call create just once and add the attribute to multiple nodes, Maya will encounter a fatal error.

Parameters:

  [in] | fullName | The full name of the attribute
  [in] | briefName | The brief name of the attribute
  [in] | defaultValue | The default value of the attribute
  [out] | ReturnStatus | Status code for the operation.

Returns:
  The newly created enumerated attribute object.

Status Codes:
  - MS::kSuccess The attribute object was successfully created.
  - MS::kInsufficientMemory There is no more memory

Examples:
  apiMeshCreator.cpp, buildRotationNode.cpp, GLSLShaderNode.cpp, meshOpNode.cpp, and quadricShape.cpp.

MStatus addField | ( | const MString & | fieldString,
|  | short | index
| ) |  |

Search for all occurrences

Add a field (a string/index pair) to the enumeration.

Parameters:

  [in] | fieldString | The string describing the field
  [in] | index | The index of the field

Returns:
  Status code for the operation

Status Codes:
  - MS::kSuccess The field was successfully added
  - MS::kInvalidParameter The passed index is already being used
  - MS::kObjectDoesNotExist The attribute is not bound to an MObject

Examples:
  apiMeshCreator.cpp, buildRotationNode.cpp, GLSLShaderNode.cpp, meshOpNode.cpp, and quadricShape.cpp.

MString fieldName | ( | short | index,
|  | MStatus * | ReturnStatus = `NULL`
| ) |  | const

Search for all occurrences

Retrieve the string associated with a given index.

Parameters:

  [in] | index | The index of the string to look up
  [out] | ReturnStatus | Status code for the operation.

Returns:
  The descriptive string corresponding to the given index

Status Codes:
  - MS::kSuccess The attribute object was successfully created.
  - MS::kInvalidParameter The index is out of range
  - MS::kObjectDoesNotExist the attribute is not bound to an MObject

short fieldIndex | ( | const MString & | fieldString,
|  | MStatus * | ReturnStatus = `NULL`
| ) |  | const

Search for all occurrences

Retrieve the index associated with a given string.

Parameters:

  [in] | fieldString | The string describing the field.
  [out] | ReturnStatus | Status code for the operation.

Returns:
  The index associated with the given descriptive string.

Status Codes:
  - MS::kSuccess The operation was successfully performed
  - MS::kObjectDoesNotExist the attribute is not bound to an MObject

MStatus getMin | ( | short & | minValue | ) | const

Search for all occurrences

Return the minimum value for this attribute.

Parameters:

  [out] | minValue | the minimum value for this attribute

Returns:
  - MS::kSuccess the operation succeeded
  - MS::kFailure the attribute does not have a minimum
  - MS::kObjectDoesNotExist this instance is not bound to an MObject

MStatus getMax | ( | short & | maxValue | ) | const

Search for all occurrences

Return the maximum value for this attribute.

Parameters:

  [out] | maxValue | the maximum value for this attribute

Returns:
  - MS::kSuccess the operation succeeded
  - MS::kFailure the attribute does not have a maximum
  - MS::kObjectDoesNotExist this instance is not bound to an MObject

MStatus setDefault | ( | short | index | ) |

Search for all occurrences

Set a new default value for this enum attribute.

Parameters:

  [in] | index | new the default value for this attribute

Returns:
  - MS::kSuccess the operation succeeded
  - MS::kObjectDoesNotExist this attribute is not bound to an MObject
  - MS::kInvalidParameter this attribute is not a enum attribute, or the given index value is not valid.

Examples:
  GLSLShaderNode.cpp.

MStatus setDefault | ( | const MString & | fieldString | ) |

Search for all occurrences

Set a new default value for this enum attribute.

Parameters:

  [in] | fieldString | new the default value for this attribute

Returns:
  - MS::kSuccess the operation succeeded
  - MS::kObjectDoesNotExist this attribute is not bound to an MObject
  - MS::kInvalidParameter this attribute is not a enum attribute, or the given string value does not exist in the enum

MStatus getDefault | ( | short & | index | ) | const

Search for all occurrences

Get the default value for the enum attribute.

Parameters:

  [out] | index | default index value.

Returns:
  - MS::kSuccess the operation succeeded
  - MS::kObjectDoesNotExist this attribute is not bound to an MObject
  - MS::kInvalidParameter this attribute is not an enum

MString defaultValue | ( | MStatus * | ReturnStatus = `NULL` | ) | const

Search for all occurrences

Get the default value for the enum attribute.

Parameters:

  [out] | ReturnStatus | Optional status code. See below.

Returns:
  the string value for the default enum

Status Codes:
  - MS::kSuccess the operation succeeded
  - MS::kObjectDoesNotExist this attribute is not bound to an MObject
  - MS::kInvalidParameter this attribute is not an enum

MStatus getDefault | ( | MString & | fieldString | ) | const

Search for all occurrences

NO SCRIPT SUPPORT.

Get the default value for the enum attribute.

Python Notes

This method is not supported in Python. Please see defaultValue()

Parameters:

  [out] | fieldString | the string value for the default enum

Returns:
  - MS::kSuccess the operation succeeded
  - MS::kObjectDoesNotExist this attribute is not bound to an MObject
  - MS::kInvalidParameter this attribute is not an enum

MFnEnumAttribute MFnEnumAttribute MFnEnumAttribute MFnEnumAttribute MFnEnumAttribute MFnEnumAttribute MFnEnumAttribute MFnEnumAttribute MFnEnumAttribute MFnEnumAttribute
MFnEnumAttribute MFnEnumAttribute MFnEnumAttribute MFnEnumAttribute MFnEnumAttribute MFnEnumAttribute MFnEnumAttribute MFnEnumAttribute MFnEnumAttribute MFnEnumAttribute