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
This commit is contained in:
Nathan Vegdahl
2025-10-14 01:29:01 +02:00
committed by Nathan Vegdahl
parent 8bb10b2d33
commit 63d65bebf0
2 changed files with 7 additions and 2 deletions

View File

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

View File

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