Python API 2.0 Reference
OpenMayaRender.MPxGeometryOverride Class Reference
+ Inheritance diagram for OpenMayaRender.MPxGeometryOverride:

Public Member Functions

def __init__ ()
 
def addUIDrawables ()
 
def cleanUp ()
 
def configCache ()
 
def getFrameContext ()
 
def handleTraceMessage ()
 
def hasUIDrawables ()
 
def isIndexingDirty ()
 
def isStreamDirty ()
 
def populateGeometry ()
 
def refineSelectionPath ()
 
def requiresGeometryUpdate ()
 
def requiresUpdateRenderItems ()
 
def supportedDrawAPIs ()
 
def supportsEvaluationManagerParallelUpdate ()
 
def supportsVP2CustomCaching ()
 
def traceCallSequence ()
 
def updateDG ()
 
def updateRenderItems ()
 
def updateSelectionGranularity ()
 

Static Public Member Functions

def __new__ ()
 
def pointSnappingActive ()
 

Detailed Description

Base for user-defined classes to prepare geometry for drawing.

Constructor & Destructor Documentation

def OpenMayaRender.MPxGeometryOverride.__init__ ( )
Initialize self.  See help(type(self)) for accurate signature.

Member Function Documentation

def OpenMayaRender.MPxGeometryOverride.__new__ ( )
static
Create and return a new object.  See help(type) for accurate signature.
def OpenMayaRender.MPxGeometryOverride.addUIDrawables ( )
addUIDrawables(path, drawManager, frameContext) -> self

For each instance of the object, besides the render items updated in updateRenderItems() there is also a render item list for rendering simple UI elements.
This stage gives the plugin access to MUIDrawManager which aids in drawing simple geometry like line, circle, rectangle, text, etc.

Overriding this methods is not always necessary, but if you want to override it, please also override 'hasUIDrawables()' to make it return True or the overridden method will not be called.

If you are not going to override this function, please don't make 'hasUIDrawables()' return True or there may be some wasted performance overhead.

Implementation of this method here is empty.

* path (MDagPath) - The path to the instance to update auxiliary items for.
* drawManager (MUIDrawManager) - The draw manager used to draw simple geometry.
* frameContext (MFrameContext) - Frame level context information.
def OpenMayaRender.MPxGeometryOverride.cleanUp ( )
cleanUp() -> self

Called after all other stages are completed. Clean up any cached data stored from the updateDG() phase.
def OpenMayaRender.MPxGeometryOverride.configCache ( )
configCache(evalNode, schema) -> None

Defines the node's behavior when participating in Cached Playback.

This method will be called at EM partitioning time, after rules evaluation.

* evalNode (MEvaluationNode)  - This node's evaluation node, contains animated plug information
* schema (MCacheSchema)       - Specification about what attributes to cache
def OpenMayaRender.MPxGeometryOverride.getFrameContext ( )
getFrameContext() -> MFrameContext

Return a frame context. The context is not available if called before setup or after cleanup.
The context should never be deleted by the plug-in as it is owned by the geometry override.
def OpenMayaRender.MPxGeometryOverride.handleTraceMessage ( )
handleTraceMessage(message) -> self

When debug tracing is enabled via MPxGeometryOverride::traceCallSequence(),
this method will be called for each trace message.

The default implementation will print the message
to stderr.

* message - A string which will provide feedback on either an
internal or plug-in call location. To help distinguish which
geometry override a message is associated with, the full path
name for the DAG object (associated with the geometry override) may
be included as part of the string.
def OpenMayaRender.MPxGeometryOverride.hasUIDrawables ( )
hasUIDrawables() -> bool

Query whether 'addUIDrawables()' will be called or not.

In order for any override for the addUIDrawables() method to be called this method must also be overridden to return True.

This method should not be overridden if addUIDrawables() has not also been overridden as there may be associated wasted overhead.
def OpenMayaRender.MPxGeometryOverride.isIndexingDirty ( )
isIndexingDirty(item) -> bool

Returns True if the index buffer needs to be updated.

This method is called for each render item on the assocated DAG object whenever the object changes. This method is passed a render item. This method should return True if the indexing for the render item has changed since the last frame. Note that returning False from isIndexingDirty may NOT prevent populate geometry from requiring that an index buffer is updated.

* item (MRenderItem) - The render item in question.
def OpenMayaRender.MPxGeometryOverride.isStreamDirty ( )
isStreamDirty(desc) -> bool

Returns True if the vertex buffer needs to be updated.

This method is called for each geometry stream on the assocated DAG object whenever the object changes. This method is passed a vertex buffer descriptor representing one stream on the object to be updated. This method should return True if it is safe to reuse the existing buffer rather than filling a new buffer with data. Note that returning False from isStreamDirty may NOT prevent populateGeometry from requiring that a stream be updated.

* desc (MVertexBufferDescriptor) - The description of the vertex buffer.
def OpenMayaRender.MPxGeometryOverride.pointSnappingActive ( )
static
pointSnappingActive() -> bool

Returns True if selection has been launched to find snap points.
To participate, you need to have at least one render item with point geometry
and MSelectionMask.kSelectPointsForGravity set in MRenderItem.selectableMask().
- The granularity must be set to MSelectionContext.kComponent in updateSelectionGranularity()
- A component converter is not necessary in this scenario.
- refineSelectionPath() will not be called. All points present in the render item will be
considered suitable locations for snapping.
def OpenMayaRender.MPxGeometryOverride.populateGeometry ( )
populateGeometry(requirements, renderItems, data) -> self

Implementations of this method should create and populate vertex and index buffers on the MGeometry instance 'data' in order to fulfill all of the geometry requirements defined by the 'requirements' parameter. Failure to do so will result in the object either drawing incorrectly or not drawing at all. See the documentation of MGeometryRequirements and MGeometry for more details on the usage of these classes. The geometry requirements will ask for index buffers on demand. Implementations can force the geometry requirements to update index buffers by calling MRenderer.setGeometryDrawDirty() with topologyChanged setting to True.

* requirements (MGeometryRequirements) - The requirements that need to be satisfied.
* renderItems (MRenderItemList) - The list of render items that need to be updated.
* data [OUT] (MGeometry) - The container for the geometry data
def OpenMayaRender.MPxGeometryOverride.refineSelectionPath ( )
refineSelectionPath(selectInfo, hitItem, path, components, objectMask) -> bool

This method is called 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.
Should return True if the selection candidate is acceptable.

One can decide to change the selected path (ie: select the bottom-most transform instead of the proposed path).
One can decide to remove or add component to the proposed selected list.
One can decide to change the selection mask of the object (ie: override the selection mask returned by a component converter).
One can decide that the proposed selection (path or component) is not acceptable and discard it (ie: return False).

The default implementation makes no changes to 'path', 'components' or 'objectMask' and returns True (i.e. the selection is accepted).

* selectInfo (MSelectionInfo) - The selection info
* hitItem (MRenderItem) - The render item hit
* path [IN/OUT] (MDagPath) - The selected path
* components [IN/OUT] (MObject) - The selected components
* objectMask [IN/OUT] (MSelectionMask) - The object selection mask
def OpenMayaRender.MPxGeometryOverride.requiresGeometryUpdate ( )
requiresGeometryUpdate() -> bool

This method is called one during each draw - preparation phase. If this method returns true then all of the other MPxGeometryOverride methods will be called for the associated DAG object this draw preparation phase.If this method returns false then all of the other MPxGeometryOverride methods may be called.This code has to be thread safe, non - blocking and work only on data owned by the associated DAG object.
def OpenMayaRender.MPxGeometryOverride.requiresUpdateRenderItems ( )
requiresUpdateRenderItems(path) -> bool

This method is called for each instance of the associated DAG object whenever the object changes.If, during a single draw - preparation phase this method returns false for all DAG instances of this MPxGeometryOverride then updateRenderItems() will not be called for the draw - preparation phase.

* path (MDagPath) - The path to the instance to update render items for
def OpenMayaRender.MPxGeometryOverride.supportedDrawAPIs ( )
supportedDrawAPIs() -> DrawAPI

Returns the draw API supported by this override.
def OpenMayaRender.MPxGeometryOverride.supportsEvaluationManagerParallelUpdate ( )
supportsEvaluationManagerParallelUpdate() -> bool

This method is called for each MPxGeometryOverride in the scene to determine if the MPxGeometryOverride is eligible for Evaluation Manager Parallel Update.
def OpenMayaRender.MPxGeometryOverride.supportsVP2CustomCaching ( )
supportsVP2CustomCaching() -> bool

This method is called for each MPxGeometryOverride in the scene to determine if the MPxGeometryOverride is eligible for VP2 Evaluation Caching.
def OpenMayaRender.MPxGeometryOverride.traceCallSequence ( )
traceCallSequence() -> bool

This method allows a way for a plug-in to examine
the basic call sequence for a geometry override.

The default implementation returns false meaning no
tracing will occur.
def OpenMayaRender.MPxGeometryOverride.updateDG ( )
updateDG() -> self

Perform any work required to translate the geometry data that needs to get information from the dependency graph.  This should be the only place that dependency graph evaluation occurs. Any data retrieved should be cached for later stages.
def OpenMayaRender.MPxGeometryOverride.updateRenderItems ( )
updateRenderItems(path, list) -> self

This method is called for each instance of the associated DAG object whenever the object changes. The method is passed the path to the instance and the current list of render items associated with that instance. By default the list will contain one render item for each shader assigned to the instance. Implementations of this method method may add, remove or modify items in the list. Note that removal of items created by Maya for assigned shaders is not allowed and will fail. As an alternative this method can disable those items so that they do not draw.

* path (MDagPath) - The path to the instance to update render items for
* list [IN/OUT] (MRenderItemList) - The current render item list, items may be modified, added or removed.
def OpenMayaRender.MPxGeometryOverride.updateSelectionGranularity ( )
updateSelectionGranularity(path, selectionContext) -> self

This is method is called during the pre-filtering phase of the viewport 2.0 selection and is used to setup the selection context of the given DAG object.

This is useful to specify the selection level, which defines what can be selected on the object :
  MSelectionContext.kNone        Nothing can be selected
  MSelectionContext.kObject      Object can be selected as a whole
  MSelectionContext.kComponent   Parts of the object - such as vertex, edge or face - are selectable
This is used to discard objects that are not selectable given the current selection mode (see MGlobal.selectionMode()).

The default implementation leaves the selection level set at its default value, which is kObject.

 path (MDagPath) - The path to the instance to update the selection context for
 selectionContext [OUT] (MSelectionContext) - The selection context