From 63d65bebf04891d3bab2e2d18b99bcae1a50904c Mon Sep 17 00:00:00 2001 From: Nathan Vegdahl Date: Tue, 14 Oct 2025 01:29:01 +0200 Subject: [PATCH] Fix #147803: Assert triggered on keyframe jump on NLA control curves The cause was a missed case from #130440 where `use_nla_remapping = true` was being unconditionally passed to `fcurve_to_keylist()` rather than determining the value with `ANIM_nla_mapping_allowed()` as it should have been. The fix is simply to use `ANIM_nla_mapping_allowed()` instead of unconditionally passing `true`. This PR also changes an outdated comment to properly explain why `adt` was null in the first place (which is precisely to catch bugs like this). Pull Request: https://projects.blender.org/blender/blender/pulls/147957 --- source/blender/editors/animation/anim_filter.cc | 7 ++++++- source/blender/editors/screen/screen_ops.cc | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/source/blender/editors/animation/anim_filter.cc b/source/blender/editors/animation/anim_filter.cc index 1e11ebe02eb..4ccc8545ee8 100644 --- a/source/blender/editors/animation/anim_filter.cc +++ b/source/blender/editors/animation/anim_filter.cc @@ -1332,7 +1332,12 @@ static size_t animfilter_fcurves(bAnimContext *ac, * except we need to set some stuff differently */ ANIMCHANNEL_NEW_CHANNEL_FULL(ac->bmain, fcu, ANIMTYPE_NLACURVE, owner_id, fcurve_owner_id, { ale->owner = owner; /* strip */ - ale->adt = nullptr; /* to prevent time mapping from causing problems */ + /* Since #130440 landed, this should now in theory be something like + * `ale->adt = BKE_animdata_from_id(owner_id)`, rather than a nullptr. + * However, at the moment the nullptr doesn't hurt, and it helps us + * catch bugs like #147803 via the assert in `fcurve_to_keylist()`. If + * the nullptr does start to hurt at some point, please change it! */ + ale->adt = nullptr; }); } else { diff --git a/source/blender/editors/screen/screen_ops.cc b/source/blender/editors/screen/screen_ops.cc index acec6f615b5..ac7e2ab61c7 100644 --- a/source/blender/editors/screen/screen_ops.cc +++ b/source/blender/editors/screen/screen_ops.cc @@ -3458,7 +3458,7 @@ static void keylist_from_graph_editor(bContext &C, AnimKeylist &keylist) continue; } - const bool use_nla_mapping = true; + const bool use_nla_mapping = ANIM_nla_mapping_allowed(ale); fcurve_to_keylist(ale->adt, fcu, &keylist, 0, {-FLT_MAX, FLT_MAX}, use_nla_mapping); }