インタフェース > コア インタフェース > InstanceMgr |
Instance Manager インタフェース によって、インスタンス化されたノードに関連するプロパティとメソッドにアクセスできます。ここでは、インスタンスを収集したり、マテリアルのインスタンスへの伝播を管理したり、インスタンス化されたモディファイヤ、コントローラ、およびノードを一意にするための方法などが提供されています。
プロパティ:
InstanceMgr.autoMtlPropagation : boolean : Read|Write
True に設定した場合、オブジェクトに割り当てられたマテリアルが自動的にすべてのインスタンスに伝播します。
メソッド:
<DWORD>InstanceMgr.GetInstances <node>source <&node array>instances instances is Out parameter
指定したソース ノードのインスタンスの数と、参照出力パラメータ内のすべてのインスタンスのリストを返します。
例: |
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]) |
-- Note that this code works only if the selection set ($) is not empty InstanceMgr.GetInstances $ &rptInstances trueInstances = for n in rptInstances where (areNodesInstances $ n) collect n
<DWORD> InstanceMgr.SetMtlOnInstances <node>source <material>newMtl
指定した新しいマテリアルを、指定したソース ノードのインスタンスに伝播します。通常、インスタンスは独立したマテリアルを持つことができます。このメソッドを使用すれば、同じマテリアルを使用するためにすべてのインスタンスを更新できます。インスタンスの数を返します。
例: |
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}
参照渡しのオブジェクトを一意にします。成功した場合は True を返します。
例: |
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
指定されたノードを一意にできる場合は True を、それ以外の場合は False を返します。
例: |
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}
与えられたノードの指定したモディファイヤを一意にします。 成功した場合は True を返します。
<bool>InstanceMgr.CanMakeModifiersUnique <&node array>nodes <&maxObject array>modifiers nodes is In parameter modifiers is In parameter
与えられたノードの指定のモディファイヤを一意にできる場合は True を、それ以外の場合は False を返します。
<bool>MakeControllersUnique <&node array>nodes <&maxObject array>controllers <enum>multiNodeOption nodes is In parameter controllers is In parameter multiNodeOption enums: {#prompt | #individual | #group}
与えられたノードの指定したコントローラを一意にします。正常に終了した場合は 成功した場合は True を返します。
<bool>InstanceMgr.CanMakeControllersUnique <&node array>nodes <&maxObject array>controllers nodes is In parameter controllers is In parameter
与えられたノードの指定のコントローラを一意にできる場合は True を、それ以外の場合は False を返します。