godotengine / godot-proposals

Godot Improvement Proposals (GIPs)
MIT License
1.12k stars 78 forks source link

Be able to reuse the whole 2D and 3D editor part #8921

Open Meta-Ben opened 8 months ago

Meta-Ben commented 8 months ago

Describe the project you are working on

A 2D game that need to use 3D also

Describe the problem or limitation you are having in your project

Since I work with both 2D and 3D I had to switch regularly between those screen and its time consuming for many little step in my dev process, I wanted to made a plugin that just reuse the 2D and 3D view in a splitted ( like we can do in 3D with 2 Viewports mode )

Describe the feature / enhancement and how it helps to overcome the problem or limitation

A way to had those view next together or at least a way to retrieve the whole editor view ( toolbar on top included ), since the get_editor_viewport_2d only retrieve the camera view

Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams

A mode in Editor settings to use 2D and 3D in splitted way or a get_editor_2d and get_editor_3d that return the whole 2d editor and the whole 3d editor

If this enhancement will not be used often, can it be worked around with a few lines of script?

It seem to be more and more game using 2D and 3D, some game engine editor already merge them into one view, I prefer the Godot philosophy about keeping them separate, but an option to bring them next to each other will be the perfection

There is no simple workaround here since we cannot get access to those window from plugin way, the only way I see is to dig into the C++ code or recreate a whole editor based on get_editor_viewport_2d but it can add lot of editing regression

Is there a reason why this should be core and not an add-on in the asset library?

due to the lack of way to get the whole editor window ( editing tool included )

Zireael07 commented 8 months ago

Reuse or retrieve? Title mentions one, text mentions the other

Meta-Ben commented 8 months ago

I mean retrieve it ( to be able to reuse it as is )

Cause for now since 4.2 we can access viewport but only camera for 3D and transform data for 2D

The whole edition window cannot be getted

It could be nice to be able to retrieve the whole module as UI object, so yeah I mean retrieve the instance of it

I think its about this part of the editor code https://github.com/godotengine/godot/blob/master/editor%2Fplugins%2Fcanvas_item_editor_plugin.h

YuriSizov commented 8 months ago

There is no simple workaround here since we cannot get access to those window from plugin way

Yeah, you can. The entire editor is a tree of nodes, and you can retrieve any node you want if you know where to look. This plugin should help you with that. Many plugins are based on this tree wrangling approach where you use the types, order, and names (if available) of editor nodes to get the one you need.

That said, you won't have much luck with your plugin idea because the way main views work is tightly integrated into editor logic. You will face many situations where things will happen out of your control. Plus we won't expose the entire CanvasItemEditorPlugin or Node3DEditorPlugin to the public API because that's too broad and will get in the way of developing the editor itself.

Meta-Ben commented 8 months ago

Wow thanks a lot for taking the time to answer me ! In fact the plugin you shared with me is really interesting and I understand better, while I posted the idea I worked on a little plugin on the side to allow me to share the view, I faced some really interesting stuff so I understand better why its not a good idea to just share the CanvasItemEditorPlugin and the Node3DEditorPlugin as is

I managed to make a little plugin Only for previewing, dunno if its look okay or if I made a terrible and bad coding ( also I'm terribly bad on 3D stuff like camera management ), i'm still learning and its my first one on it, but for now its answer my usecase, also I understand that this usecase is not much appearing I think

I will dig into the plugin you shared with me, and I think all can be done for now with the plugin way, to finish I just want to say thank for you amazing work on Godot Engine