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

The issue was that the PointerRNA passed to BKE_animsys_get_nla_keyframing_context
needs to point to an ID which wasn't the case when keying bones.
That is because internally the FCurve path is used to resolve the property.
This can only work from the ID because the FCurve path is always stored relative to that.
While the function doesn't fail when the property can't resolve the path, it won't actually do
the remapping when passing it to BKE_animsys_nla_remap_keyframe_values later.

The issue was that the `PointerRNA` passed to `BKE_animsys_get_nla_keyframing_context` needs to point to an `ID` which wasn't the case when keying bones. That is because internally the `FCurve` path is used to resolve the property. This can only work from the `ID` because the `FCurve` path is always stored relative to that. While the function doesn't fail when the property can't resolve the path, it won't actually do the remapping when passing it to `BKE_animsys_nla_remap_keyframe_values` later.
Christoph Lendenfeld added the
Module
Animation & Rigging
label 2024-03-28 12:16:23 +01:00
Christoph Lendenfeld added 1 commit 2024-03-28 12:16:34 +01:00
the fix
All checks were successful
buildbot/vexp-code-patch-lint Build done.
buildbot/vexp-code-patch-linux-x86_64 Build done.
buildbot/vexp-code-patch-darwin-x86_64 Build done.
buildbot/vexp-code-patch-darwin-arm64 Build done.
buildbot/vexp-code-patch-windows-amd64 Build done.
buildbot/vexp-code-patch-coordinator Build done.
60060fbfd6
Christoph Lendenfeld requested review from Sybren A. Stüvel 2024-03-28 12:17:35 +01:00
Author
Member

@blender-bot build

@blender-bot build
Sybren A. Stüvel requested changes 2024-03-28 12:24:16 +01:00
Sybren A. Stüvel left a comment
Member

Nice find!

The documentation part of this PR should go to the BKE_animsys_get_nla_keyframing_context function itself, though, and not just one of its invocations. That function (and/or futher down the call stack where it becomes relevant) can then also have a BLI_assert() to check that the pointer is of the right type.

Nice find! The documentation part of this PR should go to the `BKE_animsys_get_nla_keyframing_context` function itself, though, and not just one of its invocations. That function (and/or futher down the call stack where it becomes relevant) can then also have a `BLI_assert()` to check that the pointer is of the right `type`.
Christoph Lendenfeld added 1 commit 2024-03-28 12:51:55 +01:00
Author
Member

moved the comment to the function body, modified the docstring on the function to specifically mention IDs and added an assert

Is it save to add asserts when this will be backported to 4.1?

moved the comment to the function body, modified the docstring on the function to specifically mention IDs and added an assert Is it save to add asserts when this will be backported to 4.1?
Christoph Lendenfeld requested review from Sybren A. Stüvel 2024-03-28 12:54:52 +01:00
Sybren A. Stüvel approved these changes 2024-03-28 13:59:45 +01:00
Sybren A. Stüvel left a comment
Member

👍

Just one note, which can be handled when landing.

:+1: Just one note, which can be handled when landing.
@ -1016,2 +1016,4 @@
ListBase nla_cache = {nullptr, nullptr};
NlaKeyframingContext *nla_context = nullptr;
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.
Christoph Lendenfeld added 1 commit 2024-03-28 14:46:26 +01:00
declaration into if
All checks were successful
buildbot/vexp-code-patch-lint Build done.
buildbot/vexp-code-patch-linux-x86_64 Build done.
buildbot/vexp-code-patch-darwin-x86_64 Build done.
buildbot/vexp-code-patch-windows-amd64 Build done.
buildbot/vexp-code-patch-darwin-arm64 Build done.
buildbot/vexp-code-patch-coordinator Build done.
2d705d89ba
Author
Member

@blender-bot build

@blender-bot build
Christoph Lendenfeld merged commit 6276dd2f64 into main 2024-03-28 15:14:11 +01:00
Christoph Lendenfeld deleted branch fix_nla_decomp_with_bones 2024-03-28 15:14:13 +01:00
Sign in to join this conversation.
No reviewers
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset System
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
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
Viewport & EEVEE
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Asset Browser Project
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
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
Module
Viewport & EEVEE
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Severity
High
Severity
Low
Severity
Normal
Severity
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#120008
No description provided.