TArray<USCS_Node*> USCS_Node::GetAllNodes() { TArray<USCS_Node*> AllNodes; // first add ourself AllNodes.Add(this); // then add each child (including all their children) for(int32 ChildIdx=0; ChildIdx<ChildNodes.Num(); ChildIdx++) { USCS_Node* ChildNode = ChildNodes[ChildIdx]; check(ChildNode != NULL); AllNodes.Append( ChildNode->GetAllNodes() ); } return AllNodes; }
TArray<USCS_Node*> USimpleConstructionScript::GetAllNodes() const { TArray<USCS_Node*> AllNodes; if(RootNodes.Num() > 0) { for(auto NodeIt = RootNodes.CreateConstIterator(); NodeIt; ++NodeIt) { USCS_Node* RootNode = *NodeIt; if(RootNode != NULL) { AllNodes.Append(RootNode->GetAllNodes()); } } } return AllNodes; }