Implement Autostart Feature for Profiler / Visual Profiler / Network Profiler

Co-authored-by: stmSi <stm1998sithumyo@gmail.com>
This commit is contained in:
Hendrik Brucker 2024-09-10 19:40:42 +02:00
parent 27552a2f26
commit c53fd9c7be
8 changed files with 91 additions and 12 deletions

View file

@ -1012,6 +1012,14 @@ void ScriptEditorDebugger::start(Ref<RemoteDebuggerPeer> p_peer) {
_set_reason_text(TTR("Debug session started."), MESSAGE_SUCCESS);
_update_buttons_state();
emit_signal(SNAME("started"));
if (EditorSettings::get_singleton()->get_project_metadata("debug_options", "autostart_profiler", false)) {
profiler->set_profiling(true);
}
if (EditorSettings::get_singleton()->get_project_metadata("debug_options", "autostart_visual_profiler", false)) {
visual_profiler->set_profiling(true);
}
}
void ScriptEditorDebugger::_update_buttons_state() {
@ -1076,10 +1084,10 @@ void ScriptEditorDebugger::stop() {
profiler_signature.clear();
profiler->set_enabled(false, false);
profiler->set_pressed(false);
profiler->set_profiling(false);
visual_profiler->set_enabled(false);
visual_profiler->set_pressed(false);
visual_profiler->set_profiling(false);
inspector->edit(nullptr);
_update_buttons_state();