- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Examples

- Class List
- Class Hierarchy
- Class Members

Public Member Functions | Static Public Member Functions

# MSubSceneContainer Class Reference
OpenMayaRender - API module for rendering

This reference page is linked to from the following overview topics: 3.7 Sub-scene Overrides.

Search for all occurrences

## Detailed 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.

`#include <MPxSubSceneOverride.h>`

List of all members.

## 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.
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.
void | clear ()
| Remove all render items from this container.
MRenderItem * | find (const MString &name)
| Get a render item by name from the container.
unsigned int | count () const
| Get the number of render items in the container.
const MRenderItem * | find (const MString &name) const
| Get a render item by name from the container.
Iterator * | getIterator ()
| Get an iterator for the container.
ConstIterator * | getConstIterator () const
| Get a const iterator for the container.
## Static Public Member Functions
static const char * | className ()
| Returns the name of this class.

## Member Function Documentation

bool add | ( | MRenderItem * | item | ) |

Search for all occurrences

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] | item | The item to add

Returns:
  True if the item was successfully added to the container

bool remove | ( | const MString & | name | ) |

Search for all occurrences

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] | name | The name of the render item to remove

Returns:
  True if the item was successfully removed from the container

void clear | ( |  | ) |

Search for all occurrences

Remove all render items from this container.

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

MRenderItem * find | ( | const MString & | name | ) |

Search for all occurrences

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] | name | The name of the render item to retrieve

Returns:
  The requested render item or NULL if not found

unsigned int count | ( |  | ) | const

Search for all occurrences

Get the number of render items in the container.

Returns:
  The number of render items in the container.

const MRenderItem * find | ( | const MString & | name | ) | const

Search for all occurrences

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] | name | The name of the render item to retrieve

Returns:
  The requested render item or NULL if not found

MSubSceneContainer::Iterator * getIterator | ( |  | ) |

Search for all occurrences

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

Search for all occurrences

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]`

Search for all occurrences

Returns the name of this class.

Returns:
  Name of this class.

MSubSceneContainer MSubSceneContainer MSubSceneContainer MSubSceneContainer MSubSceneContainer MSubSceneContainer MSubSceneContainer MSubSceneContainer MSubSceneContainer MSubSceneContainer
MSubSceneContainer MSubSceneContainer MSubSceneContainer MSubSceneContainer MSubSceneContainer MSubSceneContainer MSubSceneContainer MSubSceneContainer MSubSceneContainer MSubSceneContainer