How to capture clicks in the editor with a tool/plugin and add Node(s) to the current scene tree (GDScript)?

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

You can draw what you want in the editor using the tool keyword.
You can add buttons with a plugin.
How do you capture clicks and add nodes to the editor scene tree?

I’ll explain exactly what I want to do:
I want to add a tool/plugin that let’s me add a directed graph inside the editor, node by node by clicking on the editor’s grid.

Why? Imagine a game with trains or cars. I don’t need a sets of ‘path(s)’. I need a “map” of routes that are embedded in 2D/3D space and possibly additional information embedded in the edges too. :smiley: In other words directional paths that split… aka a
Directed Graph.

That being said I know there is a GraphEdit and GraphNode in Godot but they appear to be something else. They look like GUI grids. :expressionless: I’m still not sure what they are for.
Thanks!