From 72f4394d8cec115d8d3032e57babab5eceeb1f2b Mon Sep 17 00:00:00 2001 From: ajreckof Date: Thu, 5 Sep 2024 21:31:24 +0200 Subject: [PATCH 001/111] avoid bubbling up changed notification when on new item/key of dictionaries to avoid inspector whipeout. --- editor/editor_properties_array_dict.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/editor/editor_properties_array_dict.cpp b/editor/editor_properties_array_dict.cpp index f5d016629f7..6adb78aa876 100644 --- a/editor/editor_properties_array_dict.cpp +++ b/editor/editor_properties_array_dict.cpp @@ -869,7 +869,11 @@ void EditorPropertyDictionary::_property_changed(const String &p_property, Varia } object->set(p_property, p_value); - emit_changed(get_edited_property(), object->get_dict(), p_name, p_changing); + bool new_item_or_key = !p_property.begins_with("indices"); + emit_changed(get_edited_property(), object->get_dict(), p_name, p_changing || new_item_or_key); + if (new_item_or_key) { + update_property(); + } } void EditorPropertyDictionary::_change_type(Object *p_button, int p_slot_index) { From 8e00035f086c62558d03217a1f4c03594618344e Mon Sep 17 00:00:00 2001 From: Markus Sauermann <6299227+Sauermann@users.noreply.github.com> Date: Sun, 1 Dec 2024 00:45:09 +0100 Subject: [PATCH 002/111] Introduce `Viewport` functions for keeping the mouse over state consistent --- doc/classes/Viewport.xml | 14 ++++++++++++++ scene/main/viewport.cpp | 18 ++++++++++++++++++ scene/main/viewport.h | 2 ++ 3 files changed, 34 insertions(+) diff --git a/doc/classes/Viewport.xml b/doc/classes/Viewport.xml index 3e772c4e884..1f28a344313 100644 --- a/doc/classes/Viewport.xml +++ b/doc/classes/Viewport.xml @@ -188,6 +188,20 @@ If [member handle_input_locally] is set to [code]false[/code], this method will try finding the first parent viewport that is set to handle input locally, and return its value for [method is_input_handled] instead. + + + + Inform the Viewport that the mouse has entered its area. Use this function before sending an [InputEventMouseButton] or [InputEventMouseMotion] to the [Viewport] with [method Viewport.push_input]. See also [method notify_mouse_exited]. + [b]Note:[/b] In most cases, it is not necessary to call this function because [SubViewport] nodes that are children of [SubViewportContainer] are notified automatically. This is only necessary when interacting with viewports in non-default ways, for example as textures in [TextureRect] or with an [Area3D] that forwards input events. + + + + + + Inform the Viewport that the mouse has left its area. Use this function when the node that displays the viewport notices the mouse has left the area of the displayed viewport. See also [method notify_mouse_entered]. + [b]Note:[/b] In most cases, it is not necessary to call this function because [SubViewport] nodes that are children of [SubViewportContainer] are notified automatically. This is only necessary when interacting with viewports in non-default ways, for example as textures in [TextureRect] or with an [Area3D] that forwards input events. + + diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp index 6c83c7843fb..6073a2950fb 100644 --- a/scene/main/viewport.cpp +++ b/scene/main/viewport.cpp @@ -3257,6 +3257,22 @@ void Viewport::_push_unhandled_input_internal(const Ref &p_event) { } } +void Viewport::notify_mouse_entered() { + if (gui.mouse_in_viewport) { + WARN_PRINT_ED("The Viewport was previously notified that the mouse is in its area. There is no need to notify it at this time."); + return; + } + notification(NOTIFICATION_VP_MOUSE_ENTER); +} + +void Viewport::notify_mouse_exited() { + if (!gui.mouse_in_viewport) { + WARN_PRINT_ED("The Viewport was previously notified that the mouse has left its area. There is no need to notify it at this time."); + return; + } + _mouse_leave_viewport(); +} + void Viewport::set_physics_object_picking(bool p_enable) { ERR_MAIN_THREAD_GUARD; physics_object_picking = p_enable; @@ -4679,6 +4695,8 @@ void Viewport::_bind_methods() { #ifndef DISABLE_DEPRECATED ClassDB::bind_method(D_METHOD("push_unhandled_input", "event", "in_local_coords"), &Viewport::push_unhandled_input, DEFVAL(false)); #endif // DISABLE_DEPRECATED + ClassDB::bind_method(D_METHOD("notify_mouse_entered"), &Viewport::notify_mouse_entered); + ClassDB::bind_method(D_METHOD("notify_mouse_exited"), &Viewport::notify_mouse_exited); ClassDB::bind_method(D_METHOD("get_mouse_position"), &Viewport::get_mouse_position); ClassDB::bind_method(D_METHOD("warp_mouse", "position"), &Viewport::warp_mouse); diff --git a/scene/main/viewport.h b/scene/main/viewport.h index 3a5ad2d83cb..940b001f1f3 100644 --- a/scene/main/viewport.h +++ b/scene/main/viewport.h @@ -578,6 +578,8 @@ class Viewport : public Node { #ifndef DISABLE_DEPRECATED void push_unhandled_input(const Ref &p_event, bool p_local_coords = false); #endif // DISABLE_DEPRECATED + void notify_mouse_entered(); + void notify_mouse_exited(); void set_disable_input(bool p_disable); bool is_input_disabled() const; From 52ee437d7e13582a2a341a9c5da9b129ddd22738 Mon Sep 17 00:00:00 2001 From: Kiro Date: Sun, 29 Dec 2024 16:35:10 +0100 Subject: [PATCH 003/111] try Fixing Variant workaround --- core/object/make_virtuals.py | 33 +-------------------------------- 1 file changed, 1 insertion(+), 32 deletions(-) diff --git a/core/object/make_virtuals.py b/core/object/make_virtuals.py index 2974346a46f..2358e137849 100644 --- a/core/object/make_virtuals.py +++ b/core/object/make_virtuals.py @@ -127,7 +127,7 @@ def generate_version(argcount, const=False, returns=False, required=False): callptrargsptr += ", " argtext += f"m_type{i + 1}" callargtext += f"m_type{i + 1} arg{i + 1}" - callsiargs += f"_to_variant(arg{i + 1})" + callsiargs += f"arg{i + 1}" callsiargptrs += f"&vargs[{i}]" callptrargs += ( f"PtrToArg::EncodeT argval{i + 1} = (PtrToArg::EncodeT)arg{i + 1};\\\n" @@ -200,37 +200,6 @@ def run(target, source, env): #define GDVIRTUAL_TRACK(m_virtual, m_initialized) #endif -// MSVC WORKAROUND START -// FIXME The below helper functions are needed to work around an MSVC bug. -// They should be removed (by modifying core/object/make_virtuals.py) once the bug ceases to be triggered. -// The bug is triggered by the following code: -// `Variant(arg)` -// Through the introduction of the move constructor, MSVC forgets that `operator Variant()` -// is also a valid way to resolve this call. So for some argument types, it fails the call because -// it cannot convert to `Variant`. -// The function `_to_variant` helps the compiler select `.operator Variant()` for appropriate arguments using SFINAE. - -template -struct has_variant_operator : std::false_type {}; - -template -struct has_variant_operator().operator Variant())>> : std::true_type {}; - -// Function that is enabled if T has `.operator Variant()`. -template -_ALWAYS_INLINE_ typename std::enable_if::value, Variant>::type -_to_variant(T&& t) { - return std::forward(t).operator Variant(); -} - -// Function that is enabled if T does not have `.operator Variant()`. -template -_ALWAYS_INLINE_ typename std::enable_if::value, Variant>::type -_to_variant(T&& t) { - return Variant(std::forward(t)); -} -// MSVC WORKAROUND END - """ for i in range(max_versions + 1): From 4cef91e0f56142b0326e54d1d89ed4d6932bc64d Mon Sep 17 00:00:00 2001 From: Danil Alexeev Date: Sat, 4 Jan 2025 17:12:55 +0300 Subject: [PATCH 004/111] =?UTF-8?q?Editor:=20Fix=20`Ctrl+Click`=20on=20enu?= =?UTF-8?q?m=20values=20=E2=80=8B=E2=80=8Bdoes=20nothing?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/gdscript/gdscript_editor.cpp | 42 ++++++++++++++++++---------- 1 file changed, 28 insertions(+), 14 deletions(-) diff --git a/modules/gdscript/gdscript_editor.cpp b/modules/gdscript/gdscript_editor.cpp index c20c17f3486..7ee8d8c4261 100644 --- a/modules/gdscript/gdscript_editor.cpp +++ b/modules/gdscript/gdscript_editor.cpp @@ -3684,12 +3684,12 @@ static Error _lookup_symbol_from_base(const GDScriptParser::DataType &p_base, co case GDScriptParser::ClassNode::Member::GROUP: return ERR_BUG; case GDScriptParser::ClassNode::Member::CLASS: { - String type_name; - String enum_name; - GDScriptDocGen::doctype_from_gdtype(GDScriptAnalyzer::type_from_metatype(member.get_datatype()), type_name, enum_name); + String doc_type_name; + String doc_enum_name; + GDScriptDocGen::doctype_from_gdtype(GDScriptAnalyzer::type_from_metatype(member.get_datatype()), doc_type_name, doc_enum_name); r_result.type = ScriptLanguage::LOOKUP_RESULT_CLASS; - r_result.class_name = type_name; + r_result.class_name = doc_type_name; } break; case GDScriptParser::ClassNode::Member::CONSTANT: r_result.type = ScriptLanguage::LOOKUP_RESULT_CLASS_CONSTANT; @@ -3712,11 +3712,11 @@ static Error _lookup_symbol_from_base(const GDScriptParser::DataType &p_base, co } if (member.type != GDScriptParser::ClassNode::Member::CLASS) { - String type_name; - String enum_name; - GDScriptDocGen::doctype_from_gdtype(GDScriptAnalyzer::type_from_metatype(base_type), type_name, enum_name); + String doc_type_name; + String doc_enum_name; + GDScriptDocGen::doctype_from_gdtype(GDScriptAnalyzer::type_from_metatype(base_type), doc_type_name, doc_enum_name); - r_result.class_name = type_name; + r_result.class_name = doc_type_name; r_result.class_member = name; } @@ -3934,21 +3934,35 @@ static Error _lookup_symbol_from_base(const GDScriptParser::DataType &p_base, co case GDScriptParser::DataType::ENUM: { if (base_type.is_meta_type) { if (base_type.enum_values.has(p_symbol)) { - String type_name; - String enum_name; - GDScriptDocGen::doctype_from_gdtype(GDScriptAnalyzer::type_from_metatype(base_type), type_name, enum_name); + String doc_type_name; + String doc_enum_name; + GDScriptDocGen::doctype_from_gdtype(GDScriptAnalyzer::type_from_metatype(base_type), doc_type_name, doc_enum_name); - if (CoreConstants::is_global_enum(enum_name)) { + if (CoreConstants::is_global_enum(doc_enum_name)) { r_result.type = ScriptLanguage::LOOKUP_RESULT_CLASS_CONSTANT; r_result.class_name = "@GlobalScope"; r_result.class_member = p_symbol; return OK; } else { - const int dot_pos = enum_name.rfind_char('.'); + const int dot_pos = doc_enum_name.rfind_char('.'); if (dot_pos >= 0) { r_result.type = ScriptLanguage::LOOKUP_RESULT_CLASS_CONSTANT; - r_result.class_name = enum_name.left(dot_pos); + r_result.class_name = doc_enum_name.left(dot_pos); r_result.class_member = p_symbol; + if (base_type.class_type != nullptr) { + const String enum_name = doc_enum_name.substr(dot_pos + 1); + if (base_type.class_type->has_member(enum_name)) { + const GDScriptParser::ClassNode::Member member = base_type.class_type->get_member(enum_name); + if (member.type == GDScriptParser::ClassNode::Member::ENUM) { + for (const GDScriptParser::EnumNode::Value &value : member.m_enum->values) { + if (value.identifier->name == p_symbol) { + r_result.location = value.line; + break; + } + } + } + } + } return OK; } } From 2a72f7842700048d2da2f66e0678568ddc6cfdb4 Mon Sep 17 00:00:00 2001 From: Markus Sauermann <6299227+Sauermann@users.noreply.github.com> Date: Wed, 8 Jan 2025 10:52:05 +0100 Subject: [PATCH 005/111] Fix `__focus_rect` meta access when resizing `Tree` `NOTIFICATION_RESIZED` outputs errors, if `select_mode == SELECT_ROW`. This PR unifies the access to the item focus rect. --- scene/gui/tree.cpp | 26 +++++++++++++------------- scene/gui/tree.h | 1 + 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/scene/gui/tree.cpp b/scene/gui/tree.cpp index 643886c12df..f18f4e12324 100644 --- a/scene/gui/tree.cpp +++ b/scene/gui/tree.cpp @@ -3820,12 +3820,7 @@ void Tree::gui_input(const Ref &p_event) { Input::get_singleton()->set_mouse_mode(Input::MOUSE_MODE_VISIBLE); warp_mouse(range_drag_capture_pos); } else { - Rect2 rect; - if (select_mode == SELECT_ROW) { - rect = get_selected()->get_meta("__focus_col_" + itos(selected_col)); - } else { - rect = get_selected()->get_meta("__focus_rect"); - } + Rect2 rect = _get_item_focus_rect(get_selected()); Point2 mpos = mb->get_position(); int icon_size_x = 0; Ref icon = get_selected()->get_icon(selected_col); @@ -4203,12 +4198,7 @@ bool Tree::edit_selected(bool p_force_edit) { } float popup_scale = popup_editor->is_embedded() ? 1.0 : popup_editor->get_parent_visible_window()->get_content_scale_factor(); - Rect2 rect; - if (select_mode == SELECT_ROW) { - rect = s->get_meta("__focus_col_" + itos(selected_col)); - } else { - rect = s->get_meta("__focus_rect"); - } + Rect2 rect = _get_item_focus_rect(s); rect.position *= popup_scale; popup_edited_item = s; popup_edited_item_col = col; @@ -4315,6 +4305,16 @@ bool Tree::edit_selected(bool p_force_edit) { return false; } +Rect2 Tree::_get_item_focus_rect(const TreeItem *p_item) const { + Rect2 rect; + if (select_mode == SELECT_ROW) { + rect = p_item->get_meta("__focus_col_" + itos(selected_col)); + } else { + rect = p_item->get_meta("__focus_rect"); + } + return rect; +} + bool Tree::is_editing() { return popup_editor->is_visible(); } @@ -4597,7 +4597,7 @@ void Tree::_notification(int p_what) { case NOTIFICATION_RESIZED: case NOTIFICATION_TRANSFORM_CHANGED: { if (popup_edited_item != nullptr) { - Rect2 rect = popup_edited_item->get_meta("__focus_rect"); + Rect2 rect = _get_item_focus_rect(popup_edited_item); popup_editor->set_position(get_global_position() + rect.position); popup_editor->set_size(rect.size); diff --git a/scene/gui/tree.h b/scene/gui/tree.h index 012963a25b5..e0739654dc1 100644 --- a/scene/gui/tree.h +++ b/scene/gui/tree.h @@ -716,6 +716,7 @@ class Tree : public Control { Rect2 _get_scrollbar_layout_rect() const; Rect2 _get_content_rect() const; // Considering the background stylebox and scrollbars. + Rect2 _get_item_focus_rect(const TreeItem *p_item) const; protected: virtual void _update_theme_item_cache() override; From 791ad97beba0dbfa4260daa2213e71341ba8abf1 Mon Sep 17 00:00:00 2001 From: Kilian Strunz Date: Tue, 14 Jan 2025 13:36:29 +0100 Subject: [PATCH 006/111] Respect order of externsions for ResourceFormatSavers with at_front --- editor/editor_node.cpp | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index 4d4f8c2307d..371627dd5cf 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -1442,16 +1442,11 @@ void EditorNode::save_resource_as(const Ref &p_resource, const String file->add_filter("*." + E, E.to_upper()); preferred.push_back(E); } - // Lowest priority extension. + // Lowest provided extension priority. List::Element *res_element = preferred.find("res"); if (res_element) { preferred.move_to_back(res_element); } - // Highest priority extension. - List::Element *tres_element = preferred.find("tres"); - if (tres_element) { - preferred.move_to_front(tres_element); - } if (!p_at_path.is_empty()) { file->set_current_dir(p_at_path); From c91c604eaa66d2307d13655ce513392e3bae77d6 Mon Sep 17 00:00:00 2001 From: Nazarii Date: Tue, 14 Jan 2025 19:35:42 +0200 Subject: [PATCH 007/111] Use AHashMap for RBMap nodes and HashMap input_activity --- scene/animation/animation_blend_tree.h | 2 +- scene/animation/animation_tree.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/scene/animation/animation_blend_tree.h b/scene/animation/animation_blend_tree.h index 36a391ebdbd..1b3d7f236e3 100644 --- a/scene/animation/animation_blend_tree.h +++ b/scene/animation/animation_blend_tree.h @@ -410,7 +410,7 @@ class AnimationNodeBlendTree : public AnimationRootNode { Vector connections; }; - RBMap nodes; + AHashMap nodes; Vector2 graph_offset; diff --git a/scene/animation/animation_tree.h b/scene/animation/animation_tree.h index 5ac24b49857..d5b1d4ea460 100644 --- a/scene/animation/animation_tree.h +++ b/scene/animation/animation_tree.h @@ -306,8 +306,8 @@ class AnimationTree : public AnimationMixer { uint64_t last_pass = 0; real_t activity = 0.0; }; - mutable HashMap> input_activity_map; - mutable HashMap *> input_activity_map_get; + mutable AHashMap> input_activity_map; + mutable AHashMap *> input_activity_map_get; NodePath animation_player; From 8fd71e6b17811cfdd7cc222c97eff4f81edcf4c5 Mon Sep 17 00:00:00 2001 From: Lars Pettersson Date: Fri, 13 Dec 2024 15:49:15 +0100 Subject: [PATCH 008/111] Fix default `AudioBusLayout` not loading correctly --- editor/editor_audio_buses.cpp | 64 ++++++++++------------------------- 1 file changed, 17 insertions(+), 47 deletions(-) diff --git a/editor/editor_audio_buses.cpp b/editor/editor_audio_buses.cpp index ae685a824b2..9881087b3e3 100644 --- a/editor/editor_audio_buses.cpp +++ b/editor/editor_audio_buses.cpp @@ -1265,41 +1265,11 @@ void EditorAudioBuses::_load_layout() { } void EditorAudioBuses::_load_default_layout() { - String layout_path = GLOBAL_GET("audio/buses/default_bus_layout"); - - Ref state; - if (ResourceLoader::exists(layout_path)) { - state = ResourceLoader::load(layout_path, "", ResourceFormatLoader::CACHE_MODE_IGNORE); - } - if (state.is_null()) { - EditorNode::get_singleton()->show_warning(vformat(TTR("There is no '%s' file."), layout_path)); - return; - } - - edited_path = layout_path; - file->set_text(String(TTR("Layout:")) + " " + layout_path.get_file()); - AudioServer::get_singleton()->set_bus_layout(state); - _rebuild_buses(); - EditorUndoRedoManager::get_singleton()->clear_history(EditorUndoRedoManager::GLOBAL_HISTORY); - callable_mp(this, &EditorAudioBuses::_select_layout).call_deferred(); + open_layout(GLOBAL_GET("audio/buses/default_bus_layout")); } void EditorAudioBuses::_file_dialog_callback(const String &p_string) { - if (file_dialog->get_file_mode() == EditorFileDialog::FILE_MODE_OPEN_FILE) { - Ref state = ResourceLoader::load(p_string, "", ResourceFormatLoader::CACHE_MODE_IGNORE); - if (state.is_null()) { - EditorNode::get_singleton()->show_warning(TTR("Invalid file, not an audio bus layout.")); - return; - } - - edited_path = p_string; - file->set_text(String(TTR("Layout:")) + " " + p_string.get_file()); - AudioServer::get_singleton()->set_bus_layout(state); - _rebuild_buses(); - EditorUndoRedoManager::get_singleton()->clear_history(EditorUndoRedoManager::GLOBAL_HISTORY); - callable_mp(this, &EditorAudioBuses::_select_layout).call_deferred(); - - } else if (file_dialog->get_file_mode() == EditorFileDialog::FILE_MODE_SAVE_FILE) { + if (file_dialog->get_file_mode() == EditorFileDialog::FILE_MODE_SAVE_FILE) { if (new_layout) { Ref empty_state; empty_state.instantiate(); @@ -1307,18 +1277,12 @@ void EditorAudioBuses::_file_dialog_callback(const String &p_string) { } Error err = ResourceSaver::save(AudioServer::get_singleton()->generate_bus_layout(), p_string); - if (err != OK) { EditorNode::get_singleton()->show_warning(vformat(TTR("Error saving file: %s"), p_string)); return; } - - edited_path = p_string; - file->set_text(String(TTR("Layout:")) + " " + p_string.get_file()); - _rebuild_buses(); - EditorUndoRedoManager::get_singleton()->clear_history(EditorUndoRedoManager::GLOBAL_HISTORY); - callable_mp(this, &EditorAudioBuses::_select_layout).call_deferred(); } + open_layout(p_string); } void EditorAudioBuses::_bind_methods() { @@ -1330,9 +1294,10 @@ EditorAudioBuses::EditorAudioBuses() { top_hb = memnew(HBoxContainer); add_child(top_hb); + edited_path = ResourceUID::ensure_path(GLOBAL_GET("audio/buses/default_bus_layout")); + file = memnew(Label); - String layout_path = GLOBAL_GET("audio/buses/default_bus_layout"); - file->set_text(String(TTR("Layout:")) + " " + layout_path.get_file()); + file->set_text(vformat("%s %s", TTR("Layout:"), edited_path.get_file())); file->set_clip_text(true); file->set_h_size_flags(SIZE_EXPAND_FILL); top_hb->add_child(file); @@ -1386,8 +1351,6 @@ EditorAudioBuses::EditorAudioBuses() { set_v_size_flags(SIZE_EXPAND_FILL); - edited_path = GLOBAL_GET("audio/buses/default_bus_layout"); - file_dialog = memnew(EditorFileDialog); List ext; ResourceLoader::get_recognized_extensions_for_type("AudioBusLayout", &ext); @@ -1405,14 +1368,21 @@ EditorAudioBuses::EditorAudioBuses() { void EditorAudioBuses::open_layout(const String &p_path) { EditorNode::get_bottom_panel()->make_item_visible(this); - Ref state = ResourceLoader::load(p_path, "", ResourceFormatLoader::CACHE_MODE_IGNORE); + const String path = ResourceUID::ensure_path(p_path); + + if (!ResourceLoader::exists(path)) { + EditorNode::get_singleton()->show_warning(vformat(TTR(R"(Can't open audio bus layout: "%s" doesn't exist.)"), path)); + return; + } + + Ref state = ResourceLoader::load(path, "", ResourceFormatLoader::CACHE_MODE_IGNORE); if (state.is_null()) { - EditorNode::get_singleton()->show_warning(TTR("Invalid file, not an audio bus layout.")); + EditorNode::get_singleton()->show_warning(vformat(TTR(R"(Can't open audio bus layout: "%s" is not a valid audio bus layout.)"), path)); return; } - edited_path = p_path; - file->set_text(p_path.get_file()); + edited_path = path; + file->set_text(vformat("%s %s", TTR("Layout:"), path.get_file())); AudioServer::get_singleton()->set_bus_layout(state); _rebuild_buses(); EditorUndoRedoManager::get_singleton()->clear_history(EditorUndoRedoManager::GLOBAL_HISTORY); From b761ff662ef9530621c35b04bec4f3165d1fcf19 Mon Sep 17 00:00:00 2001 From: kobewi Date: Thu, 16 Jan 2025 00:56:32 +0100 Subject: [PATCH 009/111] Rework script external modification tracking --- editor/filesystem_dock.cpp | 5 ++++ editor/plugins/script_editor_plugin.cpp | 31 ++++++++++++++----------- editor/plugins/script_editor_plugin.h | 5 ++++ editor/plugins/script_text_editor.cpp | 1 + editor/plugins/text_editor.cpp | 1 + 5 files changed, 30 insertions(+), 13 deletions(-) diff --git a/editor/filesystem_dock.cpp b/editor/filesystem_dock.cpp index f626891bd8e..caf877f4078 100644 --- a/editor/filesystem_dock.cpp +++ b/editor/filesystem_dock.cpp @@ -1486,6 +1486,11 @@ void FileSystemDock::_try_move_item(const FileOrFolder &p_item, const String &p_ break; } } + } else { + Ref res = ResourceCache::get_ref(old_path); + if (res.is_valid()) { + res->set_path_cache(new_path); + } } } diff --git a/editor/plugins/script_editor_plugin.cpp b/editor/plugins/script_editor_plugin.cpp index 77dd61b2634..1a1e5697c2d 100644 --- a/editor/plugins/script_editor_plugin.cpp +++ b/editor/plugins/script_editor_plugin.cpp @@ -1170,11 +1170,10 @@ void ScriptEditor::_live_auto_reload_running_scripts() { bool ScriptEditor::_test_script_times_on_disk(Ref p_for_script) { disk_changed_list->clear(); TreeItem *r = disk_changed_list->create_item(); - disk_changed_list->set_hide_root(true); bool need_ask = false; bool need_reload = false; - bool use_autoreload = bool(EDITOR_GET("text_editor/behavior/files/auto_reload_scripts_on_external_change")); + bool use_autoreload = EDITOR_GET("text_editor/behavior/files/auto_reload_scripts_on_external_change"); for (int i = 0; i < tab_container->get_tab_count(); i++) { ScriptEditorBase *se = Object::cast_to(tab_container->get_tab_control(i)); @@ -1188,12 +1187,12 @@ bool ScriptEditor::_test_script_times_on_disk(Ref p_for_script) { continue; //internal script, who cares } - uint64_t last_date = edited_res->get_last_modified_time(); - uint64_t date = FileAccess::get_modified_time(edited_res->get_path()); + uint64_t last_date = se->edited_file_data.last_modified_time; + uint64_t date = FileAccess::get_modified_time(se->edited_file_data.path); if (last_date != date) { TreeItem *ti = disk_changed_list->create_item(r); - ti->set_text(0, edited_res->get_path().get_file()); + ti->set_text(0, se->edited_file_data.path.get_file()); if (!use_autoreload || se->is_unsaved()) { need_ask = true; @@ -2231,11 +2230,6 @@ void ScriptEditor::_update_script_names() { Ref icon = se->get_theme_icon(); String path = se->get_edited_resource()->get_path(); bool saved = !path.is_empty(); - if (saved) { - // The script might be deleted, moved, or renamed, so make sure - // to update original path to previously edited resource. - se->set_meta("_edit_res_path", path); - } String name = se->get_name(); Ref