godotengine / godot-proposals

Godot Improvement Proposals (GIPs)
MIT License
1.16k stars 97 forks source link

Add a way to preview subviewports in the 2D editor #5422

Open AndreaTerenz opened 2 years ago

AndreaTerenz commented 2 years ago

Describe the project you are working on

3D fps in Godot 3.5 (I'd say this applies to Godot 4 as well)

Describe the problem or limitation you are having in your project

I sometimes use Viewports with Control children to display UI in 3D in various ways and editing the UI nodes is impossible once they are children of a Viewport, because that means they won't show up in the 2D editor. What I have to do is move them out of and back into the viewport when I want to make any edit or change. A ViewportContainer doesn't help because:

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

Implement a dropdown menu in the 2D editor to select the Viewport you want to display (defaulting to the root viewport) in order to see and edit its 2D children nodes.

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

mockup Under the hood, the editor would keep track of any viewports that are currently present in the scene to generate the dropdown

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

I don't think so, it seems like a core editor feature.

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

Refer to previous question.

golddotasksquestions commented 1 year ago

Unless I misunderstood something, this proposal is already fullfilled. You can already preview SubViewports in the Inspector as well as in the general 2D viewport if they are rendered to a texture via ViewportTexture.

I think this can be closed.

Zireael07 commented 1 year ago

if they are rendered to a texture via ViewportTexture.

That's a big IF.

They want to see Viewport contents in the editor itself without having to fiddle with ViewportTextures. IIRC this is a bug that was fixed at some point though?

warrenscipio commented 2 months ago

I actually ran into this problem but saving the branch under the subviewport as its own node with a control node as the root seems to be a solid work around for me. Its still a bug that the subviewport can't be in the 2D editor but thought I'd throw this out there just in case anyone is waiting for this.

AndreaTerenz commented 2 months ago

saving the branch under the subviewport as its own node with a control node as the root seems to be a solid work around for me

It is because it allows you to view that UI on its own, but it would be really cumbersome to have dozens of tiny UI scenes all over the place just to view their Control nodes in the editor

warrenscipio commented 2 months ago

saving the branch under the subviewport as its own node with a control node as the root seems to be a solid work around for me

It is because it allows you to view that UI on its own, but it would be really cumbersome to have dozens of tiny UI scenes all over the place just to view their Control nodes in the editor

If you plan to use dozens of subviewports than yes but you'd only need one per subviewport, having the contents of any subviewport being it's own scene doesn't seem that unreasonable, seems like it would promote good composition and project organization. But I also don't really have a project where I have dozens of subviewports, I've only really used them for diegetic UI so I'll have 2 or 3 max in an entire project.