Public Member Functions | Protected Member Functions

MPxRepresentation Class Reference

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


Search for all occurrences

Detailed Description

Abstract base class for user defined representations.

MPxRepresentation is an abstract base class that can be used to provide an interface and services for user defined representations.

Representations are owned by a scene assembly node (see MPxAssembly). A scene assembly node will activate one of its representations; representations must therefore support activate and inactivate operations.

This class can be used to implement new kinds of representations within Maya that behave in a similar manner to the representations included in the scene assembly reference Maya plugin, which uses MPxRepresentation as a base class for its representations.

Note that use of this class to implement representations is not mandatory: it provides an interface that is convenient for dealing consistently with representations, as well as an inactivate() implementation that is widely useful (clear out the assembly). Also note that MPxRepresentation is not associated with a corresponding Maya DAG or DG node.

For use of scene assembly nodes, see function set MFnAssembly.

#include <MPxRepresentation.h>

List of all members.

Public Member Functions

virtual ~MPxRepresentation ()
 Class destructor.
virtual bool activate ()=0
 Activate this representation.
virtual bool inactivate ()
 Inactivate this representation.
virtual MString getType () const =0
 Return the representation type string.
MString getName () const
 Returns the name of the representation.
virtual bool canApplyEdits () const
 Determines whether this representation can apply tracked edits to its data.

Protected Member Functions

 MPxRepresentation (MPxAssembly *assembly, const MString &name)
 Class constructor, to be called by concrete derived classes.
MPxAssemblygetAssembly () const
 USE _getAssembly() IN SCRIPT.

Constructor & Destructor Documentation

MPxRepresentation ( MPxAssembly assembly,
const MString name 
) [protected]

Class constructor, to be called by concrete derived classes.

The representation does not own the assembly node given as argument; rather, it is the assembly node that owns the representation (and therefore destroys it).

Parameters:
[in]assemblyThe assembly node which owns this representation.
[in]nameThe name of this representation.

Member Function Documentation

bool activate ( ) [pure virtual]

Activate this representation.

Returns:
true if the activation succeeded, false otherwise.
bool inactivate ( ) [virtual]

Inactivate this representation.

Implementation in this class is to clear out the assembly. Inactivation will fail and return false if the name of the currently-active representation doesn't match the name of this representation.

Returns:
true if the inactivation succeeded, false otherwise.
MString getType ( ) const [pure virtual]

Return the representation type string.

Returns:
Representation type.
MString getName ( ) const

Returns the name of the representation.

Returns:
Representation name.
bool canApplyEdits ( ) const [virtual]

Determines whether this representation can apply tracked edits to its data.

Implementation in this class returns false.

Returns:
true if the representation can apply tracked edits, false otherwise.
MPxAssembly * getAssembly ( ) const [protected]

USE _getAssembly() IN SCRIPT.

Returns the assembly which owns this representation.

Note: in Python scripts, use MPxRepresentation._getAssembly() instead.

Returns:
Representation's assembly node.

MPxRepresentation MPxRepresentation MPxRepresentation MPxRepresentation MPxRepresentation MPxRepresentation MPxRepresentation MPxRepresentation MPxRepresentation MPxRepresentation
MPxRepresentation MPxRepresentation MPxRepresentation MPxRepresentation MPxRepresentation MPxRepresentation MPxRepresentation MPxRepresentation MPxRepresentation MPxRepresentation