IContainerObject Class Reference

#include <IContainerObject.h>

Class Description

Container Interface.

IContainer provides access to the container object functionality.

A container is a helper object in the scene. Once created, the user can choose its content, that is, nodes that are meant to be grouped together. Containers should be self-contained blocks without references from the content to nodes outside of the container, otherwise the references will be lost during operation of the container. Containers hold the content, and moving or deleting a container will affect the content, but containers and content are not the same thing. For example, content can be unloaded, while the container remains in the scene. The container is associated to a container definition file, which is a Max file that stores only the container and its contents. Container definitions are tracked as file assets.

There are two types of containers:

  1. Local Containers: Containers can be created locally and used to organize scenes in ways that are similar to the uses of groups or layers. This provides a way to collect a bunch of nodes and work with them as one, or to section part of your scene to share with others. If a local container has no content that is inherited from any source (including nested containers, that is, containers inside containers), we can call it a unique container. If content is inherited at all, it is not a Unique container.
  2. Inherited Containers: Containers can also be inherited. When you inherit a container from someone else, you get its contents. If the author allows, you can open the container and add changes, while still inheriting the author's changes. This allows teams to work collaboratively.

Content nodes of containers are all children of the container. It is possible to have objects linked to containers or contents of containers without being inside, but this is not recommended. It is not possible to instance containers, but they can be copied, and then changes to one of the copies can be saved, and all containers can be reloaded, and all copies will inherit the changes. Many containers can point to the same definition.

In addition to the content, containers also govern what users of a container are allowed to do with the content if they inherit the container. This is called the container rules. At the moment, the only options are either no access (the user can only read in the content but make no modification) or edit in-place, which allows someone inheriting the container to modify the content and save the result, overwriting the original definition.

Containers can be closed, making the content uneditable. When a container is closed the content behaves like an xreffed scene, displayed and rendered but not selectable or editable.

+ Inheritance diagram for IContainerObject:

Public Member Functions

FPInterfaceDescGetDesc ()
 
virtual INodeGetContainerNode () const =0
 Returns the node containing this container object. More...
 
Content queries and modifications
virtual void GetContentNodes (bool nestedContainerNodes, INodeTab &contentNodes) const =0
 Returns the content nodes for this container. More...
 
virtual bool IsNodeInContent (INode *in_node, bool nestedContainerNodes) const =0
 Checks for content membership. More...
 
virtual bool IsNodeInInheritedContent (INode *in_node, bool nestedContainerNodes) const =0
 Checks for inherited content membership. More...
 
virtual bool AddNodeToContent (INode *in_node)=0
 Adds a node and its children to the container. More...
 
virtual bool AddNodesToContent (INodeTab &in_nodeTab)=0
 Adds several nodes to the container. More...
 
virtual bool RemoveNodeFromContent (INode *in_node, bool detach=true)=0
 Removes a node from the container. More...
 
Definition files.

Definition files have the format of a max file, but use a different file extension: .MAXC.

This is to allow users to distinguish container definitions from regular max scenes when browsing folders, and prevent mistaken edits of container definitions. It is possible to rename the container definition and open it as a MAX file. Local containers use a local definition file. Inherited containers reference a source definition file.

virtual MaxSDK::AssetManagement::AssetUser GetLocalDefinitionFileName () const =0
 Gets the local definition file for the container. More...
 
virtual bool SetLocalDefinitionFileName (const MaxSDK::AssetManagement::AssetUser &val)=0
 Sets the local definition file for the container. More...
 
virtual MaxSDK::AssetManagement::AssetUser GetSourceDefinitionFileName () const =0
 Gets the source definition file for the container. More...
 
virtual bool SetSourceDefinitionFileName (const MaxSDK::AssetManagement::AssetUser &val)=0
 Sets the source definition file for the container. More...
 
Definition file operations and content management
virtual bool SaveContainer (bool newFileName=false)=0
 Saves the current content and rules as the new definition. More...
 
virtual bool UpdateContainer ()=0
 Updates the content from its definition, preserving local modifications. More...
 
virtual bool UnloadContainer ()=0
 Saves the local definition and deletes the content from the scene. More...
 
virtual bool LoadContainer ()=0
 Reloads content from its definition and local modifications. Only available when unloaded. More...
 
virtual bool ReloadContainer ()=0
 Reloads content from its definition and local modifications. More...
 
virtual bool MergeSource ()=0
 Turns an inherited container into an unsaved local container, merging its content into the scene. More...
 
virtual bool MakeUnique ()=0
 Merges a container source, and recursively merges any nested container among its content. More...
 
Container status and rules.
virtual bool IsInherited () const =0
 Returns whether the container is inherited (or local) More...
 
virtual bool IsOpen () const =0
 Returns whether the container is open. More...
 
virtual bool SetOpen (bool isOpen)=0
 Opens or closes the container. More...
 
virtual bool IsContainerOpenableOrClosable () const =0
 Returns whether the open status of the container can be changed in its current state. More...
 
virtual bool IsUnloaded () const =0
 Returns whether the container is unloaded, that is, whether its content has been temporarily deleted. More...
 
virtual bool IsUnique () const =0
 Returns whether the container is unique, that is, whether it is local as well as any container it may contain. More...
 
virtual void AllowInPlaceEdit (bool allowEdit)=0
 Sets whether the container, when inherited, will allow editing in place. More...
 
virtual bool GetAllowInPlaceEdit () const =0
 Returns whether the container, when inherited, will allow editing in place. More...
 
virtual void SetEditInPlace (bool edit)=0
 Temporarily makes an inherited container that allows it to act like a local container. More...
 
virtual bool IsInPlaceEditing () const =0
 Returns whether the container is currently editing in place. More...
 
virtual bool CanEditInPlace () const =0
 For an imported container, returns whether it allows editing in place. More...
 
virtual void SetAutoUpdateClosed (bool setAutoUpdate)=0
 Sets whether the container will automatically update if it is closed and its definition is updated. More...
 
virtual bool AutoUpdateClosed () const =0
 Returns whether the container will automatically update if it is closed and its definition is updated. More...
 
Display properties of the container helper.
virtual void SetLabelDisplay (bool display)=0
 Sets whether the container displays its name in the viewport. More...
 
virtual bool GetLabelDisplay () const =0
 Returns whether the container displays its name in the viewport. More...
 
virtual void UseContentBoundingBox (bool useContent)=0
 Sets whether the bounding box for the container object will be extended to encompass all of its content. More...
 
virtual bool IsUsingContentBoundingBox () const =0
 Returns whether the bounding box for the container object will be extended to encompass all of its content. More...
 
virtual void SetOverrideNodeProperties (bool setOverride)=0
 Sets whether the container overrides the object properties (wire color, hidden status etc) of its content. More...
 
virtual bool OverrideNodeProperties () const =0
 Returns whether the container overrides the object properties (wire color, hidden status etc) of its content. More...
 
virtual void SetSize (float size, TimeValue t=0)=0
 Sets the size of the container helper object. More...
 
virtual float GetSize (TimeValue t=0) const =0
 Returns the size of the container helper. More...
 
- Public Member Functions inherited from FPMixinInterface
 FPMixinInterface ()
 
virtual LifetimeType LifetimeControl ()
 
virtual CoreExport bool RegisterNotifyCallback (InterfaceNotifyCallback *incb)
 
virtual void UnRegisterNotifyCallback (InterfaceNotifyCallback *incb)
 
CoreExport ~FPMixinInterface ()
 
virtual BaseInterfaceGetInterface (Interface_ID id)
 
virtual FPInterfaceDescGetDescByID (Interface_ID id)
 
virtual Interface_ID GetID ()
 
- Public Member Functions inherited from FPInterface
virtual CoreExport FPStatus Invoke (FunctionID fid, TimeValue t=0, FPParams *params=NULL)
 
virtual FPStatus Invoke (FunctionID fid, FPParams *params)
 
virtual CoreExport FPStatus Invoke (FunctionID fid, TimeValue t, FPValue &result, FPParams *params=NULL)
 
virtual FPStatus Invoke (FunctionID fid, FPValue &result, FPParams *params=NULL)
 
virtual CoreExport FunctionID FindFn (const MCHAR *name)
 
virtual CoreExport BOOL IsEnabled (FunctionID actionID)
 
virtual CoreExport BOOL IsChecked (FunctionID actionID)
 
virtual CoreExport BOOL IsVisible (FunctionID actionID)
 
virtual CoreExport FunctionID GetIsEnabled (FunctionID actionID)
 
virtual CoreExport FunctionID GetIsChecked (FunctionID actionID)
 
virtual CoreExport FunctionID GetIsVisible (FunctionID actionID)
 
virtual ActionTableGetActionTable ()
 
virtual void EnableActions (BOOL onOff)
 
- Public Member Functions inherited from BaseInterface
virtual UtilExport ~BaseInterface ()
 Destructor. More...
 
virtual BaseInterfaceAcquireInterface ()
 
virtual void ReleaseInterface ()
 
virtual void DeleteInterface ()
 
