Skip to content

The hiding of Script Editor when selecting node in Scene Tree #39539

Closed
@KoBeWi

Description

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 Selecting a node change editor to the editor where the node has a "physical" representation #14862 should be closed and Drag & Drop node to scripts sometimes handles incorrectly #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?

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions