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

- Class List
- Class Hierarchy
- Class Members

Public Member Functions | Static Public Member Functions

# MNodeClass Class Reference

# OpenMaya - API module for common classes

Search for all occurrences

## Detailed Description

A class for performing node class-level operations in the dependency graph.

MNodeClass allows the manipulation of dependency graph node classes. Operations specific to a particular node should instead use MFnDependencyNode.

`#include <MNodeClass.h>`

List of all members.

## Public Member Functions
| MNodeClass (const MString &nodeClassName)
| Construct an MNodeClass object based on the given class name.
| MNodeClass (const MTypeId &nodeTypeId)
| Construct an MNodeClass object based on the given MTypeId.
MTypeId | typeId () const
| Returns the type id of this node class.
MString | typeName () const
| Returns the type name of this node class.
MString | classification () const
| Retrieves the classification string for a node class.
MString | pluginName (MStatus *ReturnStatus=NULL) const
| Returns the name of the plug-in this node class was defined in.
MStatus | addExtensionAttribute (const MObject &attr) const
| Adds an extension attribute to the node class.
MStatus | removeExtensionAttribute (const MObject &attr) const
| Removes an extension attribute from the node class.
MStatus | removeExtensionAttributeIfUnset (const MObject &attr) const
| Removes an extension attribute from the given dependency node type but only if there are no nodes in the graph with non-default values for this attribute.
MStatus | getAttributes (MObjectArray &attr) const
| Get the list of attributes for the node class.
unsigned int | attributeCount (MStatus *ReturnStatus=NULL) const
| Get the number of attributes for the node class.
MObject | attribute (unsigned int index, MStatus *ReturnStatus=NULL) const
| Finds the attribute of this node class at the given index.
MObject | attribute (const MString &attrName, MStatus *ReturnStatus=NULL) const
| Finds the attribute of this node class that has the given name.
bool | hasAttribute (const MString &attrName, MStatus *ReturnStatus=NULL) const
| Returns true if the node class already has an attribute with the given name.
## Static Public Member Functions
static const char * | className ()
| Returns the name of this class.

## Constructor & Destructor Documentation

MNodeClass | ( | const MString & | nodeClassName | ) |

Construct an MNodeClass object based on the given class name.

If the name cannot be resolved as a known class, the MNodeClass will refer to an MFn::kInvalid api type.

Parameters:

  [in] | nodeClassName | class name of the node type to wrap

MNodeClass | ( | const MTypeId & | nodeTypeId | ) |

Construct an MNodeClass object based on the given MTypeId.

This can then be used to perform class-level operations.

Parameters:

  [in] | nodeTypeId | id of the node type to wrap

## Member Function Documentation

MTypeId typeId | ( |  | ) | const

Search for all occurrences

Returns the type id of this node class.

The type is is the 4 byte code that is used in the binary file format to identify the type of this node.

Returns:
  The type id of this node

MString typeName | ( |  | ) | const

Search for all occurrences

Returns the type name of this node class.

The string returned is the name of the node type as it is used in the ascii file format.

Returns:
  The type name of this node

MString classification | ( |  | ) | const

Search for all occurrences

Retrieves the classification string for a node class.

This is a string that is used in dependency nodes that are also shaders to provide more detailed type information to the rendering system. See the documentation for the MEL commands getClassification and listNodeTypes for information on the strings that can be provided.

User-defined nodes set this value through a parameter to MFnPlugin::registerNode.

Returns:
  The classification string. If the node class does not have an associated classification, an empty string will be returned.

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

Search for all occurrences

Returns the name of the plug-in this node class was defined in.

