Fix #119946: NLA stack decomposition doesn't work with bones #120008

Merged
Christoph Lendenfeld merged 3 commits from ChrisLend/blender:fix_nla_decomp_with_bones into main 2024-03-28 15:14:11 +01:00
3 changed files with 7 additions and 4 deletions
Showing only changes of commit 087221fd82 - Show all commits

View File

@ -1015,9 +1015,7 @@ void insert_key_rna(PointerRNA *rna_pointer,
/* Keyframing functions can deal with the nla_context being a nullptr. */
ListBase nla_cache = {nullptr, nullptr};
NlaKeyframingContext *nla_context = nullptr;
/* The function to get the NLA context needs to get the PointerRNA from the ID because it uses
* F-Curve paths to resolve properties. Since F-Curve paths are always relative to the ID this
* would fail if the PointerRNA was a bone. */
PointerRNA id_pointer = RNA_id_pointer_create(id);

Move the declaration inside the if() as it's not used anywhere else.

Move the declaration inside the `if()` as it's not used anywhere else.
if (adt && adt->action == action) {
nla_context = BKE_animsys_get_nla_keyframing_context(

View File

@ -237,7 +237,7 @@ typedef struct NlaKeyframingContext NlaKeyframingContext;
*
* \param cache: List used to cache contexts for reuse when keying
* multiple channels in one operation.
* \param ptr: RNA pointer to the Object with the animation.
* \param ptr: RNA pointer to the ID with the animation.
* \return Keyframing context, or NULL if not necessary.
*/
struct NlaKeyframingContext *BKE_animsys_get_nla_keyframing_context(

View File

@ -3673,6 +3673,11 @@ void nlasnapshot_blend_get_inverted_lower_snapshot(NlaEvalData *eval_data,
NlaKeyframingContext *BKE_animsys_get_nla_keyframing_context(
ListBase *cache, PointerRNA *ptr, AnimData *adt, const AnimationEvalContext *anim_eval_context)
{
/* The PointerRNA needs to point to an ID because animsys_evaluate_nla_for_keyframing uses
* F-Curve paths to resolve properties. Since F-Curve paths are always relative to the ID this
* would fail if the PointerRNA was e.g. a bone. */
BLI_assert(RNA_struct_is_ID(ptr->type));
/* No remapping needed if NLA is off or no action. */
if ((adt == nullptr) || (adt->action == nullptr) || (adt->nla_tracks.first == nullptr) ||
(adt->flag & ADT_NLA_EVAL_OFF))