MEdit Class Reference

#include <MEdit.h>

Class Description

Base class for representing information about edits.

MEdit serves as the base class for representing information about edits that are made to certain types of entities, specifically references and assemblies. An edit is any operation that modifies a member of the entity. Examples of such modifications include changing attribute values, connections, parenting and so on.

In the case of references, edits are the changes that occur to referenced nodes.

In the case of assemblies, edits are the changes that occur to assembly members.

Derived classes implement specific types of edits, allowing them to be queried depending on the type of operation.

+ Inheritance diagram for MEdit:

Public Types

enum  EditType {
  kNullEdit, kSetAttrEdit, kConnectDisconnectEdit, kAddRemoveAttrEdit,
  kParentEdit, kFcurveEdit
}
 Type of edit. More...
 

Public Member Functions

virtual EditType editType (MStatus *ReturnStatus=NULL) const
 Returns the enum related to the type of the current edit. More...
 
MString getString (MStatus *ReturnStatus=NULL) const
 Returns the ASCII string related to the current edit. More...
 
bool isApplied (MStatus *ReturnStatus=NULL) const
 Query if we attempted to apply the edit. More...
 
bool isFailed (MStatus *ReturnStatus=NULL) const
 Query if the edit is applied successfully. More...
 
bool isTopLevel (MStatus *ReturnStatus=NULL) const
 Query if the edit was made from the top-level. More...
 
MStatus setApplied (bool isApplied)
 This method is obsolete. More...
 
MStatus setFailed (bool failed)
 This method is obsolete. More...
 
bool hasEditData () const
 Query if the edit has any user-defined editData associated with it. More...
 
bool matches (const MPxEditData *editData) const
 Query if the edit has user-defined editData associated with it that matches the given editData object. More...
 

Static Public Member Functions

static const char * className ()
 Returns the name of this class. More...
 

Friends

class MItEdits
 

Member Enumeration Documentation

enum EditType

Type of edit.

Enumerator
kNullEdit 

Null edit.

kSetAttrEdit 

Edit indicating a change in plug value.

kConnectDisconnectEdit 

Edit indicating a connection or disconnection.

kAddRemoveAttrEdit 

Edit indicating an attribute added or removed.

kParentEdit 

Edit indicating a parenting operation.

kFcurveEdit 

Edit indicating an fcurve modification.

Member Function Documentation

MEdit::EditType editType ( MStatus ReturnStatus = NULL) const
virtual

Returns the enum related to the type of the current edit.

Parameters
[out]ReturnStatusreturn status
Returns
The current reference or assembly edit type or kNullEdit if there is no current edit
Status Codes:

Reimplemented in MAddRemoveAttrEdit, MConnectDisconnectAttrEdit, MParentingEdit, MSetAttrEdit, and MFcurveEdit.

MString getString ( MStatus ReturnStatus = NULL) const

Returns the ASCII string related to the current edit.

Parameters
[out]ReturnStatusreturn status
Returns
The ASCII string related to the current edit
Status Codes:
bool isApplied ( MStatus ReturnStatus = NULL) const

Query if we attempted to apply the edit.

For example, as far as assemblies are concerned, edits are unapplied if you switch to a representation that can't accept edits, like the cache rep. As for references, edits are unapplied if references are unloaded.

It does not mean the edit was applied successfully. To query success/failure, please use MEdit::isFailed.

Parameters
[out]ReturnStatusreturn status
Returns
  • true We attempted to apply the edit.
  • false We did not attempt to apply the edit yet.
Status Codes:
bool isFailed ( MStatus ReturnStatus = NULL) const

Query if the edit is applied successfully.

One common cause of failed edit is it cannot find the node to apply the edit. They could be caused by the node name change or the node is not in the scene at the moment.

Parameters
[out]ReturnStatusreturn status
Returns
  • true The edit was applied successfully.
  • false The edit failed to be applied.
Status Codes:
bool isTopLevel ( MStatus ReturnStatus = NULL) const

Query if the edit was made from the top-level.

Edits that were made from the top-level can be removed. But edits that were made in nested references/assemblies cannot be removed since they are part of another file.

Parameters
[out]ReturnStatusreturn status
Returns
  • true The edit was made from the top-level.
  • false The edit was made in a nested reference/assembly.
Status Codes:
MStatus setApplied ( bool  isApplied)

This method is obsolete.

Deprecated:
Does nothing but return success. Present for backward-compatibility purposes only. Since Maya fully manages the edits internally, this deprecated method is not meaningful anymore. Only Maya can determine whether an edit is applied or not.
Parameters
[in]isAppliedNot used.
Returns
Success
Status Codes:
MStatus setFailed ( bool  failed)

This method is obsolete.

Deprecated:
Does nothing but return success. Present for backward-compatibility purposes only. Since Maya fully manages the edits internally, this deprecated method is not meaningful anymore. Only Maya can determine whether an edit has failed to apply or not.
Parameters
[in]failedNot used.
Returns
Success
Status Codes:
bool hasEditData ( ) const

Query if the edit has any user-defined editData associated with it.

See also matches().

Returns
  • true The edit has associated editData
  • false The edit does not have associated editData
bool matches ( const MPxEditData editData) const

Query if the edit has user-defined editData associated with it that matches the given editData object.

See also hasEditData().

Parameters
[in]editDataAn editData object to compare with this object
Returns
  • true The edit has matching associated editData
  • false The edit does not have matching associated editData
const char * className ( )
static

Returns the name of this class.

Returns
The name of this class.

The documentation for this class was generated from the following files:
  • MEdit.h
  • MEdit.cpp