C++ API Reference
MPxRepresentation Class Referenceabstract

Abstract base class for user defined representations. More...

#include <MPxRepresentation.h>

Public Member Functions

virtual ~MPxRepresentation ()
 Class destructor.
 
virtual bool activate ()=0
 Activate this representation. More...
 
virtual bool inactivate ()
 Inactivate this representation. More...
 
virtual MString getType () const =0
 Return the representation type string. More...
 
MString getName () const
 Returns the name of the representation. More...
 
virtual bool canApplyEdits () const
 Determines whether this representation can apply tracked edits to its data. More...
 
virtual void getExternalContent (MExternalContentInfoTable &table) const
 Get external content for this representation. More...
 
virtual void setExternalContent (const MExternalContentLocationTable &table)
 Set external content for this representation. More...
 

Protected Member Functions

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

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.

Examples:
sceneAssembly/adskRepresentationFactory.h, sceneAssembly/adskRepresentations.cpp, sceneAssembly/adskRepresentations.h, sceneAssembly/assemblyDefinition.cpp, and sceneAssembly/assemblyDefinition.h.

Constructor & Destructor Documentation

OPENMAYA_MAJOR_NAMESPACE_OPEN 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.
Examples:
sceneAssembly/adskRepresentations.h.
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.
Examples:
sceneAssembly/adskRepresentations.h.
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.
Examples:
sceneAssembly/adskRepresentations.h.
void getExternalContent ( MExternalContentInfoTable table) const
virtual

Get external content for this representation.

This is a propagation of the method of the same name on MPxNode. Representation owners (most likely derived from MPxAssembly) are expected to call this method from their own implementation of this method. In the context of representations, external content is any file or other piece of information that is stored externally to the representation.

For example, a representation that would load a cache file will insert this cache file's path into the table passed in.

The default implementation does nothing.

Parameters
[out]tableThe table into which the representation must add its external content item(s).
Examples:
sceneAssembly/adskRepresentations.h.
void setExternalContent ( const MExternalContentLocationTable table)
virtual

Set external content for this representation.

This is a propagation of the method of the same name on MPxNode. Representation owners (most likely derived from MPxAssembly) are expected to call this method from their own implementation of this method. In the context of representations, external content is any file or other piece of information that is stored externally to the representation.

For example, a representation that would load a cache file will read the cache's path from the table passed in and change its internal representation to this path. The path will be at the same key that was used when it was inserted in the corresponding table by getExternalContent.

The default implementation does nothing.

Parameters
[in]tableThe table into which the representation must add its external content item(s).
Examples:
sceneAssembly/adskRepresentations.h.
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.

The documentation for this class was generated from the following files: