Godot: The hiding of Script Editor when selecting node in Scene Tree

Created on 14 Jun 2020  路  12Comments  路  Source: godotengine/godot

I just discovered a function called can_lose_focus_on_node_selection() in ScriptEditorPlugin class. It returns false for VisualScript editor and true for other script editors. When it's true, clicking a node in Scene Tree will change the viewport to this node's native (i.e. 2D or 3D). Before the function was introduced, Godot would switch away from Script Editor unconditionally.

Now, I've seen an issue where this behavior was labeled as a bug: #14862
There's also #33704, which is related
EDIT: Another old issue: #20676 (this time enhancement)

The question is: is this behavior useful? Many users will probably agree that if you are in the Script Editor, you want to click nodes in Scene Tree without hiding the Script Editor (some people want e.g. to check them in the inspector). Personally I don't see why would we want to switch on click, other than it being maybe faster than clicking the 2D/3D button on the top.

I opened this issue to discuss this problem. We could either:
1) leave the behavior as it is (which means #14862 should be closed and #33704 fixed properly)
2) remove this behavior (would close both of these issues, and probably some others)
3) make it optional editor setting (should be easy, by reading the setting in the can_lose_focus_on_node_selection() method)
4) change it to switch double-click or something similar

Any thoughts?

discussion editor usability

Most helpful comment

Isnt double-click triggering node rename?
Also double-click on the node icon teleports the camera to it. I didn't even know.
More stuff on double-click already than I thought^^

All 12 comments

I prefer option 2. For me this behaviour was always counter-intuitive and it happens quite frequently. It's maybe one click more, if we want to change the view, but it's a logical click that makes sense, whereas the current behaviour can be quite irritating, because in a lot of scenarios it's just doing additional stuff you did not intent and you find your self fighting with it and having to go back manualy again.

It happend to me both, when I wanted to look at a property or property path of a node or when I tried to drag and drop the node path into the text editor.

I don't think there should be an option for it, as I don't like bloated editor settings. For me the proposed solution ( in #14862) of using a doubleclick for the current behaviour would make more sense.

Fixing this behaviour would be very appreciated. Thanks!

Ah yes, I forgot that there's a 4th option actually.

Then I'm for option 4!

I think using double-click for this makes the most sense too.

Isnt double-click triggering node rename?
Also double-click on the node icon teleports the camera to it. I didn't even know.
More stuff on double-click already than I thought^^

Could give rename a default keybinding and make double clicking the node show it in the scene in one way or another. Also, double clicking on the icon to teleport the camera to it is pretty unintuitive and hard to find if you don't know about it already.

Could give rename a default keybinding

This is done by #38201, but it seems some users still prefer double-clicking nodes to rename them instead of pressing F2 (perhaps because they don't know about this shortcut in general).

It may be worth keeping in mind that F2 to rename has very DOS/Windows-centric origins...

Assuming that people using Macs keep the default keyboard settings, F2 will be brightening their screen unless they also hold the fn keys.

I'm definitely in favour of not unintentionally switching away from the Script Editor though. :)

I'm for option 2. If you are in the script editor and you click on a node, I think the behaviour should be to show that node in the inspector and stay in the script editor, because if you are in the script editor... well... you are working on scripts, and thats what you want to do. If you want to see the 2D/3D representation, just click on the 2D/3D buttons at the top to switch. I dont think there should be a shortcut to get there in the scene tree, apart from maybe a right click > go to node in viewport or similar.

Maybe Shift+Click to avoid changing context?

More like Alt+Click, Shift is used for multiselecting. But sounds like a good option.

I think not changing context should be the default. Changing context should require a modifier like Alt instead.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mefihl picture mefihl  路  3Comments

SleepProgger picture SleepProgger  路  3Comments

blurymind picture blurymind  路  3Comments

nunodonato picture nunodonato  路  3Comments

ndee85 picture ndee85  路  3Comments