IInstanceMgr Class Reference

#include <iInstanceMgr.h>

Class Description

Manages instances of objects, modifiers, transformation controllers Use this interface to work with object instances in a Max scene.

There are several criteria based on which two or more objects must be considered instances of each other. This interface abstracts the details of dealing with them and thus help client code focus on the specific tasks it needs to perform on object instances, rather than on the logic of finding them. Two or more objects are considered instances of each other if:

  • They are regular Max instances or references (their nodes reference the same DerivedObject)
  • Are part of the same style (this applies to Max objects resulted from importing a DWG drawing that contains style information. See IADTObjMgr for more information on styles.)
  • Represent instances of the same block (this applies to Max objects resulted from importing a DWG drawing that contains block instances. See IBlockMgr for more information on blocks.)
See also
IADTObjMgr, IBlockMgr
+ Inheritance diagram for IInstanceMgr:

Public Member Functions

virtual unsigned long GetInstances (INode &source, INodeTab &instances) const =0
 Retrieves instances and references of an object. More...
 
virtual unsigned long SetMtlOnInstances (INode &source, Mtl *newMtl)=0
 Sets the provided material on all instances of a given object. More...
 
Automatic material propagation to instances of objects

When automatic material propagation to object instances is On, materials assigned to an object via all means (UI, maxscript, SDK) will be automatically propagated to all instances and references of that object.

No user confirmation is be required. When Off, material assignments to an object won't get propagated to the object's instances and references. The material of an instance can be still propagated by calling the SetMtlOnInstances method.

The initial value of automatic material propagation can be set through the AutomaticMtlPropagation setting, in the InstanceMgr section of the application's .ini file. When the application closes, the current value of this settings saved in the .ini file by the system.

virtual bool GetAutoMtlPropagation () const =0
 Retrieves state of automatic material propagation flag. More...
 
virtual bool SetAutoMtlPropagation (bool autoPropagate)=0
 Sets automatic material propagation flag. More...
 
Making instances unique

Methods for making base objects, derived objects, individual modifier and transform controllers of a given set of nodes unique.

virtual bool CanMakeObjectsUnique (INodeTab &tabNodes) const =0
 Determines whether the given objects can be made unique. More...
 
virtual bool MakeObjectsUnique (INodeTab &tabNodes, int iMultiNodeOption=INSTANCE_MGR_MAKE_UNIQUE_PROMPT) const =0
 Makes the given objects unique. More...
 
virtual bool CanMakeModifiersUnique (INodeTab &tabNodes, Tab< ReferenceTarget * > &tabMods) const =0
 Determines whether the given modifiers can be made unique. More...
 
virtual bool MakeModifiersUnique (INodeTab &tabNodes, Tab< ReferenceTarget * > &tabMods, int iMultiNodeOption=INSTANCE_MGR_MAKE_UNIQUE_PROMPT) const =0
 Makes the given modifiers unique. More...
 
virtual bool CanMakeControllersUnique (INodeTab &tabNodes, Tab< ReferenceTarget * > &tabConts) const =0
 Determines whether the given transform controllers can be made unique. More...
 
virtual bool MakeControllersUnique (INodeTab &tabNodes, Tab< ReferenceTarget * > &tabConts, int iMultiNodeOption=INSTANCE_MGR_MAKE_UNIQUE_PROMPT) const =0
 Makes the given transform controllers unique. More...
 
File IO

Methods for persisting the state of the instance manager.

virtual IOResult Save (ISave *isave) const =0
 Saves instance manager state. More...
 
virtual IOResult Load (ILoad *iload)=0
 Loads instance manager state. More...
 
- Public Member Functions inherited from FPInterfaceDesc
CoreExport FPInterfaceDesc ()
 
CoreExport FPInterfaceDesc (Interface_ID id, const MCHAR *int_name, StringResID descr, ClassDesc *cd, ULONG flag,...)
 
CoreExport ~FPInterfaceDesc ()
 
virtual void Init ()
 
LifetimeType LifetimeControl ()
 
virtual BaseInterfaceGetInterface (Interface_ID id)
 
CoreExport void LoadDescriptor (Interface_ID id, const MCHAR *int_name, StringResID descr, ClassDesc *pCD, ULONG flag,...)
 
CoreExport void AppendFunction (int id,...)
 Add a new function to this interface descriptor. More...
 
CoreExport void AppendProperty (int id,...)
 Add a new property to this interface descriptor. More...
 
CoreExport void AppendEnum (int id,...)
 Add a new enum to this interface descriptor. More...
 
CoreExport void SetClassDesc (ClassDesc *i_cd)
 
CoreExport va_list check_fn (va_list ap, int id)
 
CoreExport va_list scan_fn (va_list ap, int id, int index)
 
CoreExport va_list check_prop (va_list ap, int id)
 
CoreExport va_list scan_prop (va_list ap, int id, int index)
 
CoreExport va_list check_enum (va_list ap, EnumID id)
 
CoreExport va_list scan_enum (va_list ap, EnumID id, int index)
 
FPInterfaceDescGetDesc ()
 
Interface_ID GetID ()
 
CoreExport FPFunctionDefGetFnDef (FunctionID fid)
 
ActionTableGetActionTable ()
 
CoreExport void EnableActions (BOOL onOff)
 
virtual CoreExport HINSTANCE HInstance ()
 
virtual CoreExport const MCHARGetRsrcString (StringResID id)
 
- 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)
 
- Public Member Functions inherited from BaseInterface
virtual UtilExport ~BaseInterface ()
 Destructor. More...
 
virtual bool RegisterNotifyCallback (InterfaceNotifyCallback *incb)
 
