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

- Class List
- Class Hierarchy
- Class Members

Public Member Functions | Protected Member Functions

# MFnGenericAttribute Class Reference

# OpenMaya - API module for common classes | FunctionSet classes

Search for all occurrences

## Detailed Description

Generic attribute function set.

MFnGenericAttribute is a function set for attributes that can accept several types of data. A generic attribute is similar to a typed attribute (MFnTypedAttribute) except that it has a list of types that it considers valid.

If the attribute will only take one type of data then it is more efficient to use one of the other attribute function sets such as MFnTypedAttribute or MFnNumericAttribute.

Examples:

  genericAttributeNode.cpp, and slopeShaderNode.cpp.

`#include <MFnGenericAttribute.h>`

Inheritance diagram for MFnGenericAttribute:
[legend]

List of all members.

## Public Member Functions
virtual MFn::Type | type () const
| Function set type.
virtual | ~MFnGenericAttribute ()
| Destructor.
| MFnGenericAttribute ()
| Default constructor.
| MFnGenericAttribute (MObject &object, MStatus *ReturnStatus=NULL)
| Constructor.
MObject | create (const MString &full, const MString &brief, MStatus *ReturnStatus=NULL)
| Creates a new generic attribute.
MStatus | addDataAccept (MFnData::Type newType)
| Add a new connection type that this attribute can accept.
MStatus | addNumericDataAccept (MFnNumericData::Type newType)
| Add a new connection type that this attribute can accept.
MStatus | addAccept (const MTypeId &id)
| Add a new connection type that this attribute can accept.
MStatus | removeDataAccept (MFnData::Type oldType)
| Remove one of the types that this attribute can accept.
MStatus | removeNumericDataAccept (MFnNumericData::Type oldType)
| Remove one of the types that this attribute can accept.
MStatus | removeAccept (const MTypeId &id)
| Remove one of the types that this attribute can accept.
| MFnGenericAttribute (const MObject &object, MStatus *ReturnStatus=NULL)
| Constructor.
MStatus | addAccept (MFnData::Type newType)
| Obsolete & no script support.
MStatus | addAccept (MFnNumericData::Type newType)
| Obsolete & no script support.
MStatus | removeAccept (MFnData::Type oldType)
| Obsolete & no script support.
MStatus | removeAccept (MFnNumericData::Type oldType)
| Obsolete & no script support.
## Protected Member Functions
virtual const char * | className () const
| Class name.

## Constructor & Destructor Documentation

MFnGenericAttribute | ( | 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

MFnGenericAttribute | ( | 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::kGenericAttribute.

Reimplemented from MFnAttribute.

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

Search for all occurrences

Class name.

Return the class name : "MFnGenericAttribute".

Reimplemented from MFnAttribute.

MObject create | ( | const MString & | full,
|  | const MString & | brief,
|  | MStatus * | ReturnStatus = `NULL`
| ) |  |

Search for all occurrences

Creates a new generic attribute.

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] | full | Long name of the attribute.
  [in] | brief | Short name of the attribute.
  [out] | ReturnStatus | Status code.

Returns:
  New attribute.

Status Codes:
  - MS::kSuccess operation successful
  - MS::kInsufficientMemory out of memory

Examples:
  genericAttributeNode.cpp, and slopeShaderNode.cpp.

MStatus addDataAccept | ( | MFnData::Type | newType | ) |

Search for all occurrences

Add a new connection type that this attribute can accept.

Parameters:

  [in] | newType | new type

Returns:
  Status code

Status Codes:
  - MS::kSuccess operation successful
  - MS::kFailure function set doesn not have valid object, or the add failed

MStatus addNumericDataAccept | ( | MFnNumericData::Type | newType | ) |

Search for all occurrences

Add a new connection type that this attribute can accept.

Parameters:

  [in] | newType | new type

Returns:
  Status code

Status Codes:
  - MS::kSuccess operation successful
  - MS::kFailure function set doesn not have valid object, or the add failed

MStatus addAccept | ( | const MTypeId & | id | ) |

Search for all occurrences

Add a new connection type that this attribute can accept.

This method takes the type id (iff tag) of the data objects that can be accepted.

Parameters:

  [in] | id | id of new type

Returns:
  Status code

Status Codes:
  - MS::kSuccess operation successful
  - MS::kFailure function set doesn not have valid object, or the add failed

Examples:
  genericAttributeNode.cpp, and slopeShaderNode.cpp.

MStatus removeDataAccept | ( | MFnData::Type | oldType | ) |

Search for all occurrences

Remove one of the types that this attribute can accept.

Parameters:

  [in] | oldType | old type that is no longer accepted

Returns:
  Status code

Status Codes:
  - MS::kSuccess operation successful
  - MS::kFailure function set doesn not have valid object, or the remove failed

MStatus removeNumericDataAccept | ( | MFnNumericData::Type | oldType | ) |

Search for all occurrences

Remove one of the types that this attribute can accept.

Parameters:

  [in] | oldType | old type that is no longer accepted

Returns:
  Status code

Status Codes:
  - MS::kSuccess operation successful
  - MS::kFailure function set doesn not have valid object, or the remove failed

MStatus removeAccept | ( | const MTypeId & | id | ) |

Search for all occurrences

Remove one of the types that this attribute can accept.

This method takes the type id (iff tag) of the data objects that can no longer be accepted.

Parameters:

  [in] | id | id of old type that is no longer accepted

Returns:
  Status code

Status Codes:
  - MS::kSuccess operation successful
  - MS::kFailure function set doesn not have valid object, or the remove failed

MStatus addAccept | ( | MFnData::Type | newType | ) |

Search for all occurrences

Obsolete & no script support.

This method is obsolete. This method is not available in Python.

Deprecated:
  Use the MFnGenericAttribute::addDataAccept method instead.

Parameters:

  [in] | newType |

MStatus addAccept | ( | MFnNumericData::Type | newType | ) |

Search for all occurrences

Obsolete & no script support.

This method is obsolete. This method is not available in Python.

Deprecated:
  Use the MFnGenericAttribute::addNumericDataAccept method instead.

Parameters:

  [in] | newType |

MStatus removeAccept | ( | MFnData::Type | oldType | ) |

Search for all occurrences

Obsolete & no script support.

This method is obsolete. This method is not available in Python.

Deprecated:
  Use the MFnGenericAttribute::removeDataAccept method instead.

Parameters:

  [in] | oldType |

MStatus removeAccept | ( | MFnNumericData::Type | oldType | ) |

Search for all occurrences

Obsolete & no script support.

This method is obsolete. This method is not available in Python.

Deprecated:
  Use the MFnGenericAttribute::removeNumericDataAccept method instead.

Parameters:

  [in] | oldType |

MFnGenericAttribute MFnGenericAttribute MFnGenericAttribute MFnGenericAttribute MFnGenericAttribute MFnGenericAttribute MFnGenericAttribute MFnGenericAttribute MFnGenericAttribute MFnGenericAttribute
MFnGenericAttribute MFnGenericAttribute MFnGenericAttribute MFnGenericAttribute MFnGenericAttribute MFnGenericAttribute MFnGenericAttribute MFnGenericAttribute MFnGenericAttribute MFnGenericAttribute