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.
This commit is contained in:
Bastien Montagne 2018-08-05 18:50:01 +02:00
parent 75e34b9002
commit 53c56b2b5f
Notes: blender-bot 2023-02-14 05:55:57 +01:00
Referenced by issue #56244, Doesnt render on GPU
Referenced by issue #54915, Usercount of active action increases when editing things with COW enabled
1 changed files with 5 additions and 3 deletions

View File

@ -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;