SelectChildNodes
 
 
 

SelectChildNodes

Introduced

v1.0

Description

Returns an XSICollection consisting of all the nodes in the input collection, with branch selections being expanded into node selections of their members.

Note: If you try to use an object (or object list) for the SelectionList argument that is node-selected only, the command returns only the specified object (or object list). Ie., no expansion is possible unless the object is branch-selected.

Tip: You can set the branch flag to "BRANCH" by either using the SelectObj command with the SelectionMode parameter set to "BRANCH" and then get the SelectionList or you can prefix "B:" to the name of the object you want to branch-select.

Scripting Syntax

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

Return Value

Returns an XSICollection containing the expanded set of objects.

Parameters

Parameter Type Description
SelectionList String List of 3D objects to expand.

Default Value: Current selection

AffectSelectionList Boolean True to select the expanded objects and return them as a collection; False to return the collection of expanded objects without changing the selection.

Default Value: True

CheckObjectSelectability Boolean Specifies whether to select objects that are marked as unselectable.

Default Value: False

Possible Values:

Description:

False Select objects even if they are marked as unselectable.
True Do not select objects if they are marked as unselectable.

Examples

1. VBScript Example

'************************************************************
'       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 Example

'************************************************************
'       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"
'************************************************************

See Also

XSICollection.Expand siSelectMode