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

- Class List
- Class Hierarchy
- Class Members

Public Member Functions | Protected Member Functions

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

This reference page is linked to from the following overview topics: Extension for Autodesk Maya 2013.

Search for all occurrences

## Detailed Description

Function set for querying information about file references.

Reference nodes are used to track data about file references. Referenced files may be loaded and unloaded. They also store data about changes made to objects in the referenced file. The class MItReferenceEdits may be used to retrieve information about such changes.

The class MFileIO may be used to perform actual operations on references such as loading, unloading, adding and removing references.

`#include <MFnReference.h>`

Inheritance diagram for MFnReference:
[legend]

List of all members.

## Public Member Functions
virtual MFn::Type | type () const
| Function set type.
virtual | ~MFnReference ()
| Destructor.
| MFnReference ()
| Default constructor.
| MFnReference (MObject &object, MStatus *ReturnStatus=NULL)
| Constructor.
MString | fileName (bool resolvedName, bool includePath, bool includeCopyNumber, MStatus *ReturnStatus=NULL) const
| Returns the name of file associated with this reference.
MString | associatedNamespace (bool shortName, MStatus *ReturnStatus=NULL) const
| Returns the namespace associated with this reference.
MString | parentFileName (bool resolvedName, bool includePath, bool includeCopyNumber, MStatus *ReturnStatus=NULL) const
| Returns the name of parent file associated with this reference.
MObject | parentReference (MStatus *ReturnStatus=NULL) const
| Returns the reference node associated with the parent reference.
MObject | parentAssembly (MStatus *ReturnStatus=NULL) const
| Returns the parent assembly node that contains this reference.
bool | containsNode (const MObject &node, MStatus *ReturnStatus=NULL) const
| Returns true if the specified node is from this reference or one of its child references.
bool | containsNodeExactly (const MObject &node, MStatus *ReturnStatus=NULL) const
| Returns true if the specified node is from this reference.
void | nodes (MObjectArray &nodes, MStatus *ReturnStatus=NULL) const
| Returns an array of the nodes associated with this reference.
bool | isLoaded (MStatus *ReturnStatus=NULL) const
| Returns true if the reference is loaded.
bool | isLocked (MStatus *ReturnStatus=NULL) const
| Returns true if the reference is locked or if the referenced file was saved as locked.
bool | isExportEditsFile (MStatus *ReturnStatus=NULL) const
| Returns true if the reference is an export edits file.
| MFnReference (const MObject &object, MStatus *ReturnStatus=NULL)
| Constructor.
## Protected Member Functions
virtual const char * | className () const
| Class name. Search for all occurrences

## Constructor & Destructor Documentation

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

MFnReference | ( | 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::kReference.

Reimplemented from MFnDependencyNode.

MString fileName | ( | bool | resolvedName,
|  | bool | includePath,
|  | bool | includeCopyNumber,
|  | MStatus * | ReturnStatus = `NULL`
| ) |  | const

Search for all occurrences

Returns the name of file associated with this reference.

Parameters:

  [in] | resolvedName | If true, return the resolved name rather than the original file name. The unresolved name is the string originally specified when the file was loaded into Maya; this may contain environment variables, may be a relative path, and may otherwise not precisely indicate where the file can be located on disk. The resolved name is the actual path name that Maya is using to locate the file after relative paths and environment variables have been expanded, and any other necessary steps have been used to resolve its physical location.
  [in] | includePath | If true, include the file path in the return string.
  [in] | includeCopyNumber | If true, include the copy number (if there is one) in the return string.
  [out] | ReturnStatus | return status

Returns:
  The name of the referenced file

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

MString associatedNamespace | ( | bool | baseName,
|  | MStatus * | ReturnStatus = `NULL`
| ) |  | const

Search for all occurrences

Returns the namespace associated with this reference.

Parameters:

  [in] | baseName | If true, return the base name of the reference
  [out] | ReturnStatus | return status

Returns:
  The namespace of this reference

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

MString parentFileName | ( | bool | resolveName,
|  | bool | includePath,
|  | bool | includeCopyNumber,
|  | MStatus * | ReturnStatus = `NULL`
| ) |  | const

Search for all occurrences

Returns the name of parent file associated with this reference.

Parameters:

  [in] | resolveName | If true, return the resolved name rather than the original file name. The unresolved name is the string originally specified when the file was loaded into Maya; this may contain environment variables, may be a relative path, and may otherwise not precisely indicate where the file can be located on disk. The resolved name is the actual path name that Maya is using to locate the file after relative paths and environment variables have been expanded, and any other necessary steps have been used to resolve its physical location.
  [in] | includePath | If true, include the file path in the return string.
  [in] | includeCopyNumber | If true, include the copy number (if there is one) in the return string.
  [out] | ReturnStatus | return status

Returns:
  The name of the parent file to the reference. Returns an empty string if there is no parent file.

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

MObject parentReference | ( | MStatus * | ReturnStatus = `NULL` | ) | const

Search for all occurrences

Returns the reference node associated with the parent reference.

Parameters:

  [out] | ReturnStatus | return status

Returns:
  The parent reference of this reference or MObject::kNullObj if there is no associated reference.

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

MObject parentAssembly | ( | MStatus * | ReturnStatus = `NULL` | ) | const

Search for all occurrences

Returns the parent assembly node that contains this reference.

See MFnAssembly documentation for more details.

Parameters:

  [out] | ReturnStatus | return status

Returns:
  The parent assembly node that contains this reference or MObject::kNullObj if there is no parent assembly node.

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

bool containsNode | ( | const MObject & | node,
|  | MStatus * | ReturnStatus = `NULL`
| ) |  | const

Search for all occurrences

Returns true if the specified node is from this reference or one of its child references.

The containsNodeExactly method can be used to test membership without including the child references.

Parameters:

  [in] | node | The node to be checked
  [out] | ReturnStatus | return status

Returns:
  Whether or not the node is from the reference or one of its child references.

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

bool containsNodeExactly | ( | const MObject & | node,
|  | MStatus * | ReturnStatus = `NULL`
| ) |  | const

Search for all occurrences

Returns true if the specified node is from this reference.

Membership in child references is not checked. The containsNode method may be used to test membership in a reference and its child references.

Parameters:

  [in] | node | The node to be checked
  [out] | ReturnStatus | return status

Returns:
  Whether or not the node is from the reference.

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

void nodes | ( | MObjectArray & | nodeList,
|  | MStatus * | ReturnStatus = `NULL`
| ) |  | const

Search for all occurrences

Returns an array of the nodes associated with this reference.

Parameters:

  [out] | nodeList | the nodes from this reference
  [out] | ReturnStatus | return status

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

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

Search for all occurrences

Returns true if the reference is loaded.

Parameters:

  [out] | ReturnStatus | return status

Returns:
  Whether or not the reference is loaded

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

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

Search for all occurrences

Returns true if the reference is locked or if the referenced file was saved as locked.

Parameters:

  [out] | ReturnStatus | return status

Returns:
  Returns true if the reference is locked or if the referenced file was saved as locked

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

Reimplemented from MFnDependencyNode.

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

Search for all occurrences

Returns true if the reference is an export edits file.

An export edits file is a file of type ".editMA" or ".editMB" which was created using Maya's offline file functionality.

Parameters:

  [out] | ReturnStatus | return status

Returns:
  Whether or not the reference is an export edits file

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

MFnReference MFnReference MFnReference MFnReference MFnReference MFnReference MFnReference MFnReference MFnReference MFnReference
MFnReference MFnReference MFnReference MFnReference MFnReference MFnReference MFnReference MFnReference MFnReference MFnReference