diff options
Diffstat (limited to 'editor/debugger')
-rw-r--r-- | editor/debugger/debug_adapter/debug_adapter_server.cpp | 11 | ||||
-rw-r--r-- | editor/debugger/editor_debugger_inspector.cpp | 11 | ||||
-rw-r--r-- | editor/debugger/editor_debugger_node.cpp | 193 | ||||
-rw-r--r-- | editor/debugger/editor_debugger_tree.cpp | 10 | ||||
-rw-r--r-- | editor/debugger/editor_network_profiler.cpp | 21 | ||||
-rw-r--r-- | editor/debugger/editor_profiler.cpp | 10 | ||||
-rw-r--r-- | editor/debugger/editor_visual_profiler.cpp | 18 | ||||
-rw-r--r-- | editor/debugger/script_editor_debugger.cpp | 3 |
8 files changed, 147 insertions, 130 deletions
diff --git a/editor/debugger/debug_adapter/debug_adapter_server.cpp b/editor/debugger/debug_adapter/debug_adapter_server.cpp index ffbbf66015..e9fc7ec913 100644 --- a/editor/debugger/debug_adapter/debug_adapter_server.cpp +++ b/editor/debugger/debug_adapter/debug_adapter_server.cpp @@ -42,12 +42,14 @@ DebugAdapterServer::DebugAdapterServer() { void DebugAdapterServer::_notification(int p_what) { switch (p_what) { - case NOTIFICATION_ENTER_TREE: + case NOTIFICATION_ENTER_TREE: { start(); - break; - case NOTIFICATION_EXIT_TREE: + } break; + + case NOTIFICATION_EXIT_TREE: { stop(); - break; + } break; + case NOTIFICATION_INTERNAL_PROCESS: { // The main loop can be run again during request processing, which modifies internal state of the protocol. // Thus, "polling" is needed to prevent it from parsing other requests while the current one isn't finished. @@ -57,6 +59,7 @@ void DebugAdapterServer::_notification(int p_what) { polling = false; } } break; + case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: { protocol._request_timeout = EditorSettings::get_singleton()->get("network/debug_adapter/request_timeout"); protocol._sync_breakpoints = EditorSettings::get_singleton()->get("network/debug_adapter/sync_breakpoints"); diff --git a/editor/debugger/editor_debugger_inspector.cpp b/editor/debugger/editor_debugger_inspector.cpp index ad782c87cb..c111190ca3 100644 --- a/editor/debugger/editor_debugger_inspector.cpp +++ b/editor/debugger/editor_debugger_inspector.cpp @@ -107,14 +107,13 @@ void EditorDebuggerInspector::_bind_methods() { void EditorDebuggerInspector::_notification(int p_what) { switch (p_what) { - case NOTIFICATION_POSTINITIALIZE: + case NOTIFICATION_POSTINITIALIZE: { connect("object_id_selected", callable_mp(this, &EditorDebuggerInspector::_object_selected)); - break; - case NOTIFICATION_ENTER_TREE: + } break; + + case NOTIFICATION_ENTER_TREE: { edit(variables); - break; - default: - break; + } break; } } diff --git a/editor/debugger/editor_debugger_node.cpp b/editor/debugger/editor_debugger_node.cpp index 26032a9d32..7c9a984b6a 100644 --- a/editor/debugger/editor_debugger_node.cpp +++ b/editor/debugger/editor_debugger_node.cpp @@ -240,112 +240,113 @@ void EditorDebuggerNode::_notification(int p_what) { tabs->add_theme_style_override("panel", EditorNode::get_singleton()->get_gui_base()->get_theme_stylebox(SNAME("DebuggerPanel"), SNAME("EditorStyles"))); } } break; + case NOTIFICATION_READY: { _update_debug_options(); } break; - default: - break; - } - - if (p_what != NOTIFICATION_PROCESS || !server.is_valid()) { - return; - } - - if (!server.is_valid() || !server->is_active()) { - stop(); - return; - } - server->poll(); - - // Errors and warnings - int error_count = 0; - int warning_count = 0; - _for_all(tabs, [&](ScriptEditorDebugger *dbg) { - error_count += dbg->get_error_count(); - warning_count += dbg->get_warning_count(); - }); - if (error_count != last_error_count || warning_count != last_warning_count) { - _for_all(tabs, [&](ScriptEditorDebugger *dbg) { - dbg->update_tabs(); - }); - - if (error_count == 0 && warning_count == 0) { - debugger_button->set_text(TTR("Debugger")); - debugger_button->remove_theme_color_override("font_color"); - debugger_button->set_icon(Ref<Texture2D>()); - } else { - debugger_button->set_text(TTR("Debugger") + " (" + itos(error_count + warning_count) + ")"); - if (error_count >= 1 && warning_count >= 1) { - debugger_button->set_icon(get_theme_icon(SNAME("ErrorWarning"), SNAME("EditorIcons"))); - // Use error color to represent the highest level of severity reported. - debugger_button->add_theme_color_override("font_color", get_theme_color(SNAME("error_color"), SNAME("Editor"))); - } else if (error_count >= 1) { - debugger_button->set_icon(get_theme_icon(SNAME("Error"), SNAME("EditorIcons"))); - debugger_button->add_theme_color_override("font_color", get_theme_color(SNAME("error_color"), SNAME("Editor"))); - } else { - debugger_button->set_icon(get_theme_icon(SNAME("Warning"), SNAME("EditorIcons"))); - debugger_button->add_theme_color_override("font_color", get_theme_color(SNAME("warning_color"), SNAME("Editor"))); + case NOTIFICATION_PROCESS: { + if (!server.is_valid()) { + return; } - } - last_error_count = error_count; - last_warning_count = warning_count; - } - // Remote scene tree update - remote_scene_tree_timeout -= get_process_delta_time(); - if (remote_scene_tree_timeout < 0) { - remote_scene_tree_timeout = EditorSettings::get_singleton()->get("debugger/remote_scene_tree_refresh_interval"); - if (remote_scene_tree->is_visible_in_tree()) { - get_current_debugger()->request_remote_tree(); - } - } - - // Remote inspector update - inspect_edited_object_timeout -= get_process_delta_time(); - if (inspect_edited_object_timeout < 0) { - inspect_edited_object_timeout = EditorSettings::get_singleton()->get("debugger/remote_inspect_refresh_interval"); - if (EditorDebuggerRemoteObject *obj = get_inspected_remote_object()) { - get_current_debugger()->request_remote_object(obj->remote_object_id); - } - } - - // Take connections. - if (server->is_connection_available()) { - ScriptEditorDebugger *debugger = nullptr; - _for_all(tabs, [&](ScriptEditorDebugger *dbg) { - if (debugger || dbg->is_session_active()) { + if (!server->is_active()) { + stop(); return; } - debugger = dbg; - }); - if (debugger == nullptr) { - if (tabs->get_tab_count() <= 4) { // Max 4 debugging sessions active. - debugger = _add_debugger(); - } else { - // We already have too many sessions, disconnecting new clients to prevent them from hanging. - server->take_connection()->close(); - return; // Can't add, stop here. + server->poll(); + + // Errors and warnings + int error_count = 0; + int warning_count = 0; + _for_all(tabs, [&](ScriptEditorDebugger *dbg) { + error_count += dbg->get_error_count(); + warning_count += dbg->get_warning_count(); + }); + + if (error_count != last_error_count || warning_count != last_warning_count) { + _for_all(tabs, [&](ScriptEditorDebugger *dbg) { + dbg->update_tabs(); + }); + + if (error_count == 0 && warning_count == 0) { + debugger_button->set_text(TTR("Debugger")); + debugger_button->remove_theme_color_override("font_color"); + debugger_button->set_icon(Ref<Texture2D>()); + } else { + debugger_button->set_text(TTR("Debugger") + " (" + itos(error_count + warning_count) + ")"); + if (error_count >= 1 && warning_count >= 1) { + debugger_button->set_icon(get_theme_icon(SNAME("ErrorWarning"), SNAME("EditorIcons"))); + // Use error color to represent the highest level of severity reported. + debugger_button->add_theme_color_override("font_color", get_theme_color(SNAME("error_color"), SNAME("Editor"))); + } else if (error_count >= 1) { + debugger_button->set_icon(get_theme_icon(SNAME("Error"), SNAME("EditorIcons"))); + debugger_button->add_theme_color_override("font_color", get_theme_color(SNAME("error_color"), SNAME("Editor"))); + } else { + debugger_button->set_icon(get_theme_icon(SNAME("Warning"), SNAME("EditorIcons"))); + debugger_button->add_theme_color_override("font_color", get_theme_color(SNAME("warning_color"), SNAME("Editor"))); + } + } + last_error_count = error_count; + last_warning_count = warning_count; } - } - EditorNode::get_singleton()->get_pause_button()->set_disabled(false); - // Switch to remote tree view if so desired. - auto_switch_remote_scene_tree = (bool)EditorSettings::get_singleton()->get("debugger/auto_switch_to_remote_scene_tree"); - if (auto_switch_remote_scene_tree) { - SceneTreeDock::get_singleton()->show_remote_tree(); - } - // Good to go. - SceneTreeDock::get_singleton()->show_tab_buttons(); - debugger->set_editor_remote_tree(remote_scene_tree); - debugger->start(server->take_connection()); - // Send breakpoints. - for (const KeyValue<Breakpoint, bool> &E : breakpoints) { - const Breakpoint &bp = E.key; - debugger->set_breakpoint(bp.source, bp.line, E.value); - } // Will arrive too late, how does the regular run work? - - debugger->update_live_edit_root(); + // Remote scene tree update + remote_scene_tree_timeout -= get_process_delta_time(); + if (remote_scene_tree_timeout < 0) { + remote_scene_tree_timeout = EditorSettings::get_singleton()->get("debugger/remote_scene_tree_refresh_interval"); + if (remote_scene_tree->is_visible_in_tree()) { + get_current_debugger()->request_remote_tree(); + } + } + + // Remote inspector update + inspect_edited_object_timeout -= get_process_delta_time(); + if (inspect_edited_object_timeout < 0) { + inspect_edited_object_timeout = EditorSettings::get_singleton()->get("debugger/remote_inspect_refresh_interval"); + if (EditorDebuggerRemoteObject *obj = get_inspected_remote_object()) { + get_current_debugger()->request_remote_object(obj->remote_object_id); + } + } + + // Take connections. + if (server->is_connection_available()) { + ScriptEditorDebugger *debugger = nullptr; + _for_all(tabs, [&](ScriptEditorDebugger *dbg) { + if (debugger || dbg->is_session_active()) { + return; + } + debugger = dbg; + }); + if (debugger == nullptr) { + if (tabs->get_tab_count() <= 4) { // Max 4 debugging sessions active. + debugger = _add_debugger(); + } else { + // We already have too many sessions, disconnecting new clients to prevent them from hanging. + server->take_connection()->close(); + return; // Can't add, stop here. + } + } + + EditorNode::get_singleton()->get_pause_button()->set_disabled(false); + // Switch to remote tree view if so desired. + auto_switch_remote_scene_tree = (bool)EditorSettings::get_singleton()->get("debugger/auto_switch_to_remote_scene_tree"); + if (auto_switch_remote_scene_tree) { + SceneTreeDock::get_singleton()->show_remote_tree(); + } + // Good to go. + SceneTreeDock::get_singleton()->show_tab_buttons(); + debugger->set_editor_remote_tree(remote_scene_tree); + debugger->start(server->take_connection()); + // Send breakpoints. + for (const KeyValue<Breakpoint, bool> &E : breakpoints) { + const Breakpoint &bp = E.key; + debugger->set_breakpoint(bp.source, bp.line, E.value); + } // Will arrive too late, how does the regular run work? + + debugger->update_live_edit_root(); + } + } break; } } diff --git a/editor/debugger/editor_debugger_tree.cpp b/editor/debugger/editor_debugger_tree.cpp index c1fffae404..3a65d015d5 100644 --- a/editor/debugger/editor_debugger_tree.cpp +++ b/editor/debugger/editor_debugger_tree.cpp @@ -53,10 +53,12 @@ EditorDebuggerTree::EditorDebuggerTree() { } void EditorDebuggerTree::_notification(int p_what) { - if (p_what == NOTIFICATION_POSTINITIALIZE) { - connect("cell_selected", callable_mp(this, &EditorDebuggerTree::_scene_tree_selected)); - connect("item_collapsed", callable_mp(this, &EditorDebuggerTree::_scene_tree_folded)); - connect("item_rmb_selected", callable_mp(this, &EditorDebuggerTree::_scene_tree_rmb_selected)); + switch (p_what) { + case NOTIFICATION_POSTINITIALIZE: { + connect("cell_selected", callable_mp(this, &EditorDebuggerTree::_scene_tree_selected)); + connect("item_collapsed", callable_mp(this, &EditorDebuggerTree::_scene_tree_folded)); + connect("item_rmb_selected", callable_mp(this, &EditorDebuggerTree::_scene_tree_rmb_selected)); + } break; } } diff --git a/editor/debugger/editor_network_profiler.cpp b/editor/debugger/editor_network_profiler.cpp index b05134144e..8c18eba71d 100644 --- a/editor/debugger/editor_network_profiler.cpp +++ b/editor/debugger/editor_network_profiler.cpp @@ -39,15 +39,18 @@ void EditorNetworkProfiler::_bind_methods() { } void EditorNetworkProfiler::_notification(int p_what) { - if (p_what == NOTIFICATION_ENTER_TREE || p_what == NOTIFICATION_THEME_CHANGED) { - activate->set_icon(get_theme_icon(SNAME("Play"), SNAME("EditorIcons"))); - clear_button->set_icon(get_theme_icon(SNAME("Clear"), SNAME("EditorIcons"))); - incoming_bandwidth_text->set_right_icon(get_theme_icon(SNAME("ArrowDown"), SNAME("EditorIcons"))); - outgoing_bandwidth_text->set_right_icon(get_theme_icon(SNAME("ArrowUp"), SNAME("EditorIcons"))); - - // This needs to be done here to set the faded color when the profiler is first opened - incoming_bandwidth_text->add_theme_color_override("font_uneditable_color", get_theme_color(SNAME("font_color"), SNAME("Editor")) * Color(1, 1, 1, 0.5)); - outgoing_bandwidth_text->add_theme_color_override("font_uneditable_color", get_theme_color(SNAME("font_color"), SNAME("Editor")) * Color(1, 1, 1, 0.5)); + switch (p_what) { + case NOTIFICATION_ENTER_TREE: + case NOTIFICATION_THEME_CHANGED: { + activate->set_icon(get_theme_icon(SNAME("Play"), SNAME("EditorIcons"))); + clear_button->set_icon(get_theme_icon(SNAME("Clear"), SNAME("EditorIcons"))); + incoming_bandwidth_text->set_right_icon(get_theme_icon(SNAME("ArrowDown"), SNAME("EditorIcons"))); + outgoing_bandwidth_text->set_right_icon(get_theme_icon(SNAME("ArrowUp"), SNAME("EditorIcons"))); + + // This needs to be done here to set the faded color when the profiler is first opened + incoming_bandwidth_text->add_theme_color_override("font_uneditable_color", get_theme_color(SNAME("font_color"), SNAME("Editor")) * Color(1, 1, 1, 0.5)); + outgoing_bandwidth_text->add_theme_color_override("font_uneditable_color", get_theme_color(SNAME("font_color"), SNAME("Editor")) * Color(1, 1, 1, 0.5)); + } break; } } diff --git a/editor/debugger/editor_profiler.cpp b/editor/debugger/editor_profiler.cpp index da1d6a54f2..4b263e5152 100644 --- a/editor/debugger/editor_profiler.cpp +++ b/editor/debugger/editor_profiler.cpp @@ -393,9 +393,13 @@ void EditorProfiler::_clear_pressed() { } void EditorProfiler::_notification(int p_what) { - if (p_what == NOTIFICATION_ENTER_TREE || p_what == NOTIFICATION_LAYOUT_DIRECTION_CHANGED || p_what == NOTIFICATION_TRANSLATION_CHANGED) { - activate->set_icon(get_theme_icon(SNAME("Play"), SNAME("EditorIcons"))); - clear_button->set_icon(get_theme_icon(SNAME("Clear"), SNAME("EditorIcons"))); + switch (p_what) { + case NOTIFICATION_ENTER_TREE: + case NOTIFICATION_LAYOUT_DIRECTION_CHANGED: + case NOTIFICATION_TRANSLATION_CHANGED: { + activate->set_icon(get_theme_icon(SNAME("Play"), SNAME("EditorIcons"))); + clear_button->set_icon(get_theme_icon(SNAME("Clear"), SNAME("EditorIcons"))); + } break; } } diff --git a/editor/debugger/editor_visual_profiler.cpp b/editor/debugger/editor_visual_profiler.cpp index 3cb5d3513d..c137740bda 100644 --- a/editor/debugger/editor_visual_profiler.cpp +++ b/editor/debugger/editor_visual_profiler.cpp @@ -423,13 +423,17 @@ void EditorVisualProfiler::_clear_pressed() { } void EditorVisualProfiler::_notification(int p_what) { - if (p_what == NOTIFICATION_ENTER_TREE || p_what == NOTIFICATION_LAYOUT_DIRECTION_CHANGED || p_what == NOTIFICATION_TRANSLATION_CHANGED) { - if (is_layout_rtl()) { - activate->set_icon(get_theme_icon(SNAME("PlayBackwards"), SNAME("EditorIcons"))); - } else { - activate->set_icon(get_theme_icon(SNAME("Play"), SNAME("EditorIcons"))); - } - clear_button->set_icon(get_theme_icon(SNAME("Clear"), SNAME("EditorIcons"))); + switch (p_what) { + case NOTIFICATION_ENTER_TREE: + case NOTIFICATION_LAYOUT_DIRECTION_CHANGED: + case NOTIFICATION_TRANSLATION_CHANGED: { + if (is_layout_rtl()) { + activate->set_icon(get_theme_icon(SNAME("PlayBackwards"), SNAME("EditorIcons"))); + } else { + activate->set_icon(get_theme_icon(SNAME("Play"), SNAME("EditorIcons"))); + } + clear_button->set_icon(get_theme_icon(SNAME("Clear"), SNAME("EditorIcons"))); + } break; } } diff --git a/editor/debugger/script_editor_debugger.cpp b/editor/debugger/script_editor_debugger.cpp index e08ddff816..645d7608f3 100644 --- a/editor/debugger/script_editor_debugger.cpp +++ b/editor/debugger/script_editor_debugger.cpp @@ -796,8 +796,8 @@ void ScriptEditorDebugger::_notification(int p_what) { search->set_right_icon(get_theme_icon(SNAME("Search"), SNAME("EditorIcons"))); reason->add_theme_color_override("font_color", get_theme_color(SNAME("error_color"), SNAME("Editor"))); - } break; + case NOTIFICATION_PROCESS: { if (is_session_active()) { peer->poll(); @@ -857,6 +857,7 @@ void ScriptEditorDebugger::_notification(int p_what) { break; }; } break; + case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: { if (tabs->has_theme_stylebox_override("panel")) { tabs->add_theme_style_override("panel", EditorNode::get_singleton()->get_gui_base()->get_theme_stylebox(SNAME("DebuggerPanel"), SNAME("EditorStyles"))); |