summaryrefslogtreecommitdiff
path: root/editor/plugins
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2019-02-20 12:07:49 +0100
committerRémi Verschelde <rverschelde@gmail.com>2019-02-20 12:16:22 +0100
commitd1f68e2eaff1be8e2836cb991b2b922f8faf1cd8 (patch)
treeecc31bc73c81782e16ede5ccbb6ceddd207be6f3 /editor/plugins
parentf41439c84b206067adeea9c97eaf87fb264ee682 (diff)
Add tooltip for in-editor FPS display in 3D viewport
Also enhance Control/Label documentation about tooltips and mouse filter, as it took me a while to understand why Labels didn't show tooltips. Closes #26082.
Diffstat (limited to 'editor/plugins')
-rw-r--r--editor/plugins/spatial_editor_plugin.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/editor/plugins/spatial_editor_plugin.cpp b/editor/plugins/spatial_editor_plugin.cpp
index 41666f1082..4d1e0c08ce 100644
--- a/editor/plugins/spatial_editor_plugin.cpp
+++ b/editor/plugins/spatial_editor_plugin.cpp
@@ -2262,7 +2262,7 @@ void SpatialEditorViewport::_notification(int p_what) {
if (show_fps) {
String text;
const float temp_fps = Engine::get_singleton()->get_frames_per_second();
- text += TTR("FPS") + ": " + itos(temp_fps) + " (" + String::num(1000.0f / temp_fps, 2) + " ms)";
+ text += TTR(vformat("FPS: %d (%s ms)", temp_fps, String::num(1000.0f / temp_fps, 2)));
fps_label->set_text(text);
}
@@ -3554,6 +3554,8 @@ SpatialEditorViewport::SpatialEditorViewport(SpatialEditor *p_spatial_editor, Ed
fps_label->set_anchor_and_margin(MARGIN_TOP, ANCHOR_BEGIN, 10 * EDSCALE);
fps_label->set_anchor_and_margin(MARGIN_RIGHT, ANCHOR_END, -10 * EDSCALE);
fps_label->set_h_grow_direction(GROW_DIRECTION_BEGIN);
+ fps_label->set_tooltip(TTR("Note: The FPS value displayed is the editor's framerate.\nIt cannot be used as a reliable indication of in-game performance."));
+ fps_label->set_mouse_filter(MOUSE_FILTER_PASS); // Otherwise tooltip doesn't show.
surface->add_child(fps_label);
fps_label->hide();