Blitz3D+ Command Reference

CountTreeViewNodes ( parent_node )

Parameters

parent_node - tree view node whose children are counted; use TreeViewRoot for the top level

Description

Returns the number of child nodes directly under a tree view node.

Counts only the node's direct children - grandchildren are not included, so walking a whole scene hierarchy means recursing and counting at each level. Pass the invisible root from TreeViewRoot to count the top-level nodes.

Typical uses: working out a valid index for InsertTreeViewNode, checking whether a folder node is empty before offering to delete it, or iterating a branch when saving the hierarchy to a level file. Collapsed nodes still count - hiding children with CollapseTreeViewNode does not remove them.

The world editor shell sample shows the scene hierarchy pattern this belongs to.

Requires Extended mode.

See also: AddTreeViewNode, InsertTreeViewNode, TreeViewRoot, FreeTreeViewNode, SelectedTreeViewNode.

Index