インタフェース > コア インタフェース > NamedSelectionSetManager |
3ds Max 2011 で導入されたこのコア インタフェースは、名前付き選択セットへのアクセスと管理を行うためのメソッドを公開します。
関連する機能については、「SelectionSetArray 値」も参照してください。
Interface: NamedSelectionSetManager
メソッド:
<integer>NamedSelectionSetManager.GetNumNamedSelSets()
名前付き選択セットの数を返します。
<string>NamedSelectionSetManager.GetNamedSelSetName <integer>setIndex
インデックス付きの、ゼロを基数とする名前が付いた選択セットを返します。
<integer>NamedSelectionSetManager.GetNamedSelSetItemCount <integer>setIndex
インデックス付きの、ゼロを基数とする名前が付いた選択セット内のアイテム(オブジェクト)の数を返します。
<node>NamedSelectionSetManager.GetNamedSelSetItem <integer>setIndex <integer>itemIndex
2 つめの引数で指定されたインデックス付きの、ゼロを基数とするシーン ノードを、1 つめの引数で指定されたインデックス付きのゼロを基数とする名前が付いた選択セットから返します。
<boolean>NamedSelectionSetManager.AddNewNamedSelSet <&node array>nodeSet <&String>setName nodeSet is In parameter setName is In parameter
2 つめの引数に基づいて名前が付けられた 1 つめの引数により配列として渡されたノードを含む、新規の選択セットを追加します。
成功した場合は true を、失敗した場合は false を返します。
<boolean>NamedSelectionSetManager.RemoveNamedSelSetByIndex <integer>setIndex
ゼロを基数とするインデックス付きの名前が付けられた選択セットを削除します。
成功した場合は true を返します。失敗した場合(インデックスが範囲外の場合)は false を返します。
<boolean>NamedSelectionSetManager.RemoveNamedSelSetByName <&String>setName setName is In parameter
指定の名前で名前が付けられた選択セットを削除します。
成功した場合は true、失敗した(名前が見つからない)場合は false を返します。
<boolean>NamedSelectionSetManager.ReplaceNamedSelSetByIndex <&node array>nodeSet <integer>setIndex nodeSet is In parameter
2 つめの引数によって指定されるゼロを基数とするインデックス付きの名前が付けられた選択セットのノード配列と、1 つめの引数によって渡されるノード配列を置き換えます。
成功した場合は true を返します。失敗した場合(インデックスが範囲外の場合)は false を返します。
<boolean>NamedSelectionSetManager.ReplaceNamedSelSetByName <&node array>nodeSet <&String>setName nodeSet is In parameter setName is In parameter
2 つめの引数の名前文字列によって指定される選択セットのノード配列と、1 つめの引数によって渡されるノード配列を置き換えます。
成功した場合は true、失敗した(名前が見つからない)場合は false を返します。
<boolean>NamedSelectionSetManager.GetNamedSelSetList <&node array>nodeSet <integer>setIndex nodeSet is In and Out parameter
ゼロを基数とするインデックスの 2 つめの引数によって指定された選択セットのノード配列を 1 つめの引数により参照渡しされた配列に返します。
成功した場合は true を返します。失敗した場合(インデックスが範囲外の場合)は false を返します。
<boolean>NamedSelectionSetManager.SetNamedSelSetName <integer>setIndex <&String>setName setName is In parameter
1 つめの引数で指定されたインデックス付きの名前が付けられた選択セットの名前を 2 つめの引数で指定した文字列に設定します。
成功した場合は true を返します。失敗した場合(インデックスが範囲外の場合)は false を返します。
例: |
NamedSelectionSetManager.GetNumNamedSelSets() --starting without named selection sets --> 0 s = Sphere() --we create a sphere --> $Sphere:Sphere001 @ [0.000000,0.000000,0.000000] b = Box() --and a box --> $Box:Box001 @ [0.000000,0.000000,0.000000] NamedSelectionSetManager.AddNewNamedSelSet #(s,b) "TestSelectionSet" --and add them to a sel.set --> true NamedSelectionSetManager.GetNumNamedSelSets() --checking the count, we have created one --> 1 NamedSelectionSetManager.GetNamedSelSetName 0 --indices are zero-based, so we get the first set --> "TestSelectionSet" NamedSelectionSetManager.GetNamedSelSetItemCount 0 --which has two items inside --> 2 NamedSelectionSetManager.GetNamedSelSetItem 0 0 --checking the first item returns the sphere, --> $Sphere:Sphere001 @ [0.000000,0.000000,0.000000] NamedSelectionSetManager.GetNamedSelSetItem 0 1 --checking the second item returns the box --> $Box:Box001 @ [0.000000,0.000000,0.000000] NamedSelectionSetManager.RemoveNamedSelSetByIndex 0 --we can remove the only sel.set --> true NamedSelectionSetManager.GetNumNamedSelSets() --which makes the number of set equal to zero --> 0 NamedSelectionSetManager.AddNewNamedSelSet #(s,b) "Test2" --let's make another one --> true NamedSelectionSetManager.GetNumNamedSelSets() --we are back to one selection set --> 1 NamedSelectionSetManager.RemoveNamedSelSetByName "Test1" --we can try to remove it by (wrong) name --> false NamedSelectionSetManager.RemoveNamedSelSetByName "Test2" --and successfully remove it by name --> true NamedSelectionSetManager.AddNewNamedSelSet #(s,b) "Test3" --let's re-make it under another name --> true g = Geosphere() --and create a geosphere primitive to replace the sphere --> $GeoSphere:GeoSphere001 @ [0.000000,0.000000,0.000000] NamedSelectionSetManager.ReplaceNamedSelSetByIndex #(g,b) 0 --we set the items in the sel.set --> true NamedSelectionSetManager.GetNamedSelSetItem 0 0 --so now the first item is the geosphere --> $GeoSphere:GeoSphere001 @ [0.000000,0.000000,0.000000] NamedSelectionSetManager.GetNamedSelSetItem 0 1 --and the second is the box --> $Box:Box001 @ [0.000000,0.000000,0.000000] NamedSelectionSetManager.ReplaceNamedSelSetByName #(b,s) "Test2" --replacing with wrong name fails --> false NamedSelectionSetManager.ReplaceNamedSelSetByName #(b,s) "Test3"--but works with the right name --> true NamedSelectionSetManager.GetNamedSelSetItem 0 0 --now we have the box as first itme --> $Box:Box001 @ [0.000000,0.000000,0.000000] NamedSelectionSetManager.GetNamedSelSetItem 0 1 --and the sphere as the second --> $Sphere:Sphere001 @ [0.000000,0.000000,0.000000] theNodes=#() --> #() NamedSelectionSetManager.GetNamedSelSetList &theNodes 0 --we can get the nodes by-reference --> true theNodes --now the variable contains an array of the items in the selection set --> #($Box:Box001 @ [0.000000,0.000000,0.000000], $Sphere:Sphere001 @ [0.000000,0.000000,0.000000]) NamedSelectionSetManager.GetNamedSelSetName 0 --the current name is "Test3" --> "Test3" NamedSelectionSetManager.SetNamedSelSetName 0 "SelSet"--we can rename it to "SelSet" --> true NamedSelectionSetManager.GetNamedSelSetName 0 --and make sure the renaming worked: --> "SelSet" |