MSubSceneContainer Class Reference

#include <MPxSubSceneOverride.h>

Class Description

Container for render items generated by MPxSubSceneOverride.

An instance of this class is associated with each instance of MPxSubSceneOverride and is used to manage and store the set of render items required by the override to draw its associated DAG object.

The container is optimized to be used with large numbers of render items.

The container will assume ownership of any render item added to it. Implementations of MPxSubSceneOverride are free to maintain separate pointers to render items stored in the container, but those pointers will become invalid as soon as the associated render item is removed from the container.

+ Examples:

Public Member Functions

bool add (MRenderItem *item)
 Add a render item to the set of render items that will be used to draw the DAG object associated with the override that owns this container. More...
 
bool remove (const MString &name)
 Remove a render item by name from the set of render items used to draw the object associated with the override that owns this container. More...
 
void clear ()
 Remove all render items from this container. More...
 
MRenderItemfind (const MString &name)
 Get a render item by name from the container. More...
 
unsigned int count () const
 Get the number of render items in the container. More...
 
const MRenderItemfind (const MString &name) const
 Get a render item by name from the container. More...
 
Iterator * getIterator ()
 Get an iterator for the container. More...
 
ConstIterator * getConstIterator () const
 Get a const iterator for the container. More...
 

Static Public Member Functions

static const char * className ()
 Returns the name of this class. More...
 

Member Function Documentation

bool add ( MRenderItem item)

Add a render item to the set of render items that will be used to draw the DAG object associated with the override that owns this container.

Each item in the container must have a unique name and the same render item may not be used in the container more than once. When Viewport 2.0 draws the associated DAG object, it will process all render items in this container. Any items that have valid geometry and a valid shader will be drawn as long as they pass all filtering tests for the active viewport.

On successful add, Maya assumes ownership of the render item and the caller should not call MRenderItem::Destroy() on the item. Callers are free to hold a pointer to the render item for easy access. Note that any pointers to MRenderItem objects added to MSubSceneContainer become invalid after the render item is removed from the container. Attempts to use such pointers will result in instability. Further note that it is invalid to modify any render item owned by this container outside of MPxSubSceneOverride::update(). Attempts to do so will result in unpredictable behavior.

Parameters
[in]itemThe item to add
Returns
True if the item was successfully added to the container
+ Examples:
bool remove ( const MString name)

Remove a render item by name from the set of render items used to draw the object associated with the override that owns this container.

Note that on successful removal any pointers to the render item that was removed become invalid and any attempts to use such pointers will result in instability.

Parameters
[in]nameThe name of the render item to remove
Returns
True if the item was successfully removed from the container
+ Examples:
void clear ( )

Remove all render items from this container.

After calling, any pointers to any render items owned by this container will be invalid.

+ Examples:
MRenderItem * find ( const MString name)

Get a render item by name from the container.

The ownership of the render item remains with the container and callers should not call MRenderItem::Destroy() on it. The pointer may be cached and will remain valid until the render item is removed from the container.

Parameters
[in]nameThe name of the render item to retrieve
Returns
The requested render item or NULL if not found
+ Examples:
unsigned int count ( ) const

Get the number of render items in the container.

Returns
The number of render items in the container.
+ Examples:
const MRenderItem * find ( const MString name) const

Get a render item by name from the container.

The pointer may be cached and will remain valid until the render item is removed from the container.

Parameters
[in]nameThe name of the render item to retrieve
Returns
The requested render item or NULL if not found
MSubSceneContainer::Iterator * getIterator ( )

Get an iterator for the container.

Caller is responsible for deleting the iterator when it is no longer needed.

Returns
An iterator for the container or NULL on failure
MSubSceneContainer::ConstIterator * getConstIterator ( ) const

Get a const iterator for the container.

Caller is responsible for deleting the iterator when it is no longer needed.

Returns
A const iterator for the container or NULL on failure
const char * className ( )
static

Returns the name of this class.

Returns
Name of this class.

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