diff options
author | RĂ©mi Verschelde <remi@verschelde.fr> | 2022-04-25 16:50:17 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-04-25 16:50:17 +0200 |
commit | e246d08c525df7b64eff3b0501c49a0f2e5edb97 (patch) | |
tree | 0d2793b5cd7f689e99a211e5013bb8f1ed24c00c | |
parent | 68ee73077415a7377bf460c1199067a4b5ef82ab (diff) | |
parent | 675594e9cd36506593dcd4b0019861dd64f1dd8e (diff) |
Merge pull request #60500 from KoBeWi/scene_crasher
-rw-r--r-- | editor/editor_properties.cpp | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/editor/editor_properties.cpp b/editor/editor_properties.cpp index 85b57289d7..44f168cd38 100644 --- a/editor/editor_properties.cpp +++ b/editor/editor_properties.cpp @@ -2975,10 +2975,16 @@ void EditorPropertyResource::_set_read_only(bool p_read_only) { }; void EditorPropertyResource::_resource_selected(const RES &p_resource, bool p_edit) { - if (p_resource->is_built_in() && !p_resource->get_path().is_empty() && p_resource->get_path().get_slice("::", 0) != EditorNode::get_singleton()->get_edited_scene()->get_scene_file_path()) { - // If the resource belongs to another scene, edit it in that scene instead. - EditorNode::get_singleton()->call_deferred("edit_foreign_resource", p_resource); - return; + if (p_resource->is_built_in() && !p_resource->get_path().is_empty()) { + String parent = p_resource->get_path().get_slice("::", 0); + List<String> extensions; + ResourceLoader::get_recognized_extensions_for_type("PackedScene", &extensions); + + if (extensions.find(parent.get_extension()) && (!EditorNode::get_singleton()->get_edited_scene() || EditorNode::get_singleton()->get_edited_scene()->get_scene_file_path() == parent)) { + // If the resource belongs to another scene, edit it in that scene instead. + EditorNode::get_singleton()->call_deferred("edit_foreign_resource", p_resource); + return; + } } if (!p_edit && use_sub_inspector) { |