From 7d7e0344eea1ffb78d8498527adcc03c8c466b73 Mon Sep 17 00:00:00 2001 From: aryan-11825114 Date: Tue, 17 Sep 2024 13:18:21 +0530 Subject: [PATCH] Fix Network Profiler not disabling buttons --- .../multiplayer/editor/editor_network_profiler.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/modules/multiplayer/editor/editor_network_profiler.cpp b/modules/multiplayer/editor/editor_network_profiler.cpp index 3a51712c701..f5f20d69317 100644 --- a/modules/multiplayer/editor/editor_network_profiler.cpp +++ b/modules/multiplayer/editor/editor_network_profiler.cpp @@ -193,6 +193,9 @@ void EditorNetworkProfiler::_update_button_text() { } void EditorNetworkProfiler::started() { + _clear_pressed(); + activate->set_disabled(false); + if (EditorSettings::get_singleton()->get_project_metadata("debug_options", "autostart_network_profiler", false)) { set_profiling(true); refresh_timer->start(); @@ -200,6 +203,7 @@ void EditorNetworkProfiler::started() { } void EditorNetworkProfiler::stopped() { + activate->set_disabled(true); set_profiling(false); refresh_timer->stop(); } @@ -218,6 +222,7 @@ void EditorNetworkProfiler::_clear_pressed() { set_bandwidth(0, 0); refresh_rpc_data(); refresh_replication_data(); + clear_button->set_disabled(true); } void EditorNetworkProfiler::_autostart_toggled(bool p_toggled_on) { @@ -235,6 +240,9 @@ void EditorNetworkProfiler::_replication_button_clicked(TreeItem *p_item, int p_ } void EditorNetworkProfiler::add_rpc_frame_data(const RPCNodeInfo &p_frame) { + if (clear_button->is_disabled()) { + clear_button->set_disabled(false); + } dirty = true; if (!rpc_data.has(p_frame.node)) { rpc_data.insert(p_frame.node, p_frame); @@ -251,6 +259,9 @@ void EditorNetworkProfiler::add_rpc_frame_data(const RPCNodeInfo &p_frame) { } void EditorNetworkProfiler::add_sync_frame_data(const SyncInfo &p_frame) { + if (clear_button->is_disabled()) { + clear_button->set_disabled(false); + } dirty = true; if (!sync_data.has(p_frame.synchronizer)) { sync_data[p_frame.synchronizer] = p_frame; @@ -292,11 +303,13 @@ EditorNetworkProfiler::EditorNetworkProfiler() { activate = memnew(Button); activate->set_toggle_mode(true); activate->set_text(TTR("Start")); + activate->set_disabled(true); activate->connect(SceneStringName(pressed), callable_mp(this, &EditorNetworkProfiler::_activate_pressed)); hb->add_child(activate); clear_button = memnew(Button); clear_button->set_text(TTR("Clear")); + clear_button->set_disabled(true); clear_button->connect(SceneStringName(pressed), callable_mp(this, &EditorNetworkProfiler::_clear_pressed)); hb->add_child(clear_button);