diff options
Diffstat (limited to 'editor')
-rw-r--r-- | editor/plugins/script_editor_plugin.cpp | 24 | ||||
-rw-r--r-- | editor/plugins/script_editor_plugin.h | 1 | ||||
-rw-r--r-- | editor/plugins/script_text_editor.cpp | 2 | ||||
-rw-r--r-- | editor/script_editor_debugger.cpp | 21 | ||||
-rw-r--r-- | editor/script_editor_debugger.h | 7 |
5 files changed, 46 insertions, 9 deletions
diff --git a/editor/plugins/script_editor_plugin.cpp b/editor/plugins/script_editor_plugin.cpp index f3941d6a16..0024870665 100644 --- a/editor/plugins/script_editor_plugin.cpp +++ b/editor/plugins/script_editor_plugin.cpp @@ -313,6 +313,13 @@ void ScriptEditor::_goto_script_line(REF p_script, int p_line) { editor->push_item(p_script.ptr()); + if (bool(EditorSettings::get_singleton()->get("text_editor/external/use_external_editor"))) { + + Ref<Script> script = p_script->cast_to<Script>(); + if (!script.is_null() && script->get_path().is_resource_file()) + edit(p_script, p_line, 0); + } + int selected = tab_container->get_current_tab(); if (selected < 0 || selected >= tab_container->get_child_count()) return; @@ -866,6 +873,11 @@ void ScriptEditor::_menu_option(int p_option) { debugger->set_hide_on_stop(visible); debug_menu->get_popup()->set_item_checked(debug_menu->get_popup()->get_item_index(DEBUG_SHOW_KEEP_OPEN), !visible); } break; + case DEBUG_WITH_EXTERNAL_EDITOR: { + bool debug_with_external_editor = !debug_menu->get_popup()->is_item_checked(debug_menu->get_popup()->get_item_index(DEBUG_WITH_EXTERNAL_EDITOR)); + debugger->set_debug_with_external_editor(debug_with_external_editor); + debug_menu->get_popup()->set_item_checked(debug_menu->get_popup()->get_item_index(DEBUG_WITH_EXTERNAL_EDITOR), debug_with_external_editor); + } } int selected = tab_container->get_current_tab(); @@ -1545,13 +1557,10 @@ bool ScriptEditor::edit(const Ref<Script> &p_script, int p_line, int p_col, bool bool open_dominant = EditorSettings::get_singleton()->get("text_editor/files/open_dominant_script_on_scene_change"); - Error err = p_script->get_language()->open_in_external_editor(p_script, p_line >= 0 ? p_line : 0, p_col); - if (err == OK) - return false; - if (err != ERR_UNAVAILABLE) - WARN_PRINT("Couldn't open in custom external text editor"); - - if (p_script->get_path().is_resource_file() && bool(EditorSettings::get_singleton()->get("text_editor/external/use_external_editor"))) { + if ((debugger->get_dump_stack_script() != p_script || debugger->get_debug_with_external_editor()) && + p_script->get_language()->open_in_external_editor(p_script, p_line >= 0 ? p_line : 0, p_col) == OK && + p_script->get_path().is_resource_file() && + bool(EditorSettings::get_singleton()->get("text_editor/external/use_external_editor"))) { String path = EditorSettings::get_singleton()->get("text_editor/external/exec_path"); String flags = EditorSettings::get_singleton()->get("text_editor/external/exec_flags"); @@ -2244,6 +2253,7 @@ ScriptEditor::ScriptEditor(EditorNode *p_editor) { debug_menu->get_popup()->add_separator(); //debug_menu->get_popup()->add_check_item("Show Debugger",DEBUG_SHOW); debug_menu->get_popup()->add_check_shortcut(ED_SHORTCUT("debugger/keep_debugger_open", TTR("Keep Debugger Open")), DEBUG_SHOW_KEEP_OPEN); + debug_menu->get_popup()->add_check_shortcut(ED_SHORTCUT("debugger/debug_with_exteral_editor", TTR("Debug with external editor")), DEBUG_WITH_EXTERNAL_EDITOR); debug_menu->get_popup()->connect("id_pressed", this, "_menu_option"); debug_menu->get_popup()->set_item_disabled(debug_menu->get_popup()->get_item_index(DEBUG_NEXT), true); diff --git a/editor/plugins/script_editor_plugin.h b/editor/plugins/script_editor_plugin.h index e036d1ed9c..3b444c0883 100644 --- a/editor/plugins/script_editor_plugin.h +++ b/editor/plugins/script_editor_plugin.h @@ -141,6 +141,7 @@ class ScriptEditor : public VBoxContainer { DEBUG_CONTINUE, DEBUG_SHOW, DEBUG_SHOW_KEEP_OPEN, + DEBUG_WITH_EXTERNAL_EDITOR, SEARCH_HELP, SEARCH_CLASSES, SEARCH_WEBSITE, diff --git a/editor/plugins/script_text_editor.cpp b/editor/plugins/script_text_editor.cpp index 9f76119374..60fd9d8e30 100644 --- a/editor/plugins/script_text_editor.cpp +++ b/editor/plugins/script_text_editor.cpp @@ -557,6 +557,8 @@ void ScriptEditor::_update_modified_scripts_for_external_editor(Ref<Script> p_fo if (!bool(EditorSettings::get_singleton()->get("text_editor/external/use_external_editor"))) return; + ERR_FAIL_COND(!get_tree()); + Set<Ref<Script> > scripts; Node *base = get_tree()->get_edited_scene_root(); diff --git a/editor/script_editor_debugger.cpp b/editor/script_editor_debugger.cpp index 6d22935dcb..9dce48937c 100644 --- a/editor/script_editor_debugger.cpp +++ b/editor/script_editor_debugger.cpp @@ -1137,8 +1137,9 @@ void ScriptEditorDebugger::_stack_dump_frame_selected() { Dictionary d = ti->get_metadata(0); - Ref<Script> s = ResourceLoader::load(d["file"]); - emit_signal("goto_script_line", s, int(d["line"]) - 1); + stack_script = ResourceLoader::load(d["file"]); + emit_signal("goto_script_line", stack_script, int(d["line"]) - 1); + stack_script.unref(); ERR_FAIL_COND(connection.is_null()); ERR_FAIL_COND(!connection->is_connected_to_host()); @@ -1522,6 +1523,21 @@ void ScriptEditorDebugger::set_hide_on_stop(bool p_hide) { hide_on_stop = p_hide; } +bool ScriptEditorDebugger::get_debug_with_external_editor() const { + + return enable_external_editor; +} + +void ScriptEditorDebugger::set_debug_with_external_editor(bool p_enabled) { + + enable_external_editor = p_enabled; +} + +Ref<Script> ScriptEditorDebugger::get_dump_stack_script() const { + + return stack_script; +} + void ScriptEditorDebugger::_paused() { ERR_FAIL_COND(connection.is_null()); @@ -1871,6 +1887,7 @@ ScriptEditorDebugger::ScriptEditorDebugger(EditorNode *p_editor) { last_path_id = false; error_count = 0; hide_on_stop = true; + enable_external_editor = false; last_error_count = 0; EditorNode::get_singleton()->get_pause_button()->connect("pressed", this, "_paused"); diff --git a/editor/script_editor_debugger.h b/editor/script_editor_debugger.h index 49a4abb6ac..907c267d49 100644 --- a/editor/script_editor_debugger.h +++ b/editor/script_editor_debugger.h @@ -84,6 +84,8 @@ class ScriptEditorDebugger : public Control { int last_error_count; bool hide_on_stop; + bool enable_external_editor; + Ref<Script> stack_script; TabContainer *tabs; @@ -201,6 +203,11 @@ public: void set_hide_on_stop(bool p_hide); + bool get_debug_with_external_editor() const; + void set_debug_with_external_editor(bool p_enabled); + + Ref<Script> get_dump_stack_script() const; + void set_tool_button(Button *p_tb) { debugger_button = p_tb; } void reload_scripts(); |