Lakamfo

Get all nodes

Jul 22nd, 2022 (edited)
205
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. func get_all_nodes(root: Node,Filter : bool = false,NodeClass = Node,list = []):
  2.     var _Class
  3.     if NodeClass:
  4.         _Class = NodeClass.new()
  5.     if not Filter:
  6.         for node in root.get_children():
  7.             list.append(node)
  8.             get_all_nodes(node,false,null,list)
  9.         return list
  10.     else:
  11.         for node in root.get_children():
  12.             if node.get_class() == _Class.get_class():
  13.                 list.append(node)
  14.             get_all_nodes(node,true,NodeClass,list)
  15.         return list
Add Comment
Please, Sign In to add comment