From 14cd70faf3b9e431821613b06397973f047cbfc0 Mon Sep 17 00:00:00 2001 From: sanikoyes Date: Tue, 16 Jun 2015 15:15:10 +0800 Subject: Script editor: restore line/column after script reload --- tools/editor/plugins/script_editor_plugin.cpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'tools/editor/plugins/script_editor_plugin.cpp') diff --git a/tools/editor/plugins/script_editor_plugin.cpp b/tools/editor/plugins/script_editor_plugin.cpp index f5ba6a08e6..c04f74475c 100644 --- a/tools/editor/plugins/script_editor_plugin.cpp +++ b/tools/editor/plugins/script_editor_plugin.cpp @@ -286,8 +286,19 @@ void ScriptTextEditor::reload_text() { ERR_FAIL_COND(script.is_null()) ; - get_text_edit()->set_text(script->get_source_code()); - get_text_edit()->clear_undo_history(); + TextEdit *te = get_text_edit(); + int column = te->cursor_get_column(); + int row = te->cursor_get_line(); + int h = te->get_h_scroll(); + int v = te->get_v_scroll(); + + te->set_text(script->get_source_code()); + te->clear_undo_history(); + te->cursor_set_line(row); + te->cursor_set_column(column); + te->set_h_scroll(h); + te->set_v_scroll(v); + _line_col_changed(); } -- cgit v1.2.3 From e9bbb97acccc08ae03fde41e4cc6d2dc6722021a Mon Sep 17 00:00:00 2001 From: Juan Linietsky Date: Mon, 22 Jun 2015 00:03:19 -0300 Subject: Multiple scene editing *POTENTIALLY UNSTABLE* -ability to edit multiple scenes at the same time -resource internal IDs are now persistent, this makes multiple scene editing possible but maaaaay result in file corruption bugs (tested and could not find anything but possibility exists because core code changed, report immediately if you find this). -properly save settings, layout, etc when edited -script editing is independent from scene editing now -show a yellow box when a script belongs to the scene --- tools/editor/plugins/script_editor_plugin.cpp | 381 ++++++++++++++++---------- 1 file changed, 240 insertions(+), 141 deletions(-) (limited to 'tools/editor/plugins/script_editor_plugin.cpp') diff --git a/tools/editor/plugins/script_editor_plugin.cpp b/tools/editor/plugins/script_editor_plugin.cpp index f5ba6a08e6..cf934b988d 100644 --- a/tools/editor/plugins/script_editor_plugin.cpp +++ b/tools/editor/plugins/script_editor_plugin.cpp @@ -38,10 +38,12 @@ #include "os/file_access.h" #include "scene/main/viewport.h" #include "os/keyboard.h" -/*** SCRIPT EDITOR ****/ +#include "os/input.h" +/*** SCRIPT EDITOR ****/ +#define SORT_SCRIPT_LIST void ScriptEditorQuickOpen::popup(const Vector& p_functions, bool p_dontclear) { @@ -118,6 +120,8 @@ void ScriptEditorQuickOpen::_notification(int p_what) { if (p_what==NOTIFICATION_ENTER_TREE) { connect("confirmed",this,"_confirmed"); + + } } @@ -296,12 +300,11 @@ void ScriptTextEditor::_notification(int p_what) { if (p_what==NOTIFICATION_READY) { - _update_name(); + //emit_signal("name_changed"); } } -void ScriptTextEditor::_update_name() { - +String ScriptTextEditor::get_name() { String name; if (script->get_path().find("local://")==-1 && script->get_path().find("::")==-1) { @@ -314,21 +317,20 @@ void ScriptTextEditor::_update_name() { else name=script->get_type()+"("+itos(script->get_instance_ID())+")"; + return name; - if (name!=String(get_name())) { +} - set_name(name); +Ref ScriptTextEditor::get_icon() { + if (get_parent_control() && get_parent_control()->has_icon(script->get_type(),"EditorIcons")) { + return get_parent_control()->get_icon(script->get_type(),"EditorIcons"); } - if (!has_meta("_tab_icon")) { - if (get_parent_control() && get_parent_control()->has_icon(script->get_type(),"EditorIcons")) { - set_meta("_tab_icon",get_parent_control()->get_icon(script->get_type(),"EditorIcons")); - } - } + return Ref(); +} -} void ScriptTextEditor::set_edited_script(const Ref