1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-07 12:30:27 +00:00

Merge pull request #99741 from a-johnston/reload_scene_compare_relative_path

Compare localized path against editor scene path when reloading
This commit is contained in:
Rémi Verschelde
2025-01-13 20:21:32 +01:00

View File

@@ -3974,7 +3974,7 @@ Error EditorNode::load_scene(const String &p_scene, bool p_ignore_broken_deps, b
return OK; return OK;
} }
String lpath = ResourceUID::ensure_path(p_scene); String lpath = ProjectSettings::get_singleton()->localize_path(ResourceUID::ensure_path(p_scene));
if (!p_set_inherited) { if (!p_set_inherited) {
for (int i = 0; i < editor_data.get_edited_scene_count(); i++) { for (int i = 0; i < editor_data.get_edited_scene_count(); i++) {
if (editor_data.get_scene_path(i) == lpath) { if (editor_data.get_scene_path(i) == lpath) {
@@ -3992,7 +3992,6 @@ Error EditorNode::load_scene(const String &p_scene, bool p_ignore_broken_deps, b
} }
} }
lpath = ProjectSettings::get_singleton()->localize_path(lpath);
if (!lpath.begins_with("res://")) { if (!lpath.begins_with("res://")) {
show_accept(TTR("Error loading scene, it must be inside the project path. Use 'Import' to open the scene, then save it inside the project path."), TTR("OK")); show_accept(TTR("Error loading scene, it must be inside the project path. Use 'Import' to open the scene, then save it inside the project path."), TTR("OK"));
opening_prev = false; opening_prev = false;
@@ -5961,8 +5960,11 @@ void EditorNode::_notify_nodes_scene_reimported(Node *p_node, Array p_reimported
void EditorNode::reload_scene(const String &p_path) { void EditorNode::reload_scene(const String &p_path) {
int scene_idx = -1; int scene_idx = -1;
String lpath = ProjectSettings::get_singleton()->localize_path(p_path);
for (int i = 0; i < editor_data.get_edited_scene_count(); i++) { for (int i = 0; i < editor_data.get_edited_scene_count(); i++) {
if (editor_data.get_scene_path(i) == p_path) { if (editor_data.get_scene_path(i) == lpath) {
scene_idx = i; scene_idx = i;
break; break;
} }