インタフェース > コア インタフェース > simpleFaceManager |
このコア インタフェースは、面ごとのデータ保存機能を提供します。3ds Max 9 以降で使用可能です。
メソッド:
<Interface>simpleFaceManager.addChannel <object>object type:<enum> id:<DWORD array> name:<string> object Validated by Validator function type enums: {#integer | #index | #float | #boolean | #point2 | #point3} type default value: #integer id default value: #() id Validated by Validator function name default value: undefined
指定されたタイプの指定されたオブジェクトに、ユーザ定義の ID および名前を使用して新しい面ごとのデータ チャネルを追加します。
ID は genClassID() メソッドを使用して生成することができ、スクリプト プラグインのクラス ID と同じ形式を使用します。
例 |
obj = Plane length:60.0 width:60.0 widthsegs: 1 lengthsegs: 2 convertto obj Editable_Poly idA = genClassID returnValue:true channelA = simpleFaceManager.AddChannel obj type: #integer id:idA channelA.name = "The Integer Channel" channelA.SetValues #(5,2) idB = genClassID returnValue:true channelB = simpleFaceManager.AddChannel obj type: #float id:idB channelB.name = "The Float Channel" channelB.SetValues #(3.1459,7.236) |
<void>simpleFaceManager.removeChannel <object>object <DWORD array>id id Validated by Validator function
指定された ID を持つチャネルを指定されたオブジェクトから削除します。
<Interface>simpleFaceManager.getChannel <object>object <DWORD array>id object Validated by Validator function id Validated by Validator function
指定されたオブジェクトから指定された ID を持つチャネルの simpleFaceChannel MixinInterface を返します。
例 |
--continuing from the previous example on this page: theInt = simpleFaceManager.getChannel obj idA |
<Interface by value array>simpleFaceManager.getChannels <object>object object Validated by Validator function
指定されたオブジェクトのすべてのチャネルの simpleFaceChannel MixinInterface の配列を返します。
例 |
--continuing from the previous example on this page: SimpleFaceManager.getChannels obj --> #(<MixinInterface:simpleFaceChannel>, <MixinInterface:simpleFaceChannel>) |
インタフェース: simpleFaceChannel
この MixinInterface は SimpleFaceData クラスによって公開され、指定したチャネル内の面ごとのデータに対するアクセスを提供します。
3ds Max 9 以降 で使用可能です。
プロパティ:
.name : string : Read|Write
データ チャネルの名前を取得/設定します。
.id : DWORD by value array : Read
チャネルの一意の ID を取得します。
.type : enum : Read type enums: {#integer|#index|#float|#boolean|#point2|#point3}
チャネル内に保管されているデータの型を取得します。
.numFaces : DWORD : Read
チャネル内の面またはポリゴンの数を取得します。
例 |
--continuing from the previous example on this page: theInt = simpleFaceManager.getChannel obj idA --> <MixinInterface:simpleFaceChannel> theInt.name --> "The Integer Channel" theInt.type --> #integer theInt.numfaces --> 2 |
メソッド:
<fpvalue by value>getValue <index>face face Validated by Validator function
インデックスで指定された面の値を取得します。
例 |
--continuing from the previous example: theInt.getValue 1 --> 5 theInt.getValue 2 --> 2 theInt.getValue 3 -- Runtime error: Invalid face index. |
<boolean>setValue <index>face <value>value face Validated by Validator function value Validated by Validator function
インデックスで指定された面の値を設定します。
例 |
--continuing from the previous example: theInt.setValue 1 6 --> true |
<fpvalue by value>getValues()
チャネルのすべての値を取得します。
例 |
--continuing from the previous example: theInt.getValues() --> #(6, 2) |
<boolean>setValues <value>values values Validated by Validator function
チャネルのすべての値を、指定された配列内の値に設定します。
例 |
--continuing from the previous example: theInt.setValues #(10,12) --> true theInt.getValues() --> #(10, 12) |
<fpvalue by value>getValueBySelection <bitArray>faces faces Validated by Validator function
bitArray 引数の設定ビットによって指定された面の値を取得します。指定されたすべての面に同じ値が含まれている場合は、その値を返します。指定された面に異なる値が含まれている場合は、undefined を返します。
例 |
--continuing from the previous example: theInt.getValueBySelection #{1} --> 10 theInt.getValueBySelection #{1..2} --> undefined |
<boolean>setValueBySelection <bitArray>faces <value>value faces Validated by Validator function value Validated by Validator function
bitArray 引数の設定ビットによって指定されたすべての面の値を、2 番目の引数で指定されたものと同じ値に設定します。
例 |
--continuing from the previous example: theInt.setValueBySelection #{1..2} 42 --> true theInt.getValues() --> #(42, 42) theInt.getValueBySelection #{1..2} --now we can the value of both faces! --> 42 |
トポロジを変更したりクラスを変換したりしても、面ごとのデータは保持されます。たとえば、上記の例の平面を編集可能メッシュに変換する場合は、チャネルは維持されますが、新しいメッシュ内の 4 つの面はそれぞれ、編集可能ポリゴン内の対応するポリゴンからデータを継承します。
例 |
convertToMesh obj --> $Editable_Mesh:Plane01 @ [0.000000,0.000000,0.000000] SimpleFaceManager.getChannels obj --check that all channels are still there --> #(<MixinInterface:simpleFaceChannel>, <MixinInterface:simpleFaceChannel>) theInt=(SimpleFaceManager.getChannels obj)[1] --get the first one --> <MixinInterface:simpleFaceChannel> theInt.numfaces --check the number of faces - now we have 4triangles --> 4 theInt.getValues() --see that the original values were propagated --> #(42, 42, 42, 42) convertTo obj Editable_Poly --convert back to Editable Poly --> $Editable_Poly:Plane01 @ [0.000000,0.000000,0.000000] theInt.numfaces --the data has been consolidated --> 2 |
編集可能メッシュから編集可能ポリゴンに変換すると、さまざまな面ごとのデータを持った複数の三角形が統合されて単一のポリゴン面が作成されます。この場合は、ポリゴンに追加されている面の最後の値が使用されます。
例 |
convertToMesh obj --> $Editable_Mesh:Plane01 @ [0.000000,0.000000,0.000000] theInt.numfaces --check the number of faces - now we have 4 triangles --> 4 theInt.setValues #(1,2,3,4) --set different values for the 4 triangles --> true convertTo obj Editable_Poly --convert to Editable Poly --> $Editable_Poly:Plane01 @ [0.000000,0.000000,0.000000] theInt.getValues() --get the consolidated data - it is #(2,4) and not #(1,3) --> #(2,4) |
既存の面を面分割することによってトポロジを変更する場合は、新しい面はオリジナルの面の値を継承します。
例 |
polyop.tessellateByFace obj 1 --tessellate the first face into 4 new faces --> OK theInt.numfaces --check the total number of faces in the data channel --> 5 --note that because of the way Editable Poly updates polygon lists when --changing topology, the previous face 2 becomes face 1, --while the new 4 polygons from the tessellation have been given --indices 2,3,4 and 5. theInt.getValues() --get the new data: --> #(4, 2, 2, 2, 2) |