[Bf-blender-cvs] [cd6250c220e] master: Fix (unreported) broken code in recent override operator enhancements.

Bastien Montagne noreply at git.blender.org
Tue Jul 21 16:00:45 CEST 2020


Commit: cd6250c220e33bfc2131b78826163ccc069f2a30
Author: Bastien Montagne
Date:   Tue Jul 21 15:58:28 2020 +0200
Branches: master
https://developer.blender.org/rBcd6250c220e33bfc2131b78826163ccc069f2a30

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.

===================================================================

M	source/blender/editors/object/object_relations.c

===================================================================

diff --git a/source/blender/editors/object/object_relations.c b/source/blender/editors/object/object_relations.c
index 7d40b48dd83..17370b88861 100644
--- a/source/blender/editors/object/object_relations.c
+++ b/source/blender/editors/object/object_relations.c
@@ -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);
   }



More information about the Bf-blender-cvs mailing list