Skip to content

Commit e9b18fc

Browse files
committed
Merge pull request #99741 from a-johnston/reload_scene_compare_relative_path
Compare localized path against editor scene path when reloading
2 parents 133db1f + 224bafc commit e9b18fc

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

editor/editor_node.cpp

+5-3
Original file line numberDiff line numberDiff line change
@@ -3974,7 +3974,7 @@ Error EditorNode::load_scene(const String &p_scene, bool p_ignore_broken_deps, b
39743974
return OK;
39753975
}
39763976

3977-
String lpath = ResourceUID::ensure_path(p_scene);
3977+
String lpath = ProjectSettings::get_singleton()->localize_path(ResourceUID::ensure_path(p_scene));
39783978
if (!p_set_inherited) {
39793979
for (int i = 0; i < editor_data.get_edited_scene_count(); i++) {
39803980
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
39923992
}
39933993
}
39943994

3995-
lpath = ProjectSettings::get_singleton()->localize_path(lpath);
39963995
if (!lpath.begins_with("res://")) {
39973996
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"));
39983997
opening_prev = false;
@@ -5961,8 +5960,11 @@ void EditorNode::_notify_nodes_scene_reimported(Node *p_node, Array p_reimported
59615960

59625961
void EditorNode::reload_scene(const String &p_path) {
59635962
int scene_idx = -1;
5963+
5964+
String lpath = ProjectSettings::get_singleton()->localize_path(p_path);
5965+
59645966
for (int i = 0; i < editor_data.get_edited_scene_count(); i++) {
5965-
if (editor_data.get_scene_path(i) == p_path) {
5967+
if (editor_data.get_scene_path(i) == lpath) {
59665968
scene_idx = i;
59675969
break;
59685970
}

0 commit comments

Comments
 (0)