[Bf-blender-cvs] [53c56b2b5fd] blender2.8: Fix T54915: Usercount of active action increases when editing things with COW enabled.

Bastien Montagne noreply at git.blender.org
Sun Aug 5 18:51:01 CEST 2018


Commit: 53c56b2b5fdc4fbb53a36e0856edf2c742f0848f
Author: Bastien Montagne
Date:   Sun Aug 5 18:50:01 2018 +0200
Branches: blender2.8
https://developer.blender.org/rB53c56b2b5fdc4fbb53a36e0856edf2c742f0848f

Fix T54915: Usercount of active action increases when editing things with COW enabled.

Just pass along the 'no user refcount' flag to animdata copy function.

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

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

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

diff --git a/source/blender/blenkernel/intern/library.c b/source/blender/blenkernel/intern/library.c
index 8922cd75618..75444ca3b2f 100644
--- a/source/blender/blenkernel/intern/library.c
+++ b/source/blender/blenkernel/intern/library.c
@@ -1407,13 +1407,13 @@ void *BKE_id_new_nomain(const short type, const char *name)
 
 /* by spec, animdata is first item after ID */
 /* and, trust that BKE_animdata_from_id() will only find AnimData for valid ID-types */
-static void id_copy_animdata(Main *bmain, ID *id, const bool do_action)
+static void id_copy_animdata(Main *bmain, ID *id, const bool do_action, const bool do_id_user)
 {
 	AnimData *adt = BKE_animdata_from_id(id);
 
 	if (adt) {
 		IdAdtTemplate *iat = (IdAdtTemplate *)id;
-		iat->adt = BKE_animdata_copy(bmain, iat->adt, do_action, true); /* could be set to false, need to investigate */
+		iat->adt = BKE_animdata_copy(bmain, iat->adt, do_action, do_id_user);
 	}
 }
 
@@ -1470,7 +1470,9 @@ void BKE_libblock_copy_ex(Main *bmain, const ID *id, ID **r_newid, const int fla
 	/* the duplicate should get a copy of the animdata */
 	if ((flag & LIB_ID_COPY_NO_ANIMDATA) == 0) {
 		BLI_assert((flag & LIB_ID_COPY_ACTIONS) == 0 || (flag & LIB_ID_CREATE_NO_MAIN) == 0);
-		id_copy_animdata(bmain, new_id, (flag & LIB_ID_COPY_ACTIONS) != 0 && (flag & LIB_ID_CREATE_NO_MAIN) == 0);
+		id_copy_animdata(bmain, new_id,
+		                 (flag & LIB_ID_COPY_ACTIONS) != 0 && (flag & LIB_ID_CREATE_NO_MAIN) == 0,
+		                 (flag & LIB_ID_CREATE_NO_USER_REFCOUNT) == 0);
 	}
 	else if (id_can_have_animdata(new_id)) {
 		IdAdtTemplate *iat = (IdAdtTemplate *)new_id;



More information about the Bf-blender-cvs mailing list