#include <MPxRepresentation.h>
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.
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... | |
MPxAssembly * | getAssembly () const |
USE _getAssembly() IN SCRIPT. More... | |
|
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).
[in] | assembly | The assembly node which owns this representation. |
[in] | name | The name of this representation. |
|
pure virtual |
Activate this representation.
|
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.
|
pure virtual |
Return the representation type string.
MString getName | ( | ) | const |
Returns the name of the representation.
|
virtual |
Determines whether this representation can apply tracked edits to its data.
Implementation in this class returns false.
|
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.
[out] | table | The table into which the representation must add its external content item(s). |
|
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.
[in] | table | The table into which the representation must add its external content item(s). |
|
protected |
USE _getAssembly() IN SCRIPT.
Returns the assembly which owns this representation.
Note: in Python scripts, use MPxRepresentation._getAssembly() instead.