MPxDrawOverride2 Class Reference

#include <MPxDrawOverride.h>

Class Description

This method is obsolete.

Derived class of MPxDrawOverride to allow user overrided selection.

Deprecated:
This virutal functions introduced with this class will be in MPxDrawOverride class in future releases.

If the user plug-in wants to take control of selection process, it should be derived from MPxDrawOverride2 instead of MPxDrawOverride.

+ Examples:
+ Inheritance diagram for MPxDrawOverride2:

Public Member Functions

 MPxDrawOverride2 (const MObject &obj, GeometryDrawOverrideCb callback, bool isAlwaysDirty=true)
 Construct an MPxDrawOverride2. More...
 
virtual ~MPxDrawOverride2 ()
 Destructor.
 
virtual bool wantUserSelection () const
 Override this function and return true to indicate Maya system to invoke MPxDrawOverride::userSelect() for selection testing. More...
 
virtual bool userSelect (MSelectionInfo &selectInfo, const MHWRender::MDrawContext &context, MPoint &hitPoint, const MUserData *data)
 This method is invoked when MPxDrawOverride::wantUserSelection() returns true. More...
 
- Public Member Functions inherited from MPxDrawOverride
 MPxDrawOverride (const MObject &obj, GeometryDrawOverrideCb callback, bool isAlwaysDirty=true)
 Construct an MPxDrawOverride. More...
 
virtual ~MPxDrawOverride ()
 Destructor.
 
virtual MHWRender::DrawAPI supportedDrawAPIs () const
 Returns the draw API supported by this override. More...
 
virtual bool hasUIDrawables () const
 In order for any override for the addUIDrawables() method to be called this method must also be overridden to return true. More...
 
virtual MMatrix transform (const MDagPath &objPath, const MDagPath &cameraPath) const
 Called by Maya whenever the world space transform is needed for the object to be drawn by the draw callback. More...
 
virtual MBoundingBox boundingBox (const MDagPath &objPath, const MDagPath &cameraPath) const
 Called by Maya whenever the bounding box of the drawable object is needed. More...
 
virtual bool isBounded (const MDagPath &objPath, const MDagPath &cameraPath) const
 Called by Maya to determine if the drawable object is bounded or not. More...
 
virtual bool disableInternalBoundingBoxDraw () const
 Indicates whether to disable the automatic drawing of bounding boxes when the display mode has been set to bounding box display. More...
 
virtual bool excludedFromPostEffects () const
 Indicates whether or not the draw code should be called for any additional passes required to perform post effects. More...
 
virtual bool isTransparent () const
 Indicates whether or not the draw method should be called for each transparency pass(front-culling and back-culling). More...
 
virtual MUserDataprepareForDraw (const MDagPath &objPath, const MDagPath &cameraPath, const MFrameContext &frameContext, MUserData *oldData)=0
 Called by Maya whenever the object is dirty and needs to update for draw. More...
 
virtual void addUIDrawables (const MDagPath &objPath, MUIDrawManager &drawManager, const MFrameContext &frameContext, const MUserData *data)
 Provides access to the MUIDrawManager, which can be used to queue up operations to draw simple UI shapes like lines, circles, text, etc. More...
 
virtual bool refineSelectionPath (const MSelectionInfo &selectInfo, const MRenderItem &hitItem, MDagPath &path, MObject &geomComponents, MSelectionMask &objectMask)
 Maya calls this function during the hit test phase of the viewport 2.0 selection and is used to override the selected path, the selected components or simply reject the selection. More...
 
virtual void updateSelectionGranularity (const MDagPath &path, MSelectionContext &selectionContext)
 Maya calls this function during the pre-filtering phase of the viewport 2.0 selection and is used to setup the selection context of the given DAG object. More...
 
virtual bool traceCallSequence () const
 This method allows a way for a plug-in to examine the basic call sequence for a draw override. More...
 
virtual void handleTraceMessage (const MString &message) const
 When debug tracing is enabled via MPxDrawOverride::traceCallSequence(), this method will be called for each trace message. More...
 

Additional Inherited Members

- Public Types inherited from MPxDrawOverride
typedef void(* GeometryDrawOverrideCb) (const MDrawContext &, const MUserData *)
 User draw callback definition, draw context and blind user data are parameters.
 
- Static Public Member Functions inherited from MPxDrawOverride
static const char * className ()
 Returns the name of this class. More...
 
- Protected Member Functions inherited from MPxDrawOverride
MStatus setGeometryForRenderItem (MRenderItem &renderItem, const MVertexBufferArray &vertexBuffers, const MIndexBuffer *indexBuffer, const MBoundingBox *objectBox) const
 Call this method to provide the geometry for a render item. More...
 
- Static Protected Member Functions inherited from MPxDrawOverride
static MStatus drawRenderItem (const MHWRender::MDrawContext &context, MRenderItem &item)
 Call this method to draw a render item constructed for the MPxDrawOverride. More...
 

Constructor & Destructor Documentation

MPxDrawOverride2 ( const MObject obj,
GeometryDrawOverrideCb  callback,
bool  isAlwaysDirty = true 
)

Construct an MPxDrawOverride2.

Parameters
[in]objThe Maya object this override draws
[in]callbackThe callback function to be invoked at draw time
[in]isAlwaysDirtyIf true, this override will always be updated (via prepareForDraw() or addUIDrawables()) without checking the dirty state of the Maya object. To avoid any unnecessary performance overhead due to the frequency of calling the update methods, the flag can be set to false. In this case the update methods will only be called when the Maya object is marked dirty via DG evaluation or dirty messages. To explicitly mark an object as being dirty the MRenderer::setGeometryDrawDirty() method can be used. Default is true.

Member Function Documentation

bool wantUserSelection ( ) const
virtual

Override this function and return true to indicate Maya system to invoke MPxDrawOverride::userSelect() for selection testing.

Returning false means using default implementation that is based on rasterization result of the drawing method.

Returns
True Maya system will call userSelect() to determine the selection of associated object.
bool userSelect ( MSelectionInfo selectInfo,
const MHWRender::MDrawContext context,
MPoint hitPoint,
const MUserData data 
)
virtual

This method is invoked when MPxDrawOverride::wantUserSelection() returns true.

Return true from this function to indicate Maya system the MPxDrawOverride with given MUserData instance is selected regarding current selection context.

Parameters
[in]selectInfoA reference to MSelectionInfo from which the selection region and other information can be queried.
[in]contextThe reference to MDrawContext that allows the derived class to implement drawing based selection method, or the plug-in can retrieve the world transform matrix for other purpose like performing hit testing on CPU.
[in,out]hitPointThe hit position that Maya system will use for depth sorting of selected objects. Returning the correct hit position to result correct selection based on viewport visibility, especially in single pick mode. By default this parameter has been assigned to the local origin of current DAG path's transform. The plug-in may modify it to provide more accurate hit position.
[in]dataThis is the same user data that MPxDrawOverride::prepareForDraw() returns.
Returns
True the object is selected.

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