Public Member Functions | Static Public Member Functions

IInstanceMgr Class Reference

This reference page is linked to from the following overview topics: Getting the Nodes that Reference an Object.


Search for all occurrences

Detailed 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:

See also:
IADTObjMgr, IBlockMgr

#include <iInstanceMgr.h>

Inheritance diagram for IInstanceMgr:
Inheritance graph
[legend]

List of all members.

Public Member Functions

virtual unsigned long  GetInstances (INode &source, INodeTab &instances) const =0
  Retrieves instances and references of an object.
virtual unsigned long  SetMtlOnInstances (INode &source, Mtl *newMtl)=0
  Sets the provided material on all instances of a given object.
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.
virtual bool  SetAutoMtlPropagation (bool autoPropagate)=0
  Sets automatic material propagation flag.
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.
virtual bool  MakeObjectsUnique (INodeTab &tabNodes, int iMultiNodeOption=INSTANCE_MGR_MAKE_UNIQUE_PROMPT) const =0
  Makes the given objects unique.
virtual bool  CanMakeModifiersUnique (INodeTab &tabNodes, Tab< ReferenceTarget * > &tabMods) const =0
  Determines whether the given modifiers can be made unique.
virtual bool  MakeModifiersUnique (INodeTab &tabNodes, Tab< ReferenceTarget * > &tabMods, int iMultiNodeOption=INSTANCE_MGR_MAKE_UNIQUE_PROMPT) const =0
  Makes the given modifiers unique.
virtual bool  CanMakeControllersUnique (INodeTab &tabNodes, Tab< ReferenceTarget * > &tabConts) const =0
  Determines whether the given transform controllers can be made unique.
virtual bool  MakeControllersUnique (INodeTab &tabNodes, Tab< ReferenceTarget * > &tabConts, int iMultiNodeOption=INSTANCE_MGR_MAKE_UNIQUE_PROMPT) const =0
  Makes the given transform controllers unique.
File IO

Methods for persisting the state of the instance manager.

virtual IOResult  Save (ISave *isave) const =0
  Saves instance manager state.
virtual IOResult  Load (ILoad *iload)=0
  Loads instance manager state.

Static Public Member Functions

static IInstanceMgr GetInstanceMgr ()
  Retrieves the single instance of the instance manager.

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] source The 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] instances Collection 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] source The 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] newMtl The 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] autoPropagate pass 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] tabNodes The 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] tabNodes The nodes representing the objects to be made unique.
[in] iMultiNodeOption Specifies 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] tabNodes The nodes the modifiers are being applied to.
[in] tabMods The 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] tabNodes The nodes the modifiers are applied to.
[in] tabMods The modifiers to be made unique.
[in] iMultiNodeOption Specifies 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] tabNodes The nodes the controller are applied to.
[in] tabConts The 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] tabNodes The nodes the controllers are applied to.
[in] tabConts The controllers to be made unique.
[in] iMultiNodeOption Specifies 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 ( ) [inline, static]

Retrieves the single instance of the instance manager.

                                                {
            return static_cast<IInstanceMgr*>(GetCOREInterface(INSTANCE_MGR_INTERFACE));
        }

IInstanceMgr IInstanceMgr IInstanceMgr IInstanceMgr IInstanceMgr IInstanceMgr IInstanceMgr IInstanceMgr IInstanceMgr IInstanceMgr
IInstanceMgr IInstanceMgr IInstanceMgr IInstanceMgr IInstanceMgr IInstanceMgr IInstanceMgr IInstanceMgr IInstanceMgr IInstanceMgr