static func set_parent(node: Node, parent: Node): """ Set the parent of a node, reparenting if needed """ var old_parent = node.get_parent() if old_parent and old_parent != parent: old_parent.remove_child(node) parent.add_child(node)