EditModel3D.GetSelectedNode

This page contains reference documentation for the GetSelectedNode function. This function allows you to get access to a specific, selected node by its index in the selection buffer.

Prototype

NodeSelect GetSelectedNode( int SelectedNodeIndex )

Parameters

Function parameters are as follows:

Examples

Examples are as follows:

// Create a new group... use GetSelectedNode to pass the selection to the script.

for( int i = 0; i < Model.GetSelectCount(); ++i )
{
   Node selNode = Model.GetSelectedNode( i ).GetNode();
   if( selNode.IsDerived( Group ) )
   {
      Group group = new Group;
      group.Name = "NewGroupNode";
   
      AddNode( group, (Group)selNode );
   }
}

// Restore a selection-set from a Collection node... use GetSelectedNode to pass the selection to the script.

Model.DeselectAll();

int selectedCount = Model.GetSelectCount();
for( int node = 0; node < selectedCount; ++node )
{
   Node selNode = Model.GetSelectedNode( node ).GetNode();
   if( selNode.IsDerived( CollectionNode ) )
   {
      CollectionNode collNode = (CollectionNode)selNode;
      
      List selectBuffer = collNode.GetCollection();
      int count = selectBuffer.GetCount();
      for( int i = 0; i < count; ++i )
      {
         NodeSelect select = (NodeSelect)selectBuffer.Get( i );
         Model.SelectNS( select.Clone() );
      }
   }
}

Working Sample Code

For sample code: