How do you get Toolbar events from Tilemap in an EditorPlugin?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Matthew Schultz

I see a lot of ways to connect to events in the Godot editor except for the Toolbar area’s. Does this space go by a different name in the Godot’s documentation? I’ve looked in the editor interface documentation but I’m unable to find reference to any signals. The closest I can get is the editor viewport events.

:bust_in_silhouette: Reply From: ChildLearning.Club

I’m not completely sure this is what you are looking for, but you can check the properties of any items in the editor viewport by using the .get_child() function and then depending on the child node type, check its property with the .get_child().property for example:

tool
extends EditorPlugin

# Get the current editor node
var viewport = get_editor_interface().get_editor_viewport()

func _enter_tree():
	print(viewport.get_children())

this will print all the nodes within the editor viewport and individual items can be selected with viewport.get_child() with the index number being passed into the get_child() function. if the node you are looking for is within one of the children you might need to use multiple .get_child()

print(viewport.get_child(0).get_child(0).get_child(0).get_child(0).pressed)

for example will print “True” if the “Select Mode (Q) / Pointer” is selected in the editor viewport and “False” if not.