summaryrefslogtreecommitdiff
path: root/editor/debugger
diff options
context:
space:
mode:
Diffstat (limited to 'editor/debugger')
-rw-r--r--editor/debugger/editor_debugger_node.cpp48
-rw-r--r--editor/debugger/editor_debugger_node.h8
-rw-r--r--editor/debugger/editor_debugger_tree.cpp1
-rw-r--r--editor/debugger/script_editor_debugger.cpp4
4 files changed, 41 insertions, 20 deletions
diff --git a/editor/debugger/editor_debugger_node.cpp b/editor/debugger/editor_debugger_node.cpp
index 150257a95c..610f467faa 100644
--- a/editor/debugger/editor_debugger_node.cpp
+++ b/editor/debugger/editor_debugger_node.cpp
@@ -35,6 +35,8 @@
#include "editor/debugger/script_editor_debugger.h"
#include "editor/editor_log.h"
#include "editor/editor_node.h"
+#include "editor/editor_settings.h"
+#include "editor/inspector_dock.h"
#include "editor/plugins/editor_debugger_plugin.h"
#include "editor/plugins/script_editor_plugin.h"
#include "editor/scene_tree_dock.h"
@@ -207,9 +209,32 @@ String EditorDebuggerNode::get_server_uri() const {
return server->get_uri();
}
+void EditorDebuggerNode::set_keep_open(bool p_keep_open) {
+ keep_open = p_keep_open;
+ if (keep_open) {
+ if (server.is_null() || !server->is_active()) {
+ start();
+ }
+ } else {
+ bool found = false;
+ _for_all(tabs, [&](ScriptEditorDebugger *p_debugger) {
+ if (p_debugger->is_session_active()) {
+ found = true;
+ }
+ });
+ if (!found) {
+ stop();
+ }
+ }
+}
+
Error EditorDebuggerNode::start(const String &p_uri) {
- stop();
ERR_FAIL_COND_V(p_uri.find("://") < 0, ERR_INVALID_PARAMETER);
+ if (keep_open && current_uri == p_uri && server.is_valid()) {
+ return OK;
+ }
+ stop(true);
+ current_uri = p_uri;
if (EDITOR_GET("run/output/always_open_output_on_play")) {
EditorNode::get_singleton()->make_bottom_panel_item_visible(EditorNode::get_log());
} else {
@@ -225,7 +250,11 @@ Error EditorDebuggerNode::start(const String &p_uri) {
return OK;
}
-void EditorDebuggerNode::stop() {
+void EditorDebuggerNode::stop(bool p_force) {
+ if (keep_open && !p_force) {
+ return;
+ }
+ current_uri.clear();
if (server.is_valid()) {
server->stop();
EditorNode::get_log()->add_message("--- Debugging process stopped ---", EditorLog::MSG_TYPE_EDITOR);
@@ -244,11 +273,6 @@ void EditorDebuggerNode::stop() {
}
});
_break_state_changed();
- if (hide_on_stop) {
- if (is_visible_in_tree()) {
- EditorNode::get_singleton()->hide_bottom_panel();
- }
- }
breakpoints.clear();
set_process(false);
}
@@ -428,7 +452,6 @@ void EditorDebuggerNode::set_script_debug_button(MenuButton *p_button) {
p->add_shortcut(ED_GET_SHORTCUT("debugger/break"), DEBUG_BREAK);
p->add_shortcut(ED_GET_SHORTCUT("debugger/continue"), DEBUG_CONTINUE);
p->add_separator();
- p->add_check_shortcut(ED_GET_SHORTCUT("debugger/keep_debugger_open"), DEBUG_KEEP_DEBUGGER_OPEN);
p->add_check_shortcut(ED_GET_SHORTCUT("debugger/debug_with_external_editor"), DEBUG_WITH_EXTERNAL_EDITOR);
p->connect("id_pressed", callable_mp(this, &EditorDebuggerNode::_menu_option));
@@ -468,12 +491,6 @@ void EditorDebuggerNode::_menu_option(int p_id) {
case DEBUG_CONTINUE: {
debug_continue();
} break;
- case DEBUG_KEEP_DEBUGGER_OPEN: {
- bool ischecked = script_menu->get_popup()->is_item_checked(script_menu->get_popup()->get_item_index(DEBUG_KEEP_DEBUGGER_OPEN));
- hide_on_stop = ischecked;
- script_menu->get_popup()->set_item_checked(script_menu->get_popup()->get_item_index(DEBUG_KEEP_DEBUGGER_OPEN), !ischecked);
- EditorSettings::get_singleton()->set_project_metadata("debug_options", "keep_debugger_open", !ischecked);
- } break;
case DEBUG_WITH_EXTERNAL_EDITOR: {
bool ischecked = script_menu->get_popup()->is_item_checked(script_menu->get_popup()->get_item_index(DEBUG_WITH_EXTERNAL_EDITOR));
debug_with_external_editor = !ischecked;
@@ -484,9 +501,6 @@ void EditorDebuggerNode::_menu_option(int p_id) {
}
void EditorDebuggerNode::_update_debug_options() {
- if (EditorSettings::get_singleton()->get_project_metadata("debug_options", "keep_debugger_open", false).operator bool()) {
- _menu_option(DEBUG_KEEP_DEBUGGER_OPEN);
- }
if (EditorSettings::get_singleton()->get_project_metadata("debug_options", "debug_with_external_editor", false).operator bool()) {
_menu_option(DEBUG_WITH_EXTERNAL_EDITOR);
}
diff --git a/editor/debugger/editor_debugger_node.h b/editor/debugger/editor_debugger_node.h
index 7f7279ae74..030f4c7d12 100644
--- a/editor/debugger/editor_debugger_node.h
+++ b/editor/debugger/editor_debugger_node.h
@@ -63,7 +63,6 @@ private:
DEBUG_STEP,
DEBUG_BREAK,
DEBUG_CONTINUE,
- DEBUG_KEEP_DEBUGGER_OPEN,
DEBUG_WITH_EXTERNAL_EDITOR,
};
@@ -110,7 +109,9 @@ private:
float remote_scene_tree_timeout = 0.0;
bool auto_switch_remote_scene_tree = false;
bool debug_with_external_editor = false;
- bool hide_on_stop = true;
+ bool keep_open = false;
+ String current_uri;
+
CameraOverride camera_override = OVERRIDE_NONE;
HashMap<Breakpoint, bool, Breakpoint> breakpoints;
@@ -203,8 +204,9 @@ public:
String get_server_uri() const;
+ void set_keep_open(bool p_keep_open);
Error start(const String &p_uri = "tcp://");
- void stop();
+ void stop(bool p_force = false);
bool plugins_capture(ScriptEditorDebugger *p_debugger, const String &p_message, const Array &p_data);
void add_debugger_plugin(const Ref<EditorDebuggerPlugin> &p_plugin);
diff --git a/editor/debugger/editor_debugger_tree.cpp b/editor/debugger/editor_debugger_tree.cpp
index 4168efda26..8b31781c5e 100644
--- a/editor/debugger/editor_debugger_tree.cpp
+++ b/editor/debugger/editor_debugger_tree.cpp
@@ -34,6 +34,7 @@
#include "editor/editor_node.h"
#include "editor/scene_tree_dock.h"
#include "scene/debugger/scene_debugger.h"
+#include "scene/gui/texture_rect.h"
#include "scene/resources/packed_scene.h"
#include "servers/display_server.h"
diff --git a/editor/debugger/script_editor_debugger.cpp b/editor/debugger/script_editor_debugger.cpp
index 178010d852..deca638f3b 100644
--- a/editor/debugger/script_editor_debugger.cpp
+++ b/editor/debugger/script_editor_debugger.cpp
@@ -46,6 +46,7 @@
#include "editor/editor_property_name_processor.h"
#include "editor/editor_scale.h"
#include "editor/editor_settings.h"
+#include "editor/inspector_dock.h"
#include "editor/plugins/canvas_item_editor_plugin.h"
#include "editor/plugins/editor_debugger_plugin.h"
#include "editor/plugins/node_3d_editor_plugin.h"
@@ -53,6 +54,7 @@
#include "scene/3d/camera_3d.h"
#include "scene/debugger/scene_debugger.h"
#include "scene/gui/dialogs.h"
+#include "scene/gui/grid_container.h"
#include "scene/gui/label.h"
#include "scene/gui/line_edit.h"
#include "scene/gui/margin_container.h"
@@ -1656,6 +1658,8 @@ ScriptEditorDebugger::ScriptEditorDebugger() {
add_child(tabs);
+ InspectorDock::get_inspector_singleton()->connect("object_id_selected", callable_mp(this, &ScriptEditorDebugger::_remote_object_selected));
+
{ //debugger
VBoxContainer *vbc = memnew(VBoxContainer);
vbc->set_name(TTR("Debugger"));