godotengine / godot-proposals

Godot Improvement Proposals (GIPs)
MIT License
1.14k stars 96 forks source link

Add a text editor for scenes (.tscn files) #6770

Open JeffVenancius opened 1 year ago

JeffVenancius commented 1 year ago

Describe the project you are working on

A 2D game. but it's not specific to it.

Describe the problem or limitation you are having in your project

None in particular, as you can do what I'm proposing with tool scripts, for example. It would be a lot more easier and faster to edit, though.

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

Well, you know how as soon as you write shader code it updates on the scene? That would be great to do in the actual scene you're editing on. Yes, you can do everything you want on the editor itself, but there are things that are a lot more automatizable in actual text and, since a scene is actually a text file...

It doesn't need to update at the same time either, I just think it makes sense to have an actual text editor for scenes with syntax highlighting, auto-completion and everything.

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

It would be a tab on the bottom with something like "Scene" or "Raw " on it, something like that and it would be exactly like the shader editor but, you know, for .tscn

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

I do think it could be used often, in particular for repetitive tasks.

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

I think it would be pretty useful, it makes sense for the editor to have something like that.

Calinou commented 1 year ago

This is already possible by using the File > Open menu in the script editor, then changing the file filter to All Files and selecting a .tscn file:

image

The list of recognized extensions doesn't list .tscn by default, which is why you have to change the file filter to see .tscn files:

image

Search around in the codebase for docks/filesystem/textfile_extensions for the list of editable extensions, plus Script (which is why .tres, .res and .gd appear at the top). Note that we should not add .tscn to this list, as double-clicking a .tscn file in the FileSystem dock shouldn't open a script editor.

JeffVenancius commented 1 year ago

This is already possible by using the File > Open menu in the script editor, then changing the file filter to All Files and selecting a .tscn file:

image

The list of recognized extensions doesn't list .tscn by default, which is why you have to change the file filter to see .tscn files:

image

Search around in the codebase for docks/filesystem/textfile_extensions for the list of editable extensions, plus Script (which is why .tres, .res and .gd appear at the top). Note that we should not add .tscn to this list, as double-clicking a .tscn file in the FileSystem dock shouldn't open a script editor.

Oh, that's actually really great! I do think it's not as used as it should, though, maybe this tab on the docker I've talked about would help? And the synchronized update too.

KoBeWi commented 1 year ago

There's is an easier way to edit scenes, but it requires an external editor. Just right-click a scene file and use the Open in External Program option. It will use either the external text editor you configured in Godot or the program that you have associated with tscn files. Scenes edited externally will prompt you to reload, so you get that too.

JeffVenancius commented 1 year ago

There's is an easier way to edit scenes, but it requires an external editor. Just right-click a scene file and use the Open in External Program option. It will use either the external text editor you configured in Godot or the program that you have associated with tscn files. Scenes edited externally will prompt you to reload, so you get that too.

I think it would be better if it were more closer to the editor itself and if you didn't need to click to reload every time. And to be able to edit and see the modifications on demand.

JoNax97 commented 1 year ago

I think it would be more accessible to have an "Open as Text" option for all text-based assets