How to create a custom editor ?

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

Greetings,

The “Making plugins” tutorial lets us create a new tab alongside with 2D/3D/Script/AssetLib, called “Main Screen Plugin”.

It contains either a scene or an object. But it doesn’t replicate the 2D interface, with its grid, settings and behaviour. How to duplicate the 2D interface in order to extend it ?

I tried using a CanvasItemEditor but it doesn’t make sense to me as there are many other childs to be created.

Any lead on where to look ? Either in GDScript or C++, I got the sources and am trying to figure out how these work.

I got this info by printing :

get_editor_interface().get_editor_viewport().get_children()

And the result is :

[[CanvasItemEditor:10111], [SpatialEditor:10349], [ScriptEditor:10702], [EditorAssetLibrary:12026], other stuff goes here by probably has is_main_screen on false ]

Any leads would be welcome, I primarily would like to understand the architecture before doing anything, see all the options.
I plan to make a custom editor in order to make it easier to edit a particular material, with multiple Curve2D etc.

Thank you !

I found an addon which lets you “inspect” editor nodes. Like if you hover over an editor node and press F12, you’ll get it’s name and everything. Here it is: GitHub - Zylann/godot_editor_debugger_plugin: A plugin to inspect the editor's scene tree itself, within the editor.
It should help you understand the structure of the editor.

EnrikeChurin | 2021-08-23 18:22

:bust_in_silhouette: Reply From: EnrikeChurin

I myself don’t know anything about it, but you can look into Godot source on GitHub.

Actually since they only want to copy the structure you can use ResourceSaver in a toolScript to save the top most node as a Tscn then open it Godot for editing and modifications

Wakatta | 2021-08-22 05:49

Oh god, that’s clever. Didn’t think of that. Maybe you should write it as an answer. Or maybe create the actual script. Or maybe I’ll do it.

EnrikeChurin | 2021-08-22 16:41