Interface: InstanceMgr

Interfaces > Core Interfaces > InstanceMgr

 

   

Core Interfaces - Quick Navigation

The Instance Manager Core Interface provides access to properties and methods related to Instanced Nodes. It provides means for collecting instances, managing material propagation to instances, making instanced modifiers, controllers and nodes unique etc.

   

Properties:

InstanceMgr.autoMtlPropagation : boolean : Read|Write 	 

When set to True , Materials assigned to an object will propagate automatically to all its instances.

   

Methods:

<DWORD>InstanceMgr.GetInstances <node>source <&node array>instances   

instances is Out parameter 

Returns the number of instances of the specified source node and the list of all instances in the by-reference Out parameter.

FOR EXAMPLE:

tp = Teapot() --create a teapot
--> $Teapot:Teapot01 @ [0.000000,0.000000,0.000000]
tp1 = instance tp --instance the teapot
--> $Teapot:Teapot02 @ [0.000000,0.000000,0.000000]
tp2 = instance tp --instance it again
--> $Teapot:Teapot03 @ [0.000000,0.000000,0.000000]
tp3 = copy tp --copy the teapot
--> $Teapot:Teapot04 @ [0.000000,0.000000,0.000000]
InstanceMgr.GetInstances tp &instances -- get the instances of the original
--> 3
instances --show the returned array- all instances are there, the copy isn't
--> #($Teapot:Teapot03 @ [0.000000,0.000000,0.000000], $Teapot:Teapot02 @ [0.000000,0.000000,0.000000], $Teapot:Teapot01 @ [0.000000,0.000000,0.000000])
InstanceMgr.GetInstances tp3 &instances --get the instances of the copy
--> 1
instances -- show the returned array - the copy is the only object in it
--> #($Teapot:Teapot04 @ [0.000000,0.000000,0.000000])

   

<DWORD> InstanceMgr.SetMtlOnInstances <node>source <material>newMtl 

Propagates the supplied new material to all instances of the specified source node. Normally, instances can have independent materials. Using this method, all instances can be updated to use the same material. Returns the number of instances.

FOR EXAMPLE:

tp = Teapot() --create a teapot
--> $Teapot:Teapot01 @ [0.000000,0.000000,0.000000]
tp.material = standard diffuse:(color 255 0 0) --assign a red material
--> Standardmaterial:Standard
tp1 = instance tp --create an instance
--> $Teapot:Teapot02 @ [0.000000,0.000000,0.000000]
tp1.pos = [100,0,0] --move the instance
--> [100,0,0]
tp1.material = standard diffuse:(color 0 255 0) --assign a green material
--> Standardmaterial:Standard
tp2 = instance tp --create another instance
--> $Teapot:Teapot03 @ [0.000000,0.000000,0.000000]
tp2.pos = [200,0,0] --move the instance
--> [200,0,0]
tp2.material = standard diffuse:(color 0 0 255) --assign a blue material
--> Standardmaterial:Standard
newMaterial = standard diffuse:(color 250 255 255) --create a white material
--> Standardmaterial:Standard

InstanceMgr.SetMtlOnInstances tp newMaterial --assign to all instances 3 --3 object affected! 

   

<bool>InstanceMgr.MakeObjectsUnique <&node array>nodes <enum>multiNodeOption 

nodes is In parameter 
multiNodeOption enums: {#prompt | #individual | #group} 

Makes the objects passed by-reference unique. Returns True on success.

FOR EXAMPLE:

tp = Teapot() --create a teapot
--> $Teapot:Teapot01 @ [0.000000,0.000000,0.000000]
tp1 = instance tp --instance the trapot
--> $Teapot:Teapot02 @ [0.000000,0.000000,0.000000]
tp2 = instance tp --instance it once again
--> $Teapot:Teapot03 @ [0.000000,0.000000,0.000000]
InstanceMgr.GetInstances tp &instances --get all instances
--> 3
--make the instances unique. Show a prompt to confirm the operation
InstanceMgr.MakeObjectsUnique &instances #prompt
--> true
--Check that every object is an instance of itself only.
InstanceMgr.GetInstances tp &instances
--> 1
InstanceMgr.GetInstances tp1 &instances
--> 1
InstanceMgr.GetInstances tp2 &instances
--> 1

   

<bool>CanMakeObjectsUnique <&node array>nodes 

nodes is In parameter 

Returns True when the specified nodes can be made unique, False otherwise.

FOR EXAMPLE:

tp = Teapot() --create a teapot
--> $Teapot:Teapot01 @ [0.000000,0.000000,0.000000]
tp1 = instance tp --instance the teapot
--> $Teapot:Teapot02 @ [0.000000,0.000000,0.000000]
tp2 = copy tp --copy the teapot
--> $Teapot:Teapot03 @ [0.000000,0.000000,0.000000]
--Check if the two instances can be made unique - they can
InstanceMgr.CanMakeObjectsUnique #(tp,tp1)
--> True
--Check the original and the copy - not instances, cannot be made unique
InstanceMgr.CanMakeObjectsUnique #(tp,tp2)
--> False

   

<bool>InstanceMgr.MakeModifiersUnique <&node array>nodes <&maxObject array>modifiers <enum>multiNodeOption 

nodes is In parameter 
modifiers is In parameter 
multiNodeOption enums: {#prompt | #individual | #group} 

Makes the specified modifiers of the supplied nodes unique. Returns True on success.

   

<bool>InstanceMgr.CanMakeModifiersUnique <&node array>nodes <&maxObject array>modifiers 

nodes is In parameter 
modifiers is In parameter 

Returns True when the specified modifiers of the supplied nodes can be made unique, False otherwise.

   

<bool>MakeControllersUnique <&node array>nodes <&maxObject array>controllers <enum>multiNodeOption 

nodes is In parameter 
controllers is In parameter 
multiNodeOption enums: {#prompt | #individual | #group} 

Makes the specified controllers of the supplied nodes unique. Returns True on success.

   

<bool>InstanceMgr.CanMakeControllersUnique <&node array>nodes <&maxObject array>controllers 

nodes is In parameter 
controllers is In parameter 

Returns True when the specified controllers of the supplied nodes can be made unique, False otherwise.

   

See Also