Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Montagne <montagne29@wanadoo.fr>2018-11-07 15:55:29 +0300
committerBastien Montagne <montagne29@wanadoo.fr>2018-11-07 22:58:53 +0300
commit4779165ca18ae3ced005aad129575b70fc6c4f9d (patch)
treed1e70f122a31b87ac0137074aa1d561dc3bf1329 /source/blender/blenkernel/intern/library.c
parenta0d8e52b54ea9c27b47ddf96ff51cc934534d40e (diff)
Fix dpesgraph wrongly refcounting NLA strip actions when duplicating IDs.
NLA strips are users of their action, so we need to pass along ID management flags. This commit also cleans up a bit things by passing along ID_CREATE/COPY flags instead of dummy booleans...
Diffstat (limited to 'source/blender/blenkernel/intern/library.c')
-rw-r--r--source/blender/blenkernel/intern/library.c31
1 files changed, 10 insertions, 21 deletions
diff --git a/source/blender/blenkernel/intern/library.c b/source/blender/blenkernel/intern/library.c
index ff663cfab01..74c3341fa96 100644
--- a/source/blender/blenkernel/intern/library.c
+++ b/source/blender/blenkernel/intern/library.c
@@ -1416,18 +1416,6 @@ void *BKE_id_new_nomain(const short type, const char *name)
return id;
}
-/* 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, 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, do_id_user);
- }
-}
-
void BKE_libblock_copy_ex(Main *bmain, const ID *id, ID **r_newid, const int flag)
{
ID *new_id = *r_newid;
@@ -1478,16 +1466,17 @@ void BKE_libblock_copy_ex(Main *bmain, const ID *id, ID **r_newid, const int fla
}
#endif
- /* 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,
- (flag & LIB_ID_CREATE_NO_USER_REFCOUNT) == 0);
- }
- else if (id_can_have_animdata(new_id)) {
+ if (id_can_have_animdata(new_id)) {
IdAdtTemplate *iat = (IdAdtTemplate *)new_id;
- iat->adt = NULL;
+
+ /* 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);
+ iat->adt = BKE_animdata_copy(bmain, iat->adt, flag);
+ }
+ else {
+ iat->adt = NULL;
+ }
}
if ((flag & LIB_ID_CREATE_NO_DEG_TAG) == 0 && (flag & LIB_ID_CREATE_NO_MAIN) == 0) {