class MObject

Jump to documentation

Generic Class for Accessing Internal Maya Objects

public members:

MObject ()
MObject ( const MObject &other )
~MObject ()
bool hasFn ( MFn::Type fs ) const
bool isNull () const
MFn::Type apiType () const
const char * apiTypeStr () const
bool operator == (const MObject &) const
bool operator != (const MObject &) const
MObject & operator = (const MObject &)
static MObject kNullObj
Null Object for use as default argument.

Documentation

Determine the exact type (MFn::Type) of an MObject within Maya.

Determine if an Object exists.

Determine if an Object is compatible with a specific Function Set.

Description

MObject is the generic class for accessing all Maya internal modelling, animation and rendering Objects, collectively referred to as Model Objects, through the API. This includes all Dependency Graph (DG) Nodes, of which Directed Acyclic Graph (DAG) Nodes are a subset.

Each instance of an MObject represents a specific Node or Attribute on a Node in the DG. Under the C++ class scheme MObjects simply have type MObject with no base or derived hierarchy. However, MObjects may be many different types of Model objects, from Attributes to transforms, including components of geometry such as Control Vertices (CV), faces, edges and vertices. This allows many different types of objects to be moved accessed through the API without undue concern on the part of plug-in developers for the type of object being manipulated.

Since it is impractical to provide every applicable method in MObjects, the methods applicable to Maya Objects are encapsulated in Function Sets. Function Sets can be attached to compatible MObjects to provide an external interface to methods appropriate to that MObject.

The link between an MObject and the role it performs as a Maya Model object, as well as the compatibility between MObjects and Function Sets is managed by the API Run-Time Type Identification (RTTI) system. The two key concepts of this system are the Maya Object type and the Function Set type (both in MFn::Type). All MObjects have one and only one Maya Object type. All Function Sets have one and only one Function Set type. MObjects may, however, be compatible with many types of Function Sets. This compatibility follows the class hierarchy of the Function Sets. Thus an MObject with Maya Object type MFn::kNurbsSurface would be compatible with MFnNurbsSurface, MFnDagNode, MFnDependencyNode, MFnNamedObject and MFnBase.

Use the apiType() method to determine the type (MFn::Type) of the Maya Model Object.

Use hasFn() to determine if the Object is comaptible with a given Function Set.

Use isNull() to determine if the internal Maya Object exists.

Functions

MObject:: MObject ()

Description

Class Constructor

Creates an MObject. Initializes it as a null Object.

Arguments

  • Nil

Status Codes

  • Nil

MObject:: MObject ( const MObject &other )

Description

Class Copy Constructor

Creates an MObject. Copies the object passed in.

Arguments

  • Nil

Status Codes

  • Nil

MObject:: ~MObject ()

Description

The class destructor.

Destroys the current object if nothing refers to it.

bool MObject:: hasFn ( MFn::Type fs ) const

Description

Determines the whether or not the internal Object is compatible with the given Function Type.

Arguments

  • fs Function Set type

Return Value

  • true Is compatible
  • false Is not compatible

Status Codes

  • Nil

bool MObject:: isNull () const

Description

Determines the whether or not an internal Object exists.

Arguments

  • Nil

Return Value

  • true Object does not exist
  • false Object exists

Status Codes

  • Nil

MFn::Type MObject:: apiType () const

Description

Determines the exact type of the Maya internal Object.

Arguments

  • Nil

Return Value

  • Exact type of the Maya internal Object. May be general or specific types of DG Nodes or Attributes.

Status Codes

  • Nil

const char * MObject:: apiTypeStr () const

Description

Returns a string that gives the object's type is a readable form. This is useful for debugging when type of an object needs to be printed.

Arguments

  • Nil

Return Value

  • a string containing the type name of the object

Status Codes

  • Nil

bool MObject:: operator== ( const MObject &other ) const

Description

The comparison operator. Returns true if both MObjects refer to the same Maya object.

bool MObject:: operator!= ( const MObject &other ) const

Description

The inequality operator. Returns true if the MObjects refer to different Maya objects.

MObject & MObject:: operator = (const MObject &other)

Description

The assignment operator.

Destroys the current object if no other MObjects refer to it. Points this object to the passed in object.

This class has no child classes.


Autodesk® Maya® 2008 © 1997-2007 Autodesk, Inc. All rights reserved. doc++ Copyright