Skip to content

Commit 4923b81

Browse files
committed
Added tooltip delay setting for editor
Resolves #27879 and #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.
1 parent a574c02 commit 4923b81

File tree

3 files changed

+14
-2
lines changed

3 files changed

+14
-2
lines changed

editor/editor_settings.cpp

+4
Original file line numberDiff line numberDiff line change
@@ -442,6 +442,7 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) {
442442
EDITOR_SETTING_USAGE(Variant::BOOL, PROPERTY_HINT_NONE, "interface/editor/single_window_mode", false, "", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED)
443443
_initial_set("interface/editor/mouse_extra_buttons_navigate_history", true);
444444
_initial_set("interface/editor/save_each_scene_on_quit", true); // Regression
445+
EDITOR_SETTING(Variant::FLOAT, PROPERTY_HINT_RANGE, "interface/editor/tooltip_delay", 0.5f, "0,5,0.01")
445446
EDITOR_SETTING_USAGE(Variant::INT, PROPERTY_HINT_ENUM, "interface/editor/accept_dialog_cancel_ok_buttons", 0,
446447
vformat("Auto (%s),Cancel First,OK First", DisplayServer::get_singleton()->get_swap_cancel_ok() ? "OK First" : "Cancel First"),
447448
PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED);
@@ -935,6 +936,9 @@ void EditorSettings::create() {
935936

936937
singleton->save_changed_setting = true;
937938

939+
// Apply the tooltip delay setting.
940+
Viewport::editor_tooltip_delay = EditorSettings::get_singleton()->get("interface/editor/tooltip_delay");
941+
938942
print_verbose("EditorSettings: Load OK!");
939943

940944
singleton->setup_language();

scene/main/viewport.cpp

+8-2
Original file line numberDiff line numberDiff line change
@@ -4658,6 +4658,8 @@ void Viewport::_validate_property(PropertyInfo &p_property) const {
46584658
}
46594659
}
46604660

4661+
float Viewport::editor_tooltip_delay = 0.5f;
4662+
46614663
Viewport::Viewport() {
46624664
world_2d = Ref<World2D>(memnew(World2D));
46634665
world_2d->register_viewport(this);
@@ -4691,8 +4693,12 @@ Viewport::Viewport() {
46914693
shortcut_input_group = "_vp_shortcut_input" + id;
46924694
unhandled_key_input_group = "_vp_unhandled_key_input" + id;
46934695

4694-
// Window tooltip.
4695-
gui.tooltip_delay = GLOBAL_DEF(PropertyInfo(Variant::FLOAT, "gui/timers/tooltip_delay_sec", PROPERTY_HINT_RANGE, "0,5,0.01,or_greater"), 0.5);
4696+
// Set the tooltip delay to be either the editor delay, or regular delay, depending on whether this is in the editor or not.
4697+
if (Engine::get_singleton()->is_editor_hint()) {
4698+
gui.tooltip_delay = editor_tooltip_delay;
4699+
} else {
4700+
gui.tooltip_delay = GLOBAL_DEF(PropertyInfo(Variant::FLOAT, "gui/timers/tooltip_delay_sec", PROPERTY_HINT_RANGE, "0,5,0.01,or_greater"), 0.5);
4701+
}
46964702

46974703
#ifndef _3D_DISABLED
46984704
set_scaling_3d_mode((Viewport::Scaling3DMode)(int)GLOBAL_GET("rendering/scaling_3d/mode"));

scene/main/viewport.h

+2
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,8 @@ class Viewport : public Node {
9595
GDCLASS(Viewport, Node);
9696

9797
public:
98+
static float editor_tooltip_delay;
99+
98100
enum Scaling3DMode {
99101
SCALING_3D_MODE_BILINEAR,
100102
SCALING_3D_MODE_FSR,

0 commit comments

Comments
 (0)