Fix (unreported) broken code in recent override operator enhancements.

When overriding a whole linked collection from a single object in
3DView, said 'reference' object would be removed by code. We only want
that behavior when overriding from an instanciating Empty.
This commit is contained in:
Bastien Montagne 2020-07-21 15:58:28 +02:00
parent d42530824e
commit cd6250c220
1 changed files with 3 additions and 1 deletions

View File

@ -2303,6 +2303,7 @@ static int make_override_library_exec(bContext *C, wmOperator *op)
ViewLayer *view_layer = CTX_data_view_layer(C);
Object *obact = CTX_data_active_object(C);
ID *id_root = NULL;
bool is_override_instancing_object = false;
if (!ID_IS_LINKED(obact) && obact->instance_collection != NULL &&
ID_IS_LINKED(obact->instance_collection)) {
@ -2315,6 +2316,7 @@ static int make_override_library_exec(bContext *C, wmOperator *op)
}
id_root = &obact->instance_collection->id;
is_override_instancing_object = true;
}
else if (!make_override_library_ovject_overridable_check(bmain, obact)) {
const int i = RNA_property_enum_get(op->ptr, op->type->prop);
@ -2352,7 +2354,7 @@ static int make_override_library_exec(bContext *C, wmOperator *op)
/* Remove the instance empty from this scene, the items now have an overridden collection
* instead. */
if (success && id_root != &obact->id) {
if (success && is_override_instancing_object) {
ED_object_base_free_and_unlink(bmain, scene, obact);
}