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

- Class List
- Class Hierarchy
- Class Members

Public Types | Public Member Functions | Protected Member Functions

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

Search for all occurrences

## Detailed Description

Function Set for Sets of Objects.

MFnSet is the function set that is used for manipulating sets of objects. Sets in Maya are dependency nodes, so it is possible for one set to contain others.

A set is a list of dependency nodes and dag nodes. Sets are useful for keeping track of lists of objects for many purposes such as selection or applying common rendering parameters. Sets in Maya are also dependency nodes, so it is possible for one set to contain others.

Examples:

  animExportUtil.cpp, cleanPerFaceAssignmentCmd.cpp, D3DViewportRenderer.cpp, exportJointClusterDataCmd.cpp, findTexturesPerPolygonCmd.cpp, objExport.cpp, and polyWriter.cpp.

`#include <MFnSet.h>`

Inheritance diagram for MFnSet:
[legend]

List of all members.

## Public Types
enum | Restriction { kNone, kVerticesOnly, kEdgesOnly, kFacetsOnly, kEditPointsOnly, kRenderableOnly }
| Set membership restrictions. More...
## Public Member Functions
virtual MFn::Type | type () const
| Function set type.
virtual | ~MFnSet ()
| Destructor.
| MFnSet ()
| Default constructor.
| MFnSet (MObject &object, MStatus *ReturnStatus=NULL)
| Constructor.
MObject | create (const MSelectionList &members, Restriction restriction=kNone, MStatus *ReturnStatus=NULL)
| Creates a new set dependency node and puts it in the dependency graph.
MStatus | getUnion (const MObject &withSet, MSelectionList &result)
| This method calculates the union of two sets.
MStatus | getUnion (const MObjectArray &setList, MSelectionList &result)
| This method calculates the union of a list of sets.
MStatus | getIntersection (const MObject &withSet, MSelectionList &result)
| This method calculates the intersection of two sets.
MStatus | getIntersection (const MObjectArray &setList, MSelectionList &result)
| This method calculates the intersection of a list of sets.
MStatus | clear ()
| Removes all elements from this set.
MStatus | getMembers (MSelectionList &members, bool flatten) const
| Get the members of this set as a selection list.
MStatus | addMember (const MObject &obj)
| Add a new object (dependency node) to the set.
MStatus | addMember (const MDagPath &obj, const MObject &component=MObject::kNullObj)
| Add a new object (DAG node) to the set.
MStatus | addMember (const MPlug &plug)
| Add a new plug to the set.
MStatus | addMembers (const MSelectionList &list)
| Add a list of new objects to the set.
MStatus | removeMember (const MObject &obj)
| Remove an object (dependency node) from the set.
MStatus | removeMember (const MDagPath &obj, const MObject &component)
| Remove an object (DAG node) from the set.
MStatus | removeMember (const MPlug &plug)
| Remove an plug from the set.
MStatus | removeMembers (const MSelectionList &list)
| Remove items of the selection list from the set.
bool | isMember (const MObject &object, MStatus *ReturnStatus=NULL) const
| Returns true if the given object (dependency node) is a member of this set.
bool | isMember (const MDagPath &object, const MObject &component=MObject::kNullObj, MStatus *ReturnStatus=NULL) const
| Returns true if the given object (DAG node) is a member of this set.
bool | isMember (const MPlug &plug, MStatus *ReturnStatus=NULL) const
| Returns true if the given plug is a member of this set.
bool | intersectsWith (const MObject &otherSet, MStatus *ReturnStatus=NULL) const
| Returns true if this set intersects with the given set.
bool | hasRestrictions (MStatus *ReturnStatus=NULL) const
| Returns true if this function set has restrictions on the type of objects that it may contain.
Restriction | restriction (MStatus *ReturnStatus=NULL) const
| Returns the type of membership restriction that this set has.
MString | annotation (MStatus *ReturnStatus=NULL) const
| Returns the annotation string for this set.
MStatus | setAnnotation (const MString &annotation)
| Sets the annotation string for this set.
| MFnSet (const MObject &object, MStatus *ReturnStatus=NULL)
| Constructor.
## Protected Member Functions
virtual const char * | className () const
| Class name.

## Member Enumeration Documentation

enum Restriction

Search for all occurrences

Set membership restrictions.

Enumerator:

  kNone | Search for all occurrences
  kVerticesOnly | Search for all occurrences
  kEdgesOnly | Search for all occurrences
  kFacetsOnly | Search for all occurrences
  kEditPointsOnly | Search for all occurrences
  kRenderableOnly | Search for all occurrences

## Constructor & Destructor Documentation

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

