godotengine / godot-proposals

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

Switch to Script view when clicking on generic Node that has a script #456

Open golddotasksquestions opened 4 years ago

golddotasksquestions commented 4 years ago

Describe the project you are working on: Project with state machine, but this applies to others as well.

Describe the problem or limitation you are having in your project: I often have a simple Node I attach a script to. I have to click on the small scroll icon to the right to get to it's script. The small icon is harder to hit, if the panel size is slightly bigger it's harder to tell which symbol belongs to which node, intuitively I always click on the node when I want to get to the script.

switch_to_script

Describe how this feature / enhancement will help you overcome this problem or limitation: Unlike a KinematicPlayer2D, Node2D, or Sprite node, ect, if a generic Node has a script attached, it there is no purpose or benefit to stay in 2D viewport. The main purpose of this node, if it holds a script, is to hold the script, so I would expect the node to show me their script if I click on it.

Show a mock up screenshots/video or a flow diagram explaining how your proposal will work: See above gif, but imagine it switching to the script view with the respective script. Essentially the same thing as if you would click on the scroll icon right now.

Describe implementation detail for your proposal (in code), if possible: Unfortunately I can't.

If this enhancement will not be used often, can it be worked around with a few lines of script?: Would be used often by anyone with the same visually wired brains, and those who don't enjoy clicking possibly far away, identical tiny icons as much as spelled out names.

Is there a reason why this should be core and not an add-on in the asset library?: It's an integral part of the editor.

Calinou commented 4 years ago

This may be too invasive if you've navigating the scene tree with the keyboard. However, we could move the script icon towards the left so it's aligned with nodes that have a visibility toggle. Going further, we could even add a disabled visibility toggle icon with a tooltip explaining why the node can't be hidden.

golddotasksquestions commented 4 years ago

@Calinou Can you explain your point a bit further? Why would that be invasive for people who navigate the scenetree via keyboard?

Calinou commented 4 years ago

@golddotasksquestions Selecting a node via keyboard is identical to selecting it using a mouse. It will run any actions that will also happen when you select it using a mouse.

We can consider adding this behavior when double-clicking the node though.

golddotasksquestions commented 4 years ago

@Calinou Then my question persists, why would someone using a keyboard not also want that behavior?

Calinou commented 4 years ago

@golddotasksquestions You may not want to see the 2D view suddenly switching to the Script view just because you were navigating around :slightly_smiling_face:

golddotasksquestions commented 4 years ago

This is exactly what happens all the time anyway.

golddotasksquestions commented 4 years ago

Besides, navigating the scene tree with keyboard does not see to be the same as clicking with the mouse at all: switch_to_script2

Xrayez commented 4 years ago

I guess the expectation one gets when trying to modify a specialized script like StateMachineState is very similar to how you get a code editor popup when you select a Shader script. Similarly when you select an AnimationPlayer, the editor for animation tracks popup too, with the only difference being is that those are text vs visual editors. So meeting an expectation might be more important despite the existing logic.

I wonder whether it's possible to popup a GDScript editor for a specific node type via editor plugin to begin with.

I do have to note that I've also experienced a similar urge, interestingly with state machines as well. 😃

girng commented 4 years ago

Sometimes nodes might have exported vars (sometimes with setgets), which could update a texture visually (see Andrea's video here: https://www.youtube.com/watch?v=vsxB4L6rufo). Clicking at 4:14 would distort workflow and cause the developer to cycle between script view and 2d view.

Edit: There are also times where I click a node, then right click to Add Child Node. It would be annoying to have it switch to script view all the time (JMO)

golddotasksquestions commented 4 years ago

Thanks for chipping in with your opinion @girng Is the source of problem you are describing not rather the switching of the information that is displayed in the Inspector? See https://github.com/godotengine/godot-proposals/issues/247

YuriSizov commented 4 years ago

@Calinou

You may not want to see the 2D view suddenly switching to the Script view just because you were navigating around 🙂

There is a reverse problem, though. Often when working with scripts I need to select a different node in the tree to view some of its data in the inspector. Editor assumes I need to preview this node in 2D/3D view and switches away from Script view. This is invasive as well.

I agree, that changing editor views on behalf of the user is undesirable, so this should be fixed as well. As for proposal, doubleclick won't be much different, as it is used to rename nodes and making it a region specific action (like on node icon) is no different than using the script icon.

willnationsdev commented 4 years ago

@pycbouh Actually, I think doubleclick is quite different. You have...

Something along those lines where a click always results in a selection, but there is a difference between doing a double click (two clicks in quick succession) and clicking something and then clicking it again (to trigger a rename). Single clicks could go to scene view, doubles to script view.

YuriSizov commented 4 years ago

@willnationsdev Actually, I think you are right, there is no action on doubleclick per se. Rename is triggered on a regular click on an already selected node. I would still avoid changing views on any click though, unless it is crystal clear what user intention is.

Btw, it is really weird with keyboard controls. Navigating with arrow keys and hitting enter triggers a rename, but the input is all messed up (though, I think there was an issue about that already): image

golddotasksquestions commented 4 years ago

@willnationsdev

Single clicks could go to scene view, doubles to script view.

I don't like this idea very much to be honest. First, because single clicking on other nodes does change the view to viewport (which might make sense or not, but that's another discussion), and second because the click rate then would determent if the view would switch to script, or if it would be interpreted as "rename node". I can already feel me getting angry about that feature, because I clicked either too fast or too slow.

willnationsdev commented 4 years ago

@golddotasksquestions

I can already feel me getting angry about that feature, because I clicked either too fast or too slow.

I could definitely see that happening. The next thing that comes to mind would be adding some sort of keyboard+mouse combination click that would alter the behavior of the click. And perhaps having some sort of visual indicator, either on the cursor or the placement of the script icon when hovering over the SceneDock, to communicate to the user when the altered clicking behavior is active.