This reference page is linked to from the following overview topics: Reference System Best Practices, Managing Variable Number of References.
Container that handles references to ReferenceTargets.
This is the interface for a container that references a variable number of ReferenceTarget objects. It assumes that none of the references are weak or are nodes.
3ds Max's implementation of this interface persists itself and its operations support being undone/redone. Plugins that need to store a variable number of references to other plugin objects should create an instance of this container type and make a reference to it.
The code below shows how to create an instance of 3ds Max's implementation of this interface:
IRefTargConatiner* myRefTargets = static_cast<IRefTargContainer*>(Interface::CreateInstance(REF_TARGET_CLASS_ID, REFTARG_CONTAINER_CLASS_ID));
#include <IRefTargContainer.h>
Public Member Functions |
|
virtual int | GetNumItems ()=0 |
Returns the number of items in the
container. |
|
virtual ReferenceTarget * | GetItem (int i)=0 |
Returns the i-th item, NULL if i is out of
range. |
|
virtual int | AppendItem (ReferenceTarget *ref)=0 |
Adds an item at the end of the container.
|
|
virtual void | SetItem (int i, ReferenceTarget *ref)=0 |
Sets the value of the i-th container item.
|
|
virtual int | InsertItem (int i, ReferenceTarget *ref)=0 |
Inserts specified item at i-th place into
the container. |
|
virtual void | RemoveItem (int i)=0 |
Removes the i-th item from the container.
|
virtual int GetNumItems | ( | ) | [pure virtual] |
Returns the number of items in the container.
virtual ReferenceTarget* GetItem | ( | int | i | ) | [pure virtual] |
Returns the i-th item, NULL if i is out of range.
i | The index of the item to return. Must be in range [0, GetNumItems()-1] |
virtual int AppendItem | ( | ReferenceTarget * | ref | ) | [pure virtual] |
Adds an item at the end of the container.
ref | The item to be added |
virtual void SetItem | ( | int | i, |
ReferenceTarget * | ref | ||
) | [pure virtual] |
Sets the value of the i-th container item.
i | - The index of the item to set. Must be >= 0. If the index is greater than GetNumItems(), a new item is added to the container. |
ref | - The item to set as the i-th item. |
virtual int InsertItem | ( | int | i, |
ReferenceTarget * | ref | ||
) | [pure virtual] |
Inserts specified item at i-th place into the container.
i | - The index where the item should be inserted. Must be in range [0, GetNumItems()], otherwise i is truncated to fit in this range. When i is GetNumItems(), the item is appended to the end of the container. |
ref | - The item to be inserted. |
virtual void RemoveItem | ( | int | i | ) | [pure virtual] |
Removes the i-th item from the container.
De-references the i-th item and removes it from the container, thus effectively changing the number of items the container reports to have via GetNumItems().
i | - The index of the item to be removed. Must be in range [0, GetNumItems()-1]. |