Created
May 20, 2016 20:21
-
-
Save henriquelalves/d1f687d7e73527762098921c1f116403 to your computer and use it in GitHub Desktop.
Recursive search for viewport on Godot
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func find_viewport(node, recursive_level): | |
if node.get_type() == "CanvasItemEditor": | |
return node.get_child(1).get_child(0).get_child(1).get_child(1) | |
else: | |
recursive_level += 1 | |
if recursive_level > 15: | |
return null | |
for child in node.get_children(): | |
var result = find_viewport(child, recursive_level) | |
if result != null: | |
return result |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment