C++ API Reference: MRenderOverride Class Reference

MRenderOverride Class Reference
+ Related help topics:

Base class for defining a rendering override. More...

#include <MViewport2Renderer.h>

Public Member Functions

 MRenderOverride (const MString &name)
 Constructor for a name render override. More...
 
virtual ~MRenderOverride ()
 Default destructor for a render override.
 
virtual ::MHWRender::DrawAPI supportedDrawAPIs () const
 Returns the draw API supported by this override. More...
 
virtual bool startOperationIterator ()
 In order for an override to indicate the set of operations that are to be performed it must implement overrides for the iterator methods on the override: More...
 
virtual MRenderOperationrenderOperation ()
 Return the current operation being iterated over. More...
 
virtual bool nextRenderOperation ()
 Iterate to the next operation. More...
 
const MStringname () const
 Query the name of the override. More...
 
virtual MString uiName () const
 Query the user interface name for the override. More...
 
virtual MStatus setup (const MString &destination)
 Perform any setup required before render operations are to be executed. More...
 
virtual MStatus cleanup ()
 Perform any cleanup required following the execution of render operations. More...
 
virtual bool select (const MFrameContext &frameContext, const MSelectionInfo &selectInfo, bool useDepth, MSelectionList &selectionList, MPointArray &worldSpaceHitPts)
 The method is called by Maya to override the default Viewport 2.0 selection. More...
 
const MFrameContextgetFrameContext () const
 Return frame context. More...
 

Detailed Description

Constructor & Destructor Documentation

MRenderOverride ( const MString name)

Constructor for a name render override.

Parameters
[in]nameName of render override

Member Function Documentation

bool startOperationIterator ( )
virtual

In order for an override to indicate the set of operations that are to be performed it must implement overrides for the iterator methods on the override:

The order that the operations are returned via these methods determines the order that the operations are invoked.

If there is a user operation (MUserRenderOperation) the execute() method for that operation will be called when the operation is invoked.

Note that the ordering will not change during one invocation of an override which is delimited by the setup() and cleanup() calls.

This particular method is called to allow the override to start iterating over a list of operations to be performed by the override.

The operations that are returned can be thought of as representing a "command list". This command list will perform in order from start to end.

Pseudo-code for the internal Maya iteration logic would look something like this:

MRenderOverride override;
if (override.startOperationIterator())
{
	--> Get operation
	MRenderOperation *op = override.renderOperation();
	while (op)
	{
		if (op)
			--> Add to "list" of operations to perform
        --> Iterate to next operation
		if (!override.nextRenderOperation())
			op = NULL;
		else
			op = override.renderOperation();
	}
}
Returns
True if there are any operations to iterate over. Note that an override with no operations will basically mean that the override draws nothing. In this case the renderer will perform it's default rendering operations.
+ Examples:
const MString & name ( ) const

Query the name of the override.

Returns
Name of the override
+ Examples:
MStatus setup ( const MString destination)
virtual

Perform any setup required before render operations are to be executed.

The default behaviour performs no actions.

An override is called once per render. The order of method calls when an override is called is as follows:

Parameters
[in]destinationString identifier which gives an indication as to where this override is being applied. Presently this will return a viewport panel name for interactive rendering.
Returns
Status code. MStatus::kSuccess is returned by default.
Status Codes:
+ Examples:
bool select ( const MFrameContext frameContext,
const MSelectionInfo selectInfo,
bool  useDepth,
MSelectionList selectionList,
MPointArray worldSpaceHitPts 
)
virtual

The method is called by Maya to override the default Viewport 2.0 selection.

It returns false by default, meaning the default selection will be used. If an implementation returns true, selectionList and worldSpaceHitPts will be used to override the default selection.

A complete implementation requires hit testing and selection interpretation. If an object is hit, the implementation should add its DAG path (and also its component when appropriate) to selectionList and add the world-space hit point between the selected item and selection ray to worldSpaceHitPts. The number of elements in selectionList and worldSpaceHitPts must be the same in any case, a selected item (typically a vertex component) and a hit point at the same array index will be associated.

If the method is triggered for point snapping, the implementation needs to sort the hit points and return the one nearest to the cursor. The state of point snapping can be queried from selectInfo.

When an implementation returns true to override the default behavior, the object-level selection override methods won't be triggered any more:

Parameters
[in]frameContextThe frame-level context information
[in]selectInfoThe selection info
[in]useDepthWhether only the objects nearest to camera can be selected
[out]selectionListList of selection items
[out]worldSpaceHitPtsList of world-space hit points
Returns
True if the default behavior needs to be overridden.
const MHWRender::MFrameContext * getFrameContext ( ) const

Return frame context.

The context is not available if called before setup() or after cleanup().

Returns
Pointer to frame context. The context should never be deleted by the plug-in as it is owned by the render override.

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