SelectChildNodes

導入

v1.0

カテゴリ

選択

詳細

入力コレクション内のすべてのノードで構成されるXSICollectionだけでなく、展開するとノードメンバで構成されるノード選択を表示するブランチ選択も戻します。

注: ノード選択された SelectionList 引数をオブジェクト(またはオブジェクトリスト)に使用する場合、コマンドは指定されたオブジェクト(またはオブジェクトリスト)のみに戻します。 たとえば、オブジェクトがブランチ選択されていない場合は展開できません。

ヒント: 「BRANCH」にブランチ フラグを設定するには、SelectObj コマンドを使用して SelectionMode パラメータを「BRANCH」に設定し、SelectionList を取得するか、またはブランチ選択したいオブジェクトの名前に「B:」のプリフィックスを付けます。

スクリプト構文

oReturn = SelectChildNodes( [SelectionList], [AffectSelectionList], [CheckObjectSelectability] );

戻り値

展開されたオブジェクトセットを含むXSICollectionを戻します。

パラメータ

パラメータ タイプ 詳細
SelectionList 文字列 展開する 3D オブジェクトのリスト

デフォルト値: 現在選択されている値

AffectSelectionList ブール 展開されたオブジェクトを選択し、コレクションとして戻す場合は True、選択対象を変更せずに展開されたオブジェクトのコレクションを戻す場合は False

デフォルト値: True

CheckObjectSelectability ブール 選択不可としてマーキングされたオブジェクトを選択するかどうかを指定します。

デフォルト値: False

指定可能な値:

説明:

False 選択不可としてマーキングされたオブジェクトも選択します。
True 選択不可としてマーキングされたオブジェクトは選択しません。

1. VBScript の例

'************************************************************
'       This script demonstrates how to use SelectChildNodes
'       expands branch items but leaves node items intact.
'************************************************************
' Get the scene root in node
ExpandNodes ActiveSceneRoot
LogMessage vbLf & "------------------------------------------"
' Now get the root in branch (it's exactly the same object,
' except that the branch flag is set to BRANCH).
ExpandNodes "B:" & ActiveSceneRoot
function ExpandNodes( in_object )
        ' Clear the selection list 
        DeselectAll
        ' Expand the object as an XSICollection
        Set oFamily = SelectChildNodes( in_object )
        ' Iterate over the collection to get each member
        for each oItem in oFamily
                ' If the object was node-selected only, we get a
                ' collection of one item. If it was branch-selected,
                ' we get any object in the branch.
                Application.LogMessage oItem.FullName
        next
end function
'************************************************************
' Output of above script:
'DeselectAll
'SelectChildNodes "Scene_Root"
'INFO : "Scene_Root"
'INFO : "
'------------------------------------------"
'DeselectAll
'SelectChildNodes "B:Scene_Root"
'INFO : "Scene_Root"
'INFO : "Camera_Root"
'INFO : "Camera"
'INFO : "Camera_Interest"
'INFO : "light"
'************************************************************

2. VBScript の例

'************************************************************
'       This script demonstrates how to use SelectChildNodes
'       to expand the current selection list. Notice that
'       the item to be expanded has to be branch-selected
'       in order for SelectChildNodes to work properly.
'************************************************************
' Set up a cube to work with
CreatePrim "Cone", "MeshSurface", "Mom"
CreatePrim "Cube", "MeshSurface", "Junior", "Mom"
' Find the object in the scene (this finds the first
' mesh geometry under the scene root)
Set oParent = ActiveSceneRoot.FindChild( ,, siMeshFamily )
' Make sure the object was found
if ClassName( oParent ) <> "Nothing" then
        ' Clear the selection and branch-select the parent 
        DeselectAll
        SelectObj oParent, siSelectBranch
        ' Get the branch-selected parent
        Set oSelList = GetValue( "SelectionList" )
        ' Expand the parent down the branch
        Set oFamily = SelectChildNodes( oSelList )
        for each oItem in oFamily
                Application.LogMessage oItem.FullName
        next
end if
'************************************************************
' Output of above script:
'CreatePrim "Cone", "MeshSurface", "Mom"
'CreatePrim "Cube", "MeshSurface", "Junior", "Mom"
'DeselectAll
'SelectObj "Mom", 2
'SelectChildNodes "B:Mom"
'INFO : "Mom"
'INFO : "Junior"
'************************************************************

関連項目

XSICollection.Expand siSelectMode