The name returned is the name of the plug-in on disk, and may contain pathname separators (such as `/') and drive letters (e.g. C:).

Parameters:

  [out] | ReturnStatus | return status

Returns:
  The name of the plug-in

Status Codes:
  - MS::kSuccess operation successful
  - MS::kFailure node class was not found in plugin database

MStatus addExtensionAttribute | ( | const MObject & | attr | ) | const

Search for all occurrences

Adds an extension attribute to the node class.

An extension attribute is a class-level attribute which has been added dynamically to a node class. Because it is added at the class level, all nodes of that class will have the given attribute, and will only store the attribute's value if it differs from the default.

Parameters:

  [in] | attr | The attribute to add

Returns:
  Status of operation.

Status Codes:
  - MS::kSuccess operation successful
  - MS::kFailure extension attribute was not added
  - MS::kInvalidParameter this node class was not a valid one for adding extensions

MStatus removeExtensionAttribute | ( | const MObject & | attr | ) | const

Search for all occurrences

Removes an extension attribute from the node class.

An extension attribute is a class-level attribute which has been added dynamically to a node class. Because it is added at the class level, all nodes of that class will have the given attribute, and will only store the attribute's value if it differs from the default.

Parameters:

  [in] | attr | The attribute to remove

Returns:
  Status of operation.

Status Codes:
  - MS::kSuccess operation successful
  - MS::kFailure extension attribute was not removed
  - MS::kInvalidParameter attribute was not an extension on this class

MStatus removeExtensionAttributeIfUnset | ( | const MObject & | attr | ) | const

Search for all occurrences

Removes an extension attribute from the given dependency node type but only if there are no nodes in the graph with non-default values for this attribute.

An extension attribute is a class-level attribute which has been added dynamically to a node class. Because it is added at the class level, all nodes of that class will have the given attribute. This method will only remove the attribute if any of its node values differs from the default.

Parameters:

  [in] | attr | The attribute to remove

Returns:
  Status of operation.

Status Codes:
  - MS::kSuccess extension attribute was removed
  - MS::kFailure extension attribute was not removed
  - MS::kInvalidParameter attribute was not an extension on this class

MStatus getAttributes | ( | MObjectArray & | attr | ) | const

Search for all occurrences

Get the list of attributes for the node class.

Parameters:

  [out] | attr | The list of attributes

Returns:
  Status of operatation

Status Codes:
  - MS::kSuccess operation successful
  - MS::kFailure unable to complete operation

unsigned int attributeCount | ( | MStatus * | ReturnStatus = `NULL` | ) | const

Search for all occurrences

Get the number of attributes for the node class.

Parameters:

  [out] | ReturnStatus | return status

Returns:
  The number of attributes.

Status Codes:
  - MS::kSuccess operation successful
  - MS::kFailure unable to count attributes

MObject attribute | ( | unsigned int | index,
|  | MStatus * | ReturnStatus = `NULL`
| ) |  | const

Search for all occurrences

Finds the attribute of this node class at the given index.

Index order is based on the order in which the attributes were added to the class.

Parameters:

  [in] | index | the index of the attribute
  [out] | ReturnStatus | return status

Returns:
  The attribute, or kNullObj if no attribute existed at the given index

Status Codes:
  - MS::kSuccess operation successful
  - MS::kFailure not a valid node class
  - MS::kInvalidParameter index is out of range

MObject attribute | ( | const MString & | attrName,
|  | MStatus * | ReturnStatus = `NULL`
| ) |  | const

Search for all occurrences

Finds the attribute of this node class that has the given name.

Parameters:

  [in] | attrName | name of the attribute to find
  [out] | ReturnStatus | return status

Returns:
  The attribute, or kNullObj if no attribute with the given name could be found

Status Codes:
  - MS::kSuccess operation successful
  - MS::kFailure the search could not be completed

bool hasAttribute | ( | const MString & | attrName,
|  | MStatus * | ReturnStatus = `NULL`
| ) |  | const

Search for all occurrences

Returns true if the node class already has an attribute with the given name.

Parameters:

  [in] | attrName | Name of attribute to be checked.
  [out] | ReturnStatus | return status

Returns:
  true if the node class has attribute, false otherwise.

Status Codes:
  - MS::kSuccess operation is successful
  - MS::kFailure unable to complete operation

const char * className | ( |  | ) | `[static]`

Search for all occurrences

Returns the name of this class.

Returns:
  Name of this class.

MNodeClass MNodeClass MNodeClass MNodeClass MNodeClass MNodeClass MNodeClass MNodeClass MNodeClass MNodeClass
MNodeClass MNodeClass MNodeClass MNodeClass MNodeClass MNodeClass MNodeClass MNodeClass MNodeClass MNodeClass