From 46d56bd9567045965a6a46e2b5205020514bbee1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sybren=20A=2E=20St=C3=BCvel?= Date: Tue, 4 May 2021 16:19:51 +0200 Subject: Animation: correct active track/strip pointers after copying NLA tracks After copying NLA tracks from one `AnimData` to another, also ensure that the `AnimData::act_track` and `AnimData::actstrip` pointers are pointing to the copy rather than the original. This is a necessary step to allow library overrides on NLA modifiers without crashing Blender. The remapping of the pointers is done by looping over the tracks/strips and comparing pointers. Alternatively, I could update the copy functions themselves to keep track of those pointers and return them, but IMO that would produce more spaghetti (they're also used in cases where this pointer-remapping is not desired). --- source/blender/blenkernel/intern/anim_data.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source/blender/blenkernel/intern/anim_data.c') diff --git a/source/blender/blenkernel/intern/anim_data.c b/source/blender/blenkernel/intern/anim_data.c index 447ed8fbe14..68de3e93a8e 100644 --- a/source/blender/blenkernel/intern/anim_data.c +++ b/source/blender/blenkernel/intern/anim_data.c @@ -354,7 +354,7 @@ AnimData *BKE_animdata_copy(Main *bmain, AnimData *adt, const int flag) } /* duplicate NLA data */ - BKE_nla_tracks_copy(bmain, &dadt->nla_tracks, &adt->nla_tracks, flag); + BKE_nla_tracks_copy_from_adt(bmain, dadt, adt, flag); /* duplicate drivers (F-Curves) */ BKE_fcurves_copy(&dadt->drivers, &adt->drivers); -- cgit v1.2.3