[Bf-blender-cvs] [d66ed7d5408] master: Fix T63042: Grease pencil and armature will sometimes copy successfully because of the put in Collection order, sometimes fail.

Bastien Montagne noreply at git.blender.org
Fri Mar 29 14:58:25 CET 2019


Commit: d66ed7d5408c93eff4ed3fc2bd6fd172b0f76889
Author: Bastien Montagne
Date:   Fri Mar 29 14:54:50 2019 +0100
Branches: master
https://developer.blender.org/rBd66ed7d5408c93eff4ed3fc2bd6fd172b0f76889

Fix T63042: Grease pencil and armature will sometimes copy successfully because of the put in Collection order, sometimes fail.

Remove remapping to new IDs from `BKE_object_duplicate()` itself, doing
it here will break later remapping done after all desired objects have
been duplicated, preventing complete remap of ID pointers used in obdata
and other sub-data of duplicated objects.

Checked, the only two usages of this function were already doing
separated later step for this anyway.

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

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

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

diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c
index 0a08f5f8270..9985c8026e7 100644
--- a/source/blender/blenkernel/intern/object.c
+++ b/source/blender/blenkernel/intern/object.c
@@ -1431,6 +1431,7 @@ Object *BKE_object_copy(Main *bmain, const Object *ob)
  *
  * \param dupflag Controls which sub-data are also duplicated (see \a eDupli_ID_Flags in \a DNA_userdef_types.h).
  *
+ * \note This function does not do any remapping to new IDs, caller must do it (\a BKE_libblock_relink_to_newid()).
  * \note Caller MUST free \a newid pointers itself (\a BKE_main_id_clear_newpoins()) and call updates of DEG too
  *       (\a DAG_relations_tag_update()).
  */
@@ -1657,8 +1658,6 @@ Object *BKE_object_duplicate(Main *bmain, const Object *ob, const int dupflag)
 #undef ID_NEW_REMAP_US
 #undef ID_NEW_REMAP_US2
 
-	BKE_libblock_relink_to_newid(&obn->id);
-
 	if (ob->data != NULL) {
 		DEG_id_tag_update_ex(bmain, (ID *)obn->data, ID_RECALC_EDITORS);
 	}



More information about the Bf-blender-cvs mailing list