You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-05 12:10:55 +00:00
Fix resources wrongly duplicated upon instantiating inherited scenes
This commit is contained in:
@@ -356,18 +356,18 @@ Node *SceneState::instantiate(GenEditState p_edit_state) const {
|
|||||||
} else {
|
} else {
|
||||||
Variant value = props[nprops[j].value];
|
Variant value = props[nprops[j].value];
|
||||||
|
|
||||||
// Making sure that instances of inherited scenes don't share the same
|
|
||||||
// reference between them.
|
|
||||||
if (is_inherited_scene) {
|
|
||||||
value = value.duplicate(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (value.get_type() == Variant::OBJECT) {
|
if (value.get_type() == Variant::OBJECT) {
|
||||||
//handle resources that are local to scene by duplicating them if needed
|
//handle resources that are local to scene by duplicating them if needed
|
||||||
Ref<Resource> res = value;
|
Ref<Resource> res = value;
|
||||||
if (res.is_valid()) {
|
if (res.is_valid()) {
|
||||||
value = make_local_resource(value, n, resources_local_to_sub_scene, node, snames[nprops[j].name], resources_local_to_scene, i, ret_nodes, p_edit_state);
|
value = make_local_resource(value, n, resources_local_to_sub_scene, node, snames[nprops[j].name], resources_local_to_scene, i, ret_nodes, p_edit_state);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
// Making sure that instances of inherited scenes don't share the same
|
||||||
|
// reference between them.
|
||||||
|
if (is_inherited_scene) {
|
||||||
|
value = value.duplicate(true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (value.get_type() == Variant::ARRAY) {
|
if (value.get_type() == Variant::ARRAY) {
|
||||||
|
|||||||
Reference in New Issue
Block a user