Fix crash with nested resources
This commit is contained in:
parent
e80aedbf20
commit
675594e9cd
1 changed files with 10 additions and 4 deletions
|
@ -2975,11 +2975,17 @@ void EditorPropertyResource::_set_read_only(bool p_read_only) {
|
||||||
};
|
};
|
||||||
|
|
||||||
void EditorPropertyResource::_resource_selected(const RES &p_resource, bool p_edit) {
|
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 (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.
|
// If the resource belongs to another scene, edit it in that scene instead.
|
||||||
EditorNode::get_singleton()->call_deferred("edit_foreign_resource", p_resource);
|
EditorNode::get_singleton()->call_deferred("edit_foreign_resource", p_resource);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!p_edit && use_sub_inspector) {
|
if (!p_edit && use_sub_inspector) {
|
||||||
bool unfold = !get_edited_object()->editor_is_section_unfolded(get_edited_property());
|
bool unfold = !get_edited_object()->editor_is_section_unfolded(get_edited_property());
|
||||||
|
|
Loading…
Add table
Reference in a new issue