[Bf-blender-cvs] [29c0b34b209] master: Fix (unreported) object duplicate code wrongly duplicating linked objects.

Bastien Montagne noreply at git.blender.org
Tue Mar 23 16:04:38 CET 2021


Commit: 29c0b34b209e4fa0548a1ff0716751f1fcfb51d5
Author: Bastien Montagne
Date:   Tue Mar 23 15:59:21 2021 +0100
Branches: master
https://developer.blender.org/rB29c0b34b209e4fa0548a1ff0716751f1fcfb51d5

Fix (unreported) object duplicate code wrongly duplicating linked objects.

Linked data should only be duplicated if relevant `eDupli_ID_Flags` flag
is set (`USER_DUP_LINKED_ID`), this is being taken care of by generic
`BKE_id_copy_for_duplicate` function, but for some reasons (?)
`BKE_object_duplicate` was directly using `BKE_id_copy` for itself...

Note that this had especially bad consequences when duplicating
overrides of collections...

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

M	source/blender/blenkernel/intern/object.c

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

diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c
index 76c96ec9603..00e99f193a2 100644
--- a/source/blender/blenkernel/intern/object.c
+++ b/source/blender/blenkernel/intern/object.c
@@ -2620,11 +2620,7 @@ Object *BKE_object_duplicate(Main *bmain,
 
   Material ***matarar;
 
-  Object *obn = (Object *)BKE_id_copy(bmain, &ob->id);
-  id_us_min(&obn->id);
-  if (is_subprocess) {
-    ID_NEW_SET(ob, obn);
-  }
+  Object *obn = (Object *)BKE_id_copy_for_duplicate(bmain, &ob->id, dupflag);
 
   /* 0 == full linked. */
   if (dupflag == 0) {



More information about the Bf-blender-cvs mailing list