-
-
Notifications
You must be signed in to change notification settings - Fork 23.8k
Add Shortcut tooltip to Editor Main Screen Plugins #109234
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
Add Shortcut tooltip to Editor Main Screen Plugins #109234
Conversation
editor/editor_main_screen.cpp
Outdated
| tb->set_name(p_editor->get_plugin_name()); | ||
| tb->set_text(p_editor->get_plugin_name()); | ||
| tb->set_shortcut_in_tooltip(true); | ||
| tb->set_shortcut(ED_GET_SHORTCUT(String("editor/editor_{0}").format(varray(p_editor->get_plugin_name())).to_lower())); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does not work with custom plugins.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fair enough. will handle situation where if shortcut doesn't exist will create a dummy shortcut field in Editor Settings for that given plugin name. Ideally (as you stated in the follow-up comment) we indeed should have a defined api for handling shortcut (main screen and editor plugins in general)
|
You can't just assume that any added main screen will have associated shortcut (and with half-hard-coded path). You could add a method to EditorMainScreen that assigns a Shortcut to a main screen Button based on its name. Ideally we should have some API that allows defining a shortcut for a main screen plugin, but this is out of scope for this PR. |
|
Have handled the scenario for Custom Plugins - Though due to how Here's the new change in action (with two custom plugins - one enabled by default and one to be manually enabled) after-main-screen-plugin-custom-handled.mp4 |
Uh, that will just cause errors for every main screen plugin and people will make bug reports. Also forcing a fixed path for plugin can easily cause other problems, like name clashes. If you want to go this way, just check if the shortcut exists before trying to assign it. If it does not exist, don't do anything, don't add a dummy shortcut. |
|
Thanks for pointing these out.
|
Well, that's just missing functionality. I doubt most people will even notice it. |
|
ah alright, in that case will update the code to reflect this. but here's a concern I've - this is what the updated code block would look like based on how the code is structured, it would still look for custom plugin shortcut_paths, say alternative to this would be handling the get_shortcut check with |
|
No need to do |
|
updated it locally for time-being, thanks :) |
That would be fine in this case.
Not really. Until we have a proper API for main screen buttons (and there is a couple of ways to implement it), it's better to not mention this option anywhere, as it's basically a hack/workaround. |
|
cool then. updating it accordingly. |
d6bb584 to
eadecd8
Compare
|
not related to changes: also - my bad as I missed to force-push the initial two commits. |
|
Won't this duplicate the shortcut handling? Lines 402 to 409 in e67074d
So the old ones should be deleted as this changes it to be handled by the buttons. |
|
I'm not sure if the Buttons will handle the shortcut properly. And either way, the shortcut can be matched only once, so it won't be a problem. EDIT: |
|
In that case, they can be deleted later when a proper API is made for it. |
|
I believe the following text should be used for these shortcuts:
The documentation is a bit inconsistent and should maybe be cleaned up, but I don't believe that existing documentation calls the 2D or 3D workspaces "editors". It's probably best to follow the existing names in the documentation, as those can terms can be assumed to be used in some external tutorials and resources. "Workspace" term is used to describe what these buttons do: https://docs.godotengine.org/en/latest/getting_started/introduction/first_look_at_the_editor.html#first-look-at-godot-s-editor "Screens" term is used to describe the 5 screens: https://docs.godotengine.org/en/latest/getting_started/introduction/first_look_at_the_editor.html#the-five-main-screens (It seems the "screens" term is a bit of an outlier and is only used in this one section of this one page?) "Workspace" term is used for the 2D workspace: https://docs.godotengine.org/en/latest/tutorials/2d/introduction_to_2d.html#d-workspace "Workspace" term is used for the 3D workspace: https://docs.godotengine.org/en/latest/tutorials/3d/introduction_to_3d.html#d-workspace "Editor" term is used for the script editor: https://docs.godotengine.org/en/latest/tutorials/editor/script_editor.html I'm actually not sure about the Game View; I can't find any documentation about it besides the overview of the "five screens", where it's called a Game Screen. But again, this "screen" term appears to an outlier, so I'm fine with whatever for this one. |
|
@kushagra10025 Would you be able to integrate the new terms suggested above? |
|
@Repiteo if the above suggestions are alright then I'll update the PR with them soon. |
|
@kushagra10025 I have no objections & nobody has opposed them, so go for it! The commits need to be squashed anyway, so this will be a good opportunity to handle that all at once |
|
Hey @Repiteo - Have updated the PR, I might have messed up (squashing too) and pushed after fetching latest commit 🥲. Didn't have any merge conflicts though - atleast locally! Also @AThousandShips - in case this is merged wouldn't we need to update the docs here too - https://docs.godotengine.org/en/stable/tutorials/editor/default_key_mapping.html#general-editor-actions Apologies for any inconvenience! Do guide with next steps please :) |
|
The page on the docs would need to be manually updated indeed, we (currently) don't have an automated system |
|
Alright! Based on the acceptance result of this PR! I'll raise one on that repo. Thanks for confirming! |
Co-Authored-By: Kushagra <53115703+kushagra10025@users.noreply.github.com>
8364ad9 to
4bb188f
Compare
|
Fixed up the Git history for you @kushagra10025, so this is now ready to merge 👍 |
|
Thanks! Congratulations on your first merged contribution! 🎉 |
|
Thanks to all involved in the thread! |
Updating the Docs to reflect the latest in-editor Terminology. PR link of issue for the discussion - godotengine/godot#109234 (comment)
Fixes godotengine/godot-proposals#6266
Added tool-tip to 2D, 3D, Script, AssetLib (Main Screen Editor Plugins) buttons that shows keyboard shortcut.
(Ctrl + F1)(Ctrl + F2)(Ctrl + F3)(Ctrl + F4)(Ctrl + F5)Video of the Change in action:
after-main-screen-plugin.mp4
Note: The easiest solution I figured was reordering the Shortcut Creation and directly getting its reference in
add_main_pluginHopefully doesn't break any compatibility.