virtual void UnRegisterNotifyCallback (InterfaceNotifyCallback *incb)
 
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 IInstanceMgrGetInstanceMgr ()
 Retrieves the single instance of the instance manager. 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 }
 
- Public Attributes inherited from FPInterfaceDesc
Interface_ID ID
 
MSTR internal_name
 
StringResID description
 
ClassDesccd
 
USHORT flags
 
Tab< FPFunctionDef * > functions
 
Tab< FPPropDef * > props
 
Tab< FPEnum * > enumerations
 
MSPluginClass * pc
 
Rolloutrollout
 
ActionTableaction_table
 
- Static Public Attributes inherited from FPInterface
static CoreExport FPInterfaceDesc nullInterface
 
- Protected Member Functions inherited from FPInterfaceDesc
CoreExport void load_descriptor (Interface_ID id, const MCHAR *int_name, StringResID descr, ClassDesc *cd, USHORT flag, va_list ap)
 
- Protected Member Functions inherited from FPInterface
virtual FPStatus _dispatch_fn (FunctionID fid, TimeValue t, FPValue &result, FPParams *p)
 

Member Function Documentation

virtual unsigned long GetInstances ( INode source,
INodeTab instances 
) const
pure virtual

Retrieves instances and references of an object.

Instances of styles and blocks are collected only if IADTObjMgr and IBlockMgr interfaces are available.

Parameters
[in]sourceThe node of the object whose instances are to be retrieved. For an object with multiple instances, any of the nodes representing an instance can be specified here as a parameter.
[in,out]instancesCollection of nodes representing the instances of source The collection is cleared before this method starts filling it in. The source node is also included in this collection since every object can be thought of as having at least one instance.
Returns
The number of instances found. There's always at least 1 instance found
virtual unsigned long SetMtlOnInstances ( INode source,
Mtl newMtl 
)
pure virtual

Sets the provided material on all instances of a given object.

Parameters
[in]sourceThe node of the object whose instances should be set up with the specified material. For an object with multiple instances, any of the nodes representing an instance can be specified as this parameter.
[in]newMtlThe material to be set. If NULL, all instances of the source object will have their materials removed.
Returns
The number of instances found.
virtual bool GetAutoMtlPropagation ( ) const
pure virtual

Retrieves state of automatic material propagation flag.

Returns
true if automatic material propagation is On, false otherwise.
virtual bool SetAutoMtlPropagation ( bool  autoPropagate)
pure virtual

Sets automatic material propagation flag.

Parameters
[in]autoPropagatepass true to turn On automatic material propagation, false otherwise.
Returns
The previous state of the automatic material propagation flag.
virtual bool CanMakeObjectsUnique ( INodeTab tabNodes) const
pure virtual

Determines whether the given objects can be made unique.

Parameters
[in]tabNodesThe nodes representing the objects to be made unique.
Returns
true if at least one object can be made unique.
virtual bool MakeObjectsUnique ( INodeTab tabNodes,
int  iMultiNodeOption = INSTANCE_MGR_MAKE_UNIQUE_PROMPT 
) const
pure virtual

Makes the given objects unique.

Parameters
[in]tabNodesThe nodes representing the objects to be made unique.
[in]iMultiNodeOptionSpecifies the method to use when making objects unique.
Returns
true if at least one object was made unique
virtual bool CanMakeModifiersUnique ( INodeTab tabNodes,
Tab< ReferenceTarget * > &  tabMods 
) const
pure virtual

Determines whether the given modifiers can be made unique.

Parameters
[in]tabNodesThe nodes the modifiers are being applied to.
[in]tabModsThe modifiers to be made unique.
Returns
true if at least one modifier can be made unique.
virtual bool MakeModifiersUnique ( INodeTab tabNodes,
Tab< ReferenceTarget * > &  tabMods,
int  iMultiNodeOption = INSTANCE_MGR_MAKE_UNIQUE_PROMPT 
) const
pure virtual

Makes the given modifiers unique.

Parameters
[in]tabNodesThe nodes the modifiers are applied to.
[in]tabModsThe modifiers to be made unique.
[in]iMultiNodeOptionSpecifies the method to use when making modifiers unique.
Returns
true if at least one modifier was made unique
virtual bool CanMakeControllersUnique ( INodeTab tabNodes,
Tab< ReferenceTarget * > &  tabConts 
) const
pure virtual

Determines whether the given transform controllers can be made unique.

Parameters
[in]tabNodesThe nodes the controller are applied to.
[in]tabContsThe controllers to be made unique.
Returns
true if at least one controller can be made unique.
virtual bool MakeControllersUnique ( INodeTab tabNodes,
Tab< ReferenceTarget * > &  tabConts,
int  iMultiNodeOption = INSTANCE_MGR_MAKE_UNIQUE_PROMPT 
) const
pure virtual

Makes the given transform controllers unique.

Parameters
[in]tabNodesThe nodes the controllers are applied to.
[in]tabContsThe controllers to be made unique.
[in]iMultiNodeOptionSpecifies the method to use when making controllers unique.
Returns
true if at least one controller was made unique
virtual IOResult Save ( ISave isave) const
pure virtual

Saves instance manager state.

This method is called by the system.

virtual IOResult Load ( ILoad iload)
pure virtual

Loads instance manager state.

This method is called by the system.

static IInstanceMgr* GetInstanceMgr ( )
inlinestatic

Retrieves the single instance of the instance manager.

191  {
193  }
Manages instances of objects, modifiers, transformation controllers Use this interface to work with o...
Definition: iInstanceMgr.h:57
#define INSTANCE_MGR_INTERFACE
Definition: iInstanceMgr.h:24
CoreExport Interface * GetCOREInterface()