virtual BaseInterfaceCloneInterface (void *remapDir=NULL)
 
- Public Member Functions inherited from InterfaceServer
virtual UtilExport ~InterfaceServer ()
 Destructor. More...
 

Static Public Member Functions

static IContainerObjectGetInterface (Animatable *anim)
 If the Animatable supports the IContainerObject interface, returns a pointer to it. More...
 
- Static Public Member Functions inherited from MaxHeapOperators
static UtilExport voidoperator new (size_t size)
 Standard new operator used to allocate objects If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new (size_t size, const std::nothrow_t &e)
 Standard new operator used to allocate objects if there is insufficient memory, NULL will be returned. More...
 
static UtilExport voidoperator new (size_t size, const char *filename, int line)
 New operator used to allocate objects that takes the filename and line number where the new was called If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new (size_t size, int block_type, const char *filename, int line)
 New operator used to allocate objects that takes the type of memory, filename and line number where the new was called If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new (size_t size, const std::nothrow_t &e, const char *filename, int line)
 New operator used to allocate objects that takes the filename and line number where the new was called If there is insufficient memory, NULL will be returned. More...
 
static UtilExport voidoperator new (size_t size, unsigned long flags)
 New operator used to allocate objects that takes extra flags to specify special operations If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new (size_t size, const std::nothrow_t &e, unsigned long flags)
 New operator used to allocate objects that takes extra flags to specify special operations If there is insufficient memory, NULL will be returned. More...
 
static UtilExport voidoperator new[] (size_t size)
 New operator used to allocate arrays of objects If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new[] (size_t size, const std::nothrow_t &e)
 New operator used to allocate arrays of objects If there is insufficient memory, NULL will be returned. More...
 
static UtilExport voidoperator new[] (size_t size, const char *filename, int line)
 New operator used to allocate arrays of objects If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new[] (size_t size, int block_type, const char *filename, int line)
 New operator used to allocate arrays of objects. More...
 
static UtilExport voidoperator new[] (size_t size, const std::nothrow_t &e, const char *filename, int line)
 New operator used to allocate arrays of objects If there is insufficient memory, NULL will be returned. More...
 
static UtilExport voidoperator new[] (size_t size, unsigned long flags)
 New operator used to allocate arrays of objects If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new[] (size_t size, const std::nothrow_t &e, unsigned long flags)
 New operator used to allocate arrays of objects If there is insufficient memory, NULL will be returned. More...
 
static UtilExport void operator delete (void *ptr)
 Standard delete operator used to deallocate an object If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete (void *ptr, const std::nothrow_t &e)
 Standard delete operator used to deallocate an object If the pointer is invalid, nothing will happen. More...
 
static UtilExport void operator delete (void *ptr, const char *filename, int line)
 Delete operator used to deallocate an object that takes the filename and line number where the delete was called If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete (void *ptr, int block_type, const char *filename, int line)
 Delete operator used to deallocate an object that takes the type of memory, filename and line number where the delete was called If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete (void *ptr, const std::nothrow_t &e, const char *filename, int line)
 Delete operator used to deallocate an object that takes the filename and line number where the delete was called If the pointer is invalid, nothing will happen. More...
 
static UtilExport void operator delete (void *ptr, unsigned long flags)
 Delete operator used to deallocate an object that takes extra flags to specify special operations If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete (void *ptr, const std::nothrow_t &e, unsigned long flags)
 Delete operator used to deallocate an object that takes extra flags to specify special operations If the pointer is invalid, nothing will happen. More...
 
static UtilExport void operator delete[] (void *ptr)
 Standard delete operator used to deallocate an array of objects If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete[] (void *ptr, const std::nothrow_t &e)
 Standard delete operator used to deallocate an array of objects If the pointer is invalid, nothing will happen. More...
 
static UtilExport void operator delete[] (void *ptr, const char *filename, int line)
 Delete operator used to deallocate an array of objects that takes the filename and line number where the delete was called If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete[] (void *ptr, int block_type, const char *filename, int line)
 Delete operator used to deallocate an array of objects that takes the type of memory, filename and line number where the delete was called If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete[] (void *ptr, const std::nothrow_t &e, const char *filename, int line)
 Delete operator used to deallocate an array of objects that takes the filename and line number where the delete was called If the pointer is invalid, nothing will happen. More...
 
static UtilExport void operator delete[] (void *ptr, unsigned long flags)
 Delete operator used to deallocate an array of objects that takes extra flags to specify special operations If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete[] (void *ptr, const std::nothrow_t &e, unsigned long flags)
 Delete operator used to deallocate an array of objects that takes extra flags to specify special operations If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport voidoperator new (size_t size, void *placement_ptr)
 Placement new operator. More...
 
static UtilExport void operator delete (void *ptr, void *placement_ptr)
 Placement delete operator. More...
 
static UtilExport voidaligned_malloc (size_t size, size_t alignment)
 Allocates memory on a specified alignment boundary. More...
 
static UtilExport voidaligned_realloc (void *ptr, size_t size, size_t alignment)
 Reallocates memory on a specified alignment boundary. More...
 
static UtilExport void aligned_free (void *ptr)
 Frees a block of memory that was allocated with aligned_malloc/aligned_realloc. More...
 

Additional Inherited Members

- Public Types inherited from BaseInterface
enum  LifetimeType { noRelease, immediateRelease, wantsRelease, serverControlled }
 
- Static Public Attributes inherited from FPInterface
static CoreExport FPInterfaceDesc nullInterface
 
- Protected Member Functions inherited from FPMixinInterface
 FPMixinInterface (const FPMixinInterface &rhs)
 
FPMixinInterfaceoperator= (const FPMixinInterface &rhs)
 
- Protected Member Functions inherited from FPInterface
virtual FPStatus _dispatch_fn (FunctionID fid, TimeValue t, FPValue &result, FPParams *p)
 
- Protected Attributes inherited from FPMixinInterface
Tab< InterfaceNotifyCallback * > * interfaceNotifyCBs
 

Member Function Documentation

FPInterfaceDesc* GetDesc ( )
virtual
Remarks
Returns a pointer to the class which contains the interface metadata.

Implements FPInterface.

virtual INode* GetContainerNode ( ) const
pure virtual

Returns the node containing this container object.

Remarks
There can only be one node since we cannot create instances of container objects
virtual void GetContentNodes ( bool  nestedContainerNodes,
INodeTab contentNodes 
) const
pure virtual

Returns the content nodes for this container.

Parameters
[in]nestedContainerNodes- if true include nested content
[out]contentNodes- returned content nodes
virtual bool IsNodeInContent ( INode in_node,
bool  nestedContainerNodes 
) const
pure virtual

Checks for content membership.

Returns
- true if the node is part of the content.
Parameters
[in]in_node- node to check for membership
[in]nestedContainerNodes- include nested containers child nodes when checking
virtual bool IsNodeInInheritedContent ( INode in_node,
bool  nestedContainerNodes 
) const
pure virtual

Checks for inherited content membership.

Returns
- true if the node is part of the inherited content.
Parameters
[in]in_node- node to check for membership
[in]nestedContainerNodes- check content of nested containers
virtual bool AddNodeToContent ( INode in_node)
pure virtual

Adds a node and its children to the container.

The container node becomes the parent of the content node. Some nodes are automatically added to the local content along with the input node. The children of the node are added. If the node is part of a system [like biped or bones], all nodes in the system are also added. If the node has a target [as in INode::GetTarget() - for instance a camera target], then its target is added and if it is a target, the targeting node is also added

See also
RemoveNodeFromContent
Returns
- true if the node was added.
Parameters
[in]in_node- node to add to the container
virtual bool AddNodesToContent ( INodeTab in_nodeTab)
pure virtual

Adds several nodes to the container.

See also
AddNodeToContent
Returns
- true if all nodes were added.
Parameters
[in]in_nodeTab- array of nodes to add to the container
virtual bool RemoveNodeFromContent ( INode in_node,
bool  detach = true 
)
pure virtual

Removes a node from the container.

Some nodes are automatically removed along with the input node. The children of the node are removed. If the node is part of a system, all nodes in the system are also removed. If the node has a target, its target is removed and if it is a target, the targeting node is also removed

See also
AddNodeToContent
Returns
- true if the node was removed from local content.
Parameters
[in]in_node- node to remove from the container
[in]detach- whether or not the removed node should also be unlinked from its parent
virtual MaxSDK::AssetManagement::AssetUser GetLocalDefinitionFileName ( ) const
pure virtual

Gets the local definition file for the container.

If the container is inherited, the name is empty

virtual bool SetLocalDefinitionFileName ( const MaxSDK::AssetManagement::AssetUser val)
pure virtual

Sets the local definition file for the container.

virtual MaxSDK::AssetManagement::AssetUser GetSourceDefinitionFileName ( ) const
pure virtual

Gets the source definition file for the container.

If the container is local, the name is empty

virtual bool SetSourceDefinitionFileName ( const MaxSDK::AssetManagement::AssetUser val)
pure virtual

Sets the source definition file for the container.

