-
-
Notifications
You must be signed in to change notification settings - Fork 21.4k
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 a tooltip delay setting for editor #35806
Add a tooltip delay setting for editor #35806
Conversation
4ec9680
to
17705d4
Compare
Would be nice to have this as an exposed property in |
@YeldhamDev Do you mean using |
@Fermats-Fish Nevermind, completely forgot about the project setting. |
@YeldhamDev No problem. |
Honestly I am not sure this is worth it. It's yet another almost pointless editor settings... |
@groud At the very least it makes sense to make it so that changing the in game tooltip delay via project settings does not change the tooltip delay in the editor. I could always modify this code to just fix that issue without adding the editor setting. |
Sure ! My single point was about the editor settings, but the rest of the change look fine to me :) |
scene/main/viewport.cpp
Outdated
float Viewport::editor_tooltip_delay = 0.5f; | ||
float Viewport::regular_tooltip_delay = 0.5f; |
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.
Since the master
branch now accepts C++17 code, you can initialize those variables directly in the header file.
Also, is static
needed here? We only make variables static
if we absolutely need it.
scene/main/viewport.h
Outdated
@@ -305,7 +308,7 @@ class Viewport : public Node { | |||
Variant drag_data; | |||
Control *drag_preview; | |||
float tooltip_timer; | |||
float tooltip_delay; | |||
float *tooltip_delay; |
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.
Out of curiosity, why was this *
added?
I was looking for this setting and I was astounded I could not find it. This may be salvaged, probably... |
+1 for salvaging; we want to have near instant (<0.05s) tooltips in our project, but we found out this property propagates to the editor, and with very low times it makes mouse scroll extremely finicky and annoying. Is there any suggested workflow to salvage PRs? I assume I'd need to open another PR, would marking the current PR owner as |
Sure 🙂 This is what I do personally. |
Hi everyone. If the community is interested in getting this feature merged now, I'm happy to have a go at fixing up my commit :). |
Resolves godotengine#27879 and godotengine#9030. Adds an editor setting which changes the tooltip delay for tooltips inside the editor. A restart is required for this change to be applied, however the code could be extended so that this is not required.
17705d4
to
4923b81
Compare
Finally got some time to have a go at this. I've fixed the merge conflicts, changed to the new system for creating editor settings, fixed the unnecessary pointer, and simplified the code by removing an unnecessary static variable. The code still requires a restart every time you change the editor tooltip delay however. When I next get some time I can try to figure out a way to resolve this. |
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.
Tested locally (rebased on top of master
9050ee1), there's an issue with how gui/timers/tooltip_delay_sec
is registered. Also, the editor setting doesn't have any affect even after restarting the editor (I tried a tooltip delay of 0.05
and tooltips still take half a second to appear).
Since GLOBAL_DEF()
is only reached when not running in the editor, this means the project setting is never registered in the editor, so you can't edit its value. It also won't appear in the generated class reference.
The GLOBAL_DEF()
line should be moved to this location:
godot/core/config/project_settings.cpp
Line 1468 in 9050ee1
GLOBAL_DEF(PropertyInfo(Variant::INT, "gui/timers/incremental_search_max_interval_msec", PROPERTY_HINT_RANGE, "0,10000,1,or_greater"), 2000); |
After doing this, replace the call to GLOBAL_DEF()
in viewport.cpp
with GLOBAL_GET()
.
Superseded by #85678. Thanks for the contribution! |
Resolves #27879 and resolves #9030.
Adds an editor setting which changes the tooltip delay for tooltips inside the editor.
A restart is required for this change to be applied, however the code could be extended so that this is not required.
This is my first time contributing to a major open source project, and my first time using C++, so let me know if I should have done anything differently.