Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automatically change the scene tab highlighted when selecting the script of the scene #10163

Open
JSolde opened this issue Jul 10, 2024 · 7 comments

Comments

@JSolde
Copy link

JSolde commented Jul 10, 2024

Describe the project you are working on

It is just a general impovement for usability of the editor

Describe the problem or limitation you are having in your project

If you select a scene and display its script then if you select a new script the scene tab does not change. So if you go to 2D then you do not see the scene corresponding to the selected script and you have to manually select it.

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

It'd be good if when a script that corresponds to a scene is selected then the corresponding scene is also selected in the scenes tab and thus will appear if 2D icon is selected. This is what happens if you select a new scene,

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

  • Select a scene with a script.
  • Click the script icon at the top of the editor, then you'll see its script.
  • Select another script of another scene, this new script will be displayed, and you should also see that the scene of this script is highlighted in the scenes Tab.
  • Select the 2D icon at the top of the editor, then the scene of the selected script should be displayed.

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

No that I can think of.

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

Improving editor usability.

@Mickeon
Copy link

Mickeon commented Jul 10, 2024

While a single script can be attached to multiple scene roots, narrowing it down to only currently open Scenes would make this feature more usable in a real scenario.

Should really be an Editor Setting, however. Changing Scene without user input can potentially be disorienting, particularly so for returning users.

@Calinou Calinou changed the title Automatically change the Scene Tab highlighted when selecting the script of the scene. Automatically change the scene tab highlighted when selecting the script of the scene Jul 10, 2024
@lostminds
Copy link

Something I think complicates this a fair bit is that we don't just have the 2D/3D scene viewport and the script editor to consider. If this was the case I'd agree it could be a good idea to switch selected scene when switching to the related script.

But now we also have the Scene tree view to the left and the Inspector panel to the right, which both relate to the currently open scene. So switching scripts would then also switch out and lose current selection in both the scene tree (of the old selected scene) and the inspector panel to the right by changing the open scene. This I think would be both unexpected and unwanted in many cases. If it's restricted to open scenes it might be better, but it could also make it more unexpected to the user since the change will only happen sometimes when changing what script you edit.

@mgrider
Copy link

mgrider commented Sep 20, 2024

I think there are several usability issues at play here.

  1. For one thing, it's way too easy to get into a situation where you have panels that don't match up with each other.

    Right now, in the Scene panel in Godot 4.3.stable, it's possible to have two nodes with scripts on them, and select one node, but then press the "script" icon/button on the other node. This doesn't change which node is selected, but it does open the script in the editor pane, as well as changing what's shown in the Inspector pane. Meanwhile, nothing has changed in the FileSystem panel. Also, the name of the script file itself is shown literally nowhere (unless you have the left-side "Scripts Panel" open).

  2. Tabs are shown above the script editor, but entirely decoupled from it.

    When you've got the script editor open, clicking a Tab changes which Scene is shown, but does nothing in the script editor. Because of their placement, you would be right to assume there is a relationship, but it doesn't seem like there is one.

    TBH, I think it would make sense for the whole tab row to go away when the Script (button? tab?) is selected.

  3. The script editor feels like a separate application within Godot.

    It has its own menus. It has its own collapsible left-panel. You can "pop it out" and make it its own window.

    I think this would be fine if it didn't have its own fundamental UX issues. The aforementioned "not showing the name of the script" is probably the most egregious. I think, at the very least, the name of the script should appear at the top of the editor view somehow. This is pretty standard in most IDEs, I think.

    I also have a lot of issues with that Scripts Panel. If there's a way to make it show something useful, I don't know what it is. (I would be happier if it showed the filesystem, maybe even filtered to just script files.)

FWIW, I think the proposed solution is okay, but it doesn't go far enough to solve the fundamental issues I've described.

@aXu-AP
Copy link

aXu-AP commented Sep 21, 2024

I think there's the fundamental problem with this proposal that one script could be used by any number of scenes. How the editor would know which one to open?

When you've got the script editor open, clicking a Tab changes which Scene is shown, but does nothing in the script editor.

This is an editor setting for that: text_editor/behavior/files/open_dominant_script_on_scene_change. I don't know why it's disabled by default, it makes the whole thing feel more unified. It's kind of a subversion of this proposal.

@Mickeon
Copy link

Mickeon commented Sep 21, 2024

See godotengine/godot#81906 . That feature has been enabled for the longest time but it has been only recently disabled. It was a major annoyance as it doesn't work as well as you may think in its current state.

@aXu-AP
Copy link

aXu-AP commented Sep 21, 2024

Thanks for linking that discussion. I didn't know that people had an issue with it, I sure have mostly enjoyed it. It could definitely be improved upon as you mentioned in that comment.
Anyway, this kind of further drives the point that a lot of people don't like when the editor does something extra for you no matter how helpful intentions there are (especially if it's ambiguous what would happen, like in this proposal). A passive, informal approach might be welcomed better as with #10750. We'll see.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants