godot icon indicating copy to clipboard operation
godot copied to clipboard

Focus shader text editor when opened with quick open dialog

Open MartinDelille opened this issue 10 months ago • 4 comments

This is my first PR to the project so don't hesitate to ask me for improvements or any kind of modification.

I was a little bit annoyed that opening a shader with the Quick open dialog didn't focus it in the editor, so I added a line to focus the editor when opening a shader.

I'm not sure all the case are handled so feel free to comment on that.

MartinDelille avatar Jan 30 '25 14:01 MartinDelille

I approve, this matches the behavior of the script editor.

JekSun97 avatar Jan 30 '25 14:01 JekSun97

I wondered how I could make this changed merged. Shall I add it to the next call agenda ?

MartinDelille avatar Feb 07 '25 13:02 MartinDelille

@MartinDelille First off congrats on your first PR! Currently it's beta phase so there's a feature freeze. Your PR counts as a feature so it will have to wait until 4.4 stable is released.

paddy-exe avatar Feb 07 '25 17:02 paddy-exe

Thank you for the feedback @paddy-exe !

MartinDelille avatar Feb 10 '25 14:02 MartinDelille

I moved the focus grab to _switch_to_editor so it handles ShaderIncludes. The focus is indeed taken when the editor is loaded but I don't know how I can prevent that. Does it look acceptable now ?

MartinDelille avatar Oct 31 '25 15:10 MartinDelille

Does it look acceptable now ?

You need to squash the commits, if it's ready - see https://contributing.godotengine.org/en/latest/organization/pull_requests/creating_pull_requests.html#modifying-a-pull-request

Chaosus avatar Nov 03 '25 10:11 Chaosus

Done: e761c718f095818645d3e32e3c2fd4a8661ef12b

MartinDelille avatar Nov 03 '25 14:11 MartinDelille

Has I said there is a little side effect: when reponing a project with opened shader, the shader editor will be focused. I think this is can be acceptable. If not I would appreciate a hint to optionally do the focus at startup. I think I would need to add the p_focus parameter to the edit() method but since it is an overriden method from the EditorPlugin class, it might have implication elsewhere.

MartinDelille avatar Nov 03 '25 14:11 MartinDelille

I fixed the shader editor focus on startup using the restoring_layout member variable. What do you think about it ?

MartinDelille avatar Nov 06 '25 13:11 MartinDelille

Thanks! Congratulations on your first merged contribution! 🎉

Repiteo avatar Nov 20 '25 22:11 Repiteo

I'm so proud! Thank a lot for reviewing! ❤️

MartinDelille avatar Nov 21 '25 10:11 MartinDelille