Skip to content

Instantly share code, notes, and snippets.

@renevanderark
Last active June 1, 2025 07:54
Show Gist options
  • Select an option

  • Save renevanderark/677851992983b920ee6ca33f3bc88b24 to your computer and use it in GitHub Desktop.

Select an option

Save renevanderark/677851992983b920ee6ca33f3bc88b24 to your computer and use it in GitHub Desktop.
Godot 4 plugin development: dump parts of the interface tree to look for controls
@tool
## (can be any Node as long as it's a tool)
extends EditorPlugin
func _enter_tree():
# print root
_dump_interface(EditorInterface.get_base_control(), 2)
# found by looking at the dump
var animation_player_editor = EditorInterface.get_base_control().find_child("*AnimationPlayerEditor*", true, false)
_dump_interface(animation_player_editor, 2)
## Will print the tree (use with care, because your plugin will probably not be forward compatible across versions)
func _dump_interface(n : Node, max_d : int = 2, d : int = 0) -> void:
if n.name.contains("Dialog") or n.name.contains("Popup"):
return
print(n.name.lpad(d + n.name.length(), "-") + " (%d)" % [n.get_child_count()])
for c in n.get_children():
if d < max_d:
_dump_interface(c, max_d, d + 1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment