Fix: keyframe values with additive NLA stack #118053

Merged
Christoph Lendenfeld merged 6 commits from ChrisLend/blender:fix_nla_stack_keying into blender-v4.1-release 2024-02-13 11:10:26 +01:00

The new keyframing functions introduced in #113504: Anim: Insert keyframes without keying sets
didn't call the functions to decompose the NLA stack.

In practice this meant that when inserting keys into strip that is under an additive strip, it would take the result of the additive Strip and
bake it back into the base. This would double the transform.
You can test with the attached blend file.

The fix is to call BKE_animsys_nla_remap_keyframe_values. Unfortunately to do so, I had to pass through a few more arguments to the keyframing functions.

Also adds unit tests to cover the caused bug.

The new keyframing functions introduced in [#113504: Anim: Insert keyframes without keying sets](https://projects.blender.org/blender/blender/pulls/113504) didn't call the functions to decompose the NLA stack. In practice this meant that when inserting keys into strip that is under an additive strip, it would take the result of the additive Strip and bake it back into the base. This would double the transform. You can test with the attached blend file. The fix is to call `BKE_animsys_nla_remap_keyframe_values`. Unfortunately to do so, I had to pass through a few more arguments to the keyframing functions. Also adds unit tests to cover the caused bug.
Christoph Lendenfeld added the
Module
Animation & Rigging
label 2024-02-09 18:32:37 +01:00
Christoph Lendenfeld added 2 commits 2024-02-09 18:32:51 +01:00
Christoph Lendenfeld added 1 commit 2024-02-09 18:36:24 +01:00
Christoph Lendenfeld added 1 commit 2024-02-13 09:44:01 +01:00
Sybren A. Stüvel requested changes 2024-02-13 10:14:03 +01:00
@ -192,6 +193,8 @@ bool autokeyframe_property(bContext *C,
* expected to be the size of the property array.
* \param frame: is expected to be in the local time of the action, meaning it has to be NLA mapped
* already.
* \param keying_mask is expected to have the same size as `rna_path`. A false bit means that index

This doc only mentions keying_mask as an input parameter. Yet, it is not const and thus the function changes its values. What do they mean as return parameter? Or should it just be const?

This doc only mentions `keying_mask` as an input parameter. Yet, it is not `const` and thus the function changes its values. What do they mean as return parameter? Or should it just be `const`?
Author
Member

you were right it should have been const. changed that now

you were right it should have been const. changed that now
dr.sybren marked this conversation as resolved
@ -488,2 +501,4 @@
def _create_nla_anim_object():
# Creates an object with 3 NLA tracks each with a strip that has its own action.

Use a """docstring""", not a comment, for documenting what a function does.

Also include info of which keys are created, as that's kinda necessary for following the tests that use this function.

Use a `"""docstring"""`, not a comment, for documenting what a function does. Also include info of which keys are created, as that's kinda necessary for following the tests that use this function.
@ -490,0 +545,4 @@
super().setUp()
bpy.context.preferences.edit.key_insert_channels = {'LOCATION'}
# Change one area to the NLA so we can call operators in it.
# Assumes there is at least one window in the blender default startup file that is not the 3D viewport.

window → editor

window → editor
@ -490,0 +595,4 @@
bpy.ops.anim.keyframe_insert()
base_action = bpy.data.actions["action_base"]
# This should add keys to Y and Z but not X.

should add → should have added

I'm also not sure why "added keys to Y and Z but not X" is followed by 2 keys for X but only 1 for Y and Z.

should add → should have added I'm also not sure why "added keys to Y and Z but not X" is followed by 2 keys for X but only 1 for Y and Z.
Author
Member

I added an extra comment line to mention why X already has had keys

I added an extra comment line to mention why X already has had keys
Christoph Lendenfeld added 1 commit 2024-02-13 10:27:57 +01:00
Christoph Lendenfeld requested review from Sybren A. Stüvel 2024-02-13 10:29:13 +01:00
Sybren A. Stüvel approved these changes 2024-02-13 11:06:48 +01:00
Sybren A. Stüvel left a comment
Member

👍

The last thing (pointer → reference) can be handled when landing.

:+1: The last thing (pointer → reference) can be handled when landing.
@ -217,2 +221,3 @@
Main *bmain,
ReportList *reports);
ReportList *reports,
const AnimationEvalContext *anim_eval_context);

As discussed in the chat, this is to become a reference instead of a pointer.

As discussed in the chat, this is to become a reference instead of a pointer.
Christoph Lendenfeld added 1 commit 2024-02-13 11:07:30 +01:00
Christoph Lendenfeld merged commit 7fddad529e into blender-v4.1-release 2024-02-13 11:10:26 +01:00
Christoph Lendenfeld deleted branch fix_nla_stack_keying 2024-02-13 11:10:29 +01:00
Sign in to join this conversation.
No reviewers
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#118053
No description provided.