From 43065f1fc7276daf605d9053f9459ba78d30c13a Mon Sep 17 00:00:00 2001 From: Hugo Locurcio Date: Fri, 31 Mar 2023 00:39:32 +0200 Subject: [PATCH] Display real FPS in the 3D editor instead of estimating based on CPU/GPU time This reverts to the 3.x method for displaying FPS in the View Frame Time panel. This has two consequences: - The reported FPS will no longer go past V-Sync or framerate limiters. - Unfocusing the window will display a low framerate (10 FPS by default), since the FPS is actually being limited by the engine's low-processor mode. Constant redrawing is still forced while the panel is visible, so there's no risk of having low-processor mode interfere. --- editor/plugins/node_3d_editor_plugin.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/editor/plugins/node_3d_editor_plugin.cpp b/editor/plugins/node_3d_editor_plugin.cpp index 68d3661d10a6..549105cf5671 100644 --- a/editor/plugins/node_3d_editor_plugin.cpp +++ b/editor/plugins/node_3d_editor_plugin.cpp @@ -2892,8 +2892,8 @@ void Node3DEditorViewport::_notification(int p_what) { frame_time_gradient->get_color_at_offset( Math::remap(gpu_time, 0, 30, 0, 1))); - const double fps = 1000.0 / gpu_time; - fps_label->set_text(vformat(TTR("FPS: %d"), fps)); + const double fps = Engine::get_singleton()->get_frames_per_second(); + fps_label->set_text(vformat(TTR("Editor FPS: %d"), fps)); // Middle point is at 60 FPS. fps_label->add_theme_color_override( "font_color",