MFnSet | ( | 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::kSet.

Reimplemented from MFnDependencyNode.

Reimplemented in MFnCharacter.

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

Search for all occurrences

Class name.

Return the class name : "MFnSet".

Reimplemented from MFnDependencyNode.

Reimplemented in MFnCharacter.

MObject create | ( | const MSelectionList & | members,
|  | Restriction | restriction = `kNone`,
|  | MStatus * | ReturnStatus = `NULL`
| ) |  |

Search for all occurrences

Creates a new set dependency node and puts it in the dependency graph.

Parameters:

  [in] | members | list of members for new set
  [in] | restriction | restriction applied to members
  [out] | ReturnStatus | return status

Returns:
  A handle for the new set object

Status Codes:
  - MS::kSuccess operation successful
  - MS::kLicenseFailure application not licensed for attempted operation
  - MS::kInsufficientMemory out of memory

Examples:
  createClipCmd.cpp.

MStatus getUnion | ( | const MObject & | withSet,
|  | MSelectionList & | result
| ) |  |

Search for all occurrences

This method calculates the union of two sets.

The result will be the union of this set and the set passed into the method.

Parameters:

  [in] | withSet | set to find union of with this set
  [out] | result | storage for the result of the union operation

Returns:
  Return status

Status Codes:
  - MS::kSuccess operation successful
  - MS::kFailure this function set does not have a valid set object
  - MS::kInvalidParameter one of the sets is invalid

MStatus getUnion | ( | const MObjectArray & | setList,
|  | MSelectionList & | result
| ) |  |

Search for all occurrences

This method calculates the union of a list of sets.

The result will be the union of this set and the sets passed into the method.

Parameters:

  [in] | setList | sets to find union of with this set
  [out] | result | storage for the result of the union operation

Returns:
  Return status

Status Codes:
  - MS::kSuccess operation successful
  - MS::kFailure this function set does not have a valid set object
  - MS::kInvalidParameter one of the sets is invalid

MStatus getIntersection | ( | const MObject & | withSet,
|  | MSelectionList & | result
| ) |  |

Search for all occurrences

This method calculates the intersection of two sets.

The result will be the intersection of this set and the set passed into the method.

Parameters:

  [in] | withSet | set to find intersection of with this set
  [out] | result | storage for the result of the intersection operation

Returns:
  Return status

Status Codes:
  - MS::kSuccess operation successful
  - MS::kFailure this function set does not have a valid set object
  - MS::kInvalidParameter the set passed in is invalid

MStatus getIntersection | ( | const MObjectArray & | setList,
|  | MSelectionList & | result
| ) |  |

Search for all occurrences

This method calculates the intersection of a list of sets.

The result will be the intersection of this set and the sets passed into the method.

Parameters:

  [in] | setList | sets to find intersection of with this set
  [out] | result | storage for the result of the intersection operation

Returns:
  Return status

Status Codes:
  - MS::kSuccess operation successful
  - MS::kFailure this function set does not have a valid set object
  - MS::kInvalidParameter one of the sets is invalid

MStatus clear | ( |  | ) |

Search for all occurrences

Removes all elements from this set.

Returns:
  Return status

Status Codes:
  - MS::kSuccess operation successful
  - MS::kFailure this function set does not have a valid set object

MStatus getMembers | ( | MSelectionList & | members,
|  | bool | flatten
| ) |  | const

Search for all occurrences

Get the members of this set as a selection list.

This information is provided as a selection list so that all of the path information is retained for DAG nodes.

It is possible to ask for the returned list to be flattened. This means that all sets that exist inside this set will be expanded into a list of their contents.

Parameters:

  [out] | members | storage for the returned list of members
  [in] | flatten | whether to flatten the returned list.

Returns:
  Return status

Status Codes:
  - MS::kSuccess operation successful
  - MS::kFailure this function set does not have a valid set object
  - MS::kInsufficientMemory out of memory

MStatus addMember | ( | const MObject & | obj | ) |

Search for all occurrences

Add a new object (dependency node) to the set.

Parameters:

  [in] | obj | the object to add

Returns:
  Return status

Status Codes:
  - MS::kSuccess operation successful
  - MS::kFailure this function set does not have a valid set object
  - MS::kInsufficientMemory out of memory

MStatus addMember | ( | const MDagPath & | obj,
|  | const MObject & | component = `MObject::kNullObj`
| ) |  |

Search for all occurrences

Add a new object (DAG node) to the set.

Parameters:

  [in] | obj | the object to add
  [in] | component | the selection component

Returns:
  Return status

Status Codes:
  - MS::kSuccess operation successful
  - MS::kFailure this function set does not have a valid set object
  - MS::kInsufficientMemory out of memory

MStatus addMember | ( | const MPlug & | plug | ) |

Search for all occurrences

Add a new plug to the set.

Parameters:

  [in] | plug | the plug to add

Returns:
  Return status

Status Codes:
  - MS::kSuccess operation successful
  - MS::kFailure this function set does not have a valid set object
  - MS::kInsufficientMemory out of memory

MStatus addMembers | ( | const MSelectionList & | list | ) |

Search for all occurrences

Add a list of new objects to the set.

Parameters:

  [in] | list | the list of objects as a selection list

Returns:
  Return status

Status Codes:
  - MS::kSuccess operation successful
  - MS::kFailure this function set does not have a valid set object
  - MS::kInsufficientMemory out of memory

MStatus removeMember | ( | const MObject & | obj | ) |

Search for all occurrences

Remove an object (dependency node) from the set.

Parameters:

  [in] | obj | the object to remove

Returns:
  Return status

Status Codes:
  - MS::kSuccess operation successful
  - MS::kFailure this function set does not have a valid set object
  - MS::kInsufficientMemory out of memory

MStatus removeMember | ( | const MDagPath & | obj,
|  | const MObject & | component
| ) |  |

Search for all occurrences

Remove an object (DAG node) from the set.

Parameters:

  [in] | obj | the object to remove
  [in] | component | the selection component

Returns:
  Return status

Status Codes:
  - MS::kSuccess operation successful
  - MS::kFailure this function set does not have a valid set object
  - MS::kInsufficientMemory out of memory

MStatus removeMember | ( | const MPlug & | plug | ) |

Search for all occurrences

Remove an plug from the set.

Parameters:

  [in] | plug | the plug to remove

Returns:
  Return status

Status Codes:
  - MS::kSuccess operation successful
  - MS::kFailure this function set does not have a valid set object
  - MS::kInsufficientMemory out of memory

MStatus removeMembers | ( | const MSelectionList & | list | ) |

Search for all occurrences

Remove items of the selection list from the set.

Parameters:

  [in] | list | the selection list of items to remove

Returns:
  Return status

Status Codes:
  - MS::kSuccess operation successful
  - MS::kFailure this function set does not have a valid set object or an item is not in set
  - MS::kInsufficientMemory out of memory

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

Search for all occurrences

Returns true if the given object (dependency node) is a member of this set.

Parameters:

  [in] | object | object to test for membership
  [out] | ReturnStatus | return status

Returns:
  A boolean value indicating whether the object is a member

Status Codes:
  - MS::kSuccess operation successful
  - MS::kFailure this function set does not have a valid set object

bool isMember | ( | const MDagPath & | object,
|  | const MObject & | component = `MObject::kNullObj`,
|  | MStatus * | ReturnStatus = `NULL`
| ) |  | const

Search for all occurrences

Returns true if the given object (DAG node) is a member of this set.

Parameters:

  [in] | object | object to test for membership
  [in] | component | selection component (optional)
  [out] | ReturnStatus | return status

Returns:
  A boolean value indicating whether the object is a member

Status Codes:
  - MS::kSuccess operation successful
  - MS::kFailure this function set does not have a valid set object

bool isMember | ( | const MPlug & | plug,
|  | MStatus * | ReturnStatus = `NULL`
| ) |  | const

Search for all occurrences

Returns true if the given plug is a member of this set.

Parameters:

  [in] | plug | plug to test for membership
  [out] | ReturnStatus | return status

Returns:
  A boolean value indicating whether the plug is a member

Status Codes:
  - MS::kSuccess operation successful
  - MS::kFailure this function set does not have a valid set object

bool intersectsWith | ( | const MObject & | otherSet,
|  | MStatus * | ReturnStatus = `NULL`
| ) |  | const

Search for all occurrences

Returns true if this set intersects with the given set.

An intersection occurs if there are any common members between the two sets.

Parameters:

  [in] | otherSet | set to test for intersection with
  [out] | ReturnStatus | return status

Returns:
  Boolean value indicating whether there was an intersection

Status Codes:
  - MS::kSuccess operation successful
  - MS::kFailure otherSet is not a valid set

bool hasRestrictions | ( | MStatus * | ReturnStatus = `NULL` | ) | const

Search for all occurrences

Returns true if this function set has restrictions on the type of objects that it may contain.

Parameters:

  [out] | ReturnStatus | return status

Returns:
  A boolean value indicating whether this set has restriction

Status Codes:
  - MS::kSuccess operation successful
  - MS::kFailure this function set does not have a valid set object

MFnSet::Restriction restriction | ( | MStatus * | ReturnStatus = `NULL` | ) | const

Search for all occurrences

Returns the type of membership restriction that this set has.

Parameters:

  [out] | ReturnStatus | return status

Returns:
  The type of restriction

Status Codes:
  - MS::kSuccess operation successful
  - MS::kFailure this function set does not have a valid set object

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

Search for all occurrences

Returns the annotation string for this set.

This allows a description of the set to be stored with it.

Parameters:

  [out] | ReturnStatus | return status

Returns:
  The annotation string

Status Codes:
  - MS::kSuccess operation successful
  - MS::kFailure this function set does not have a valid set object

MStatus setAnnotation | ( | const MString & | annotation | ) |

Search for all occurrences

Sets the annotation string for this set.

This allows a description of the set to be stored with it.

Parameters:

  [in] | annotation | new annotation string

Returns:
  Return status

Status Codes:
  - MS::kSuccess operation successful
  - MS::kFailure this function set does not have a valid set object

MFnSet MFnSet MFnSet MFnSet MFnSet MFnSet MFnSet MFnSet MFnSet MFnSet
MFnSet MFnSet MFnSet MFnSet MFnSet MFnSet MFnSet MFnSet MFnSet MFnSet