virtual bool SaveContainer ( bool  newFileName = false)
pure virtual

Saves the current content and rules as the new definition.

If there is no definition file name, the user will be prompted for one.

Parameters
[in]newFileName- if true, prompt the user for a definition file name
virtual bool UpdateContainer ( )
pure virtual

Updates the content from its definition, preserving local modifications.

virtual bool UnloadContainer ( )
pure virtual

Saves the local definition and deletes the content from the scene.

virtual bool LoadContainer ( )
pure virtual

Reloads content from its definition and local modifications. Only available when unloaded.

virtual bool ReloadContainer ( )
pure virtual

Reloads content from its definition and local modifications.

Same as load but is always available. Discards unsaved local changes.

virtual bool MergeSource ( )
pure virtual

Turns an inherited container into an unsaved local container, merging its content into the scene.

virtual bool MakeUnique ( )
pure virtual

Merges a container source, and recursively merges any nested container among its content.

virtual bool IsInherited ( ) const
pure virtual

Returns whether the container is inherited (or local)

virtual bool IsOpen ( ) const
pure virtual

Returns whether the container is open.

virtual bool SetOpen ( bool  isOpen)
pure virtual

Opens or closes the container.

Depending on the container state, this may not be allowed

Returns
- the open state of the container after the operation.
virtual bool IsContainerOpenableOrClosable ( ) const
pure virtual

Returns whether the open status of the container can be changed in its current state.

virtual bool IsUnloaded ( ) const
pure virtual

Returns whether the container is unloaded, that is, whether its content has been temporarily deleted.

virtual bool IsUnique ( ) const
pure virtual

Returns whether the container is unique, that is, whether it is local as well as any container it may contain.

virtual void AllowInPlaceEdit ( bool  allowEdit)
pure virtual

Sets whether the container, when inherited, will allow editing in place.

Editing in place is a container rule that allows a user to temporarily turn an inherited container into a local container and change its definition. You can now set more rules than just edit in place.

See also
IContainerObject13::SetAccessType
Parameters
[in]allowEdit- whether the container, when inherited, will allow editing in place
virtual bool GetAllowInPlaceEdit ( ) const
pure virtual

Returns whether the container, when inherited, will allow editing in place.

virtual void SetEditInPlace ( bool  edit)
pure virtual

Temporarily makes an inherited container that allows it to act like a local container.

virtual bool IsInPlaceEditing ( ) const
pure virtual

Returns whether the container is currently editing in place.

virtual bool CanEditInPlace ( ) const
pure virtual

For an imported container, returns whether it allows editing in place.

virtual void SetAutoUpdateClosed ( bool  setAutoUpdate)
pure virtual

Sets whether the container will automatically update if it is closed and its definition is updated.

Otherwise a manual Update or Reload is needed.

virtual bool AutoUpdateClosed ( ) const
pure virtual

Returns whether the container will automatically update if it is closed and its definition is updated.

virtual void SetLabelDisplay ( bool  display)
pure virtual

Sets whether the container displays its name in the viewport.

virtual bool GetLabelDisplay ( ) const
pure virtual

Returns whether the container displays its name in the viewport.

virtual void UseContentBoundingBox ( bool  useContent)
pure virtual

Sets whether the bounding box for the container object will be extended to encompass all of its content.

virtual bool IsUsingContentBoundingBox ( ) const
pure virtual

Returns whether the bounding box for the container object will be extended to encompass all of its content.

virtual void SetOverrideNodeProperties ( bool  setOverride)
pure virtual

Sets whether the container overrides the object properties (wire color, hidden status etc) of its content.

virtual bool OverrideNodeProperties ( ) const
pure virtual

Returns whether the container overrides the object properties (wire color, hidden status etc) of its content.

virtual void SetSize ( float  size,
TimeValue  t = 0 
)
pure virtual

Sets the size of the container helper object.

virtual float GetSize ( TimeValue  t = 0) const
pure virtual

Returns the size of the container helper.

static IContainerObject* GetInterface ( Animatable anim)
inlinestatic

If the Animatable supports the IContainerObject interface, returns a pointer to it.

Parameters
[in]anim- Animatable to be tested for support of the IContainer interface
Returns
- a pointer to an IContainer interface, or NULL.
245  {
246  return anim? static_cast<IContainerObject*>(anim->GetInterface(IID_CONTAINER)): NULL;}
#define IID_CONTAINER
Definition: IContainerObject.h:32
#define NULL
Definition: autoptr.h:18
virtual CoreExport void * GetInterface(ULONG id)
Container Interface.
Definition: IContainerObject.h:82