diff --git a/core/io/resource_format_binary.cpp b/core/io/resource_format_binary.cpp index 4cd3cd595fe..9a3a191b3b9 100644 --- a/core/io/resource_format_binary.cpp +++ b/core/io/resource_format_binary.cpp @@ -853,6 +853,8 @@ String ResourceInteractiveLoaderBinary::get_unicode_string() { if (len>str_buf.size()) { str_buf.resize(len); } + if (len==0) + return String(); f->get_buffer((uint8_t*)&str_buf[0],len); String s; s.parse_utf8(&str_buf[0]); diff --git a/tools/editor/editor_data.cpp b/tools/editor/editor_data.cpp index 673ee30adbc..a6aedf27063 100644 --- a/tools/editor/editor_data.cpp +++ b/tools/editor/editor_data.cpp @@ -338,6 +338,14 @@ void EditorData::set_editor_states(const Dictionary& p_states) { } +void EditorData::notify_edited_scene_changed() { + + for(int i=0;iedited_scene_changed(); + } +} + void EditorData::clear_editor_states() { for(int i=0;iget_debugger()->update_live_edit_root(); ScriptEditor::get_singleton()->set_scene_root_script( editor_data.get_scene_root_script(editor_data.get_edited_scene()) ); + editor_data.notify_edited_scene_changed(); + //changing_scene=false; } diff --git a/tools/editor/editor_plugin.h b/tools/editor/editor_plugin.h index 0f3a1e2e3cd..6850be2eaa0 100644 --- a/tools/editor/editor_plugin.h +++ b/tools/editor/editor_plugin.h @@ -92,6 +92,7 @@ public: virtual bool get_remove_list(List *p_list); virtual void set_window_layout(Ref p_layout); virtual void get_window_layout(Ref p_layout); + virtual void edited_scene_changed(){}; // if changes are pending in editor, apply them virtual void restore_global_state(); virtual void save_global_state(); diff --git a/tools/editor/plugins/script_editor_plugin.cpp b/tools/editor/plugins/script_editor_plugin.cpp index 4e394f9e3f5..37f4076a0c3 100644 --- a/tools/editor/plugins/script_editor_plugin.cpp +++ b/tools/editor/plugins/script_editor_plugin.cpp @@ -379,6 +379,8 @@ void ScriptTextEditor::reload_text() { te->set_h_scroll(h); te->set_v_scroll(v); + te->tag_saved_version(); + _line_col_changed(); } @@ -391,6 +393,12 @@ void ScriptTextEditor::_notification(int p_what) { } } + +bool ScriptTextEditor::is_unsaved() { + + return get_text_edit()->get_version()!=get_text_edit()->get_saved_version(); +} + String ScriptTextEditor::get_name() { String name; @@ -492,6 +500,59 @@ static Node* _find_node_for_script(Node* p_base, Node*p_current, const Ref > &r_scripts) { + + if (p_current->get_owner()!=p_base && p_base!=p_current) + return; + Ref