Fix #120574: Broken animation when saving file with NLA tweak mode entered #120830

Merged
Sybren A. Stüvel merged 4 commits from dr.sybren/blender:pr/fix-nla-linking-tweak-mode-exit into main 2024-04-22 14:56:19 +02:00

Fix linking & library-overriding with NLA Tweak Mode enabled. This is a
two-pronged approach:

  • When linking an animated ID from a library file, and it happens to be
    in NLA Tweak Mode, it is forced out of tweak mode. This ensures that
    the correct Action is loaded, and that all the NLA flags are set
    correctly to display the NLA animation (instead of only the tweaked
    strip).
  • For library overrides there is now a post-process step that runs after
    all 'apply' functions have been run. This is necessary to ensure that
    all the flags and pointers that NLA Tweak Mode depends on are actually
    set correctly and consistently.

This also adds one utility function BKE_nla_debug_print_flags() that
is by now unused. It was very useful in debugging this, though, and I
think it'll be useful in the future as well.

Design task: #120573

Fix linking & library-overriding with NLA Tweak Mode enabled. This is a two-pronged approach: - When linking an animated ID from a library file, and it happens to be in NLA Tweak Mode, it is forced out of tweak mode. This ensures that the correct Action is loaded, and that all the NLA flags are set correctly to display the NLA animation (instead of only the tweaked strip). - For library overrides there is now a post-process step that runs after all 'apply' functions have been run. This is necessary to ensure that all the flags and pointers that NLA Tweak Mode depends on are actually set correctly and consistently. This also adds one utility function `BKE_nla_debug_print_flags()` that is by now unused. It was very useful in debugging this, though, and I think it'll be useful in the future as well. Design task: #120573
Sybren A. Stüvel added the
Module
Animation & Rigging
label 2024-04-19 17:20:02 +02:00
Sybren A. Stüvel added 1 commit 2024-04-19 17:20:06 +02:00
buildbot/vexp-code-patch-lint Build done. Details
buildbot/vexp-code-patch-darwin-x86_64 Build done. Details
buildbot/vexp-code-patch-linux-x86_64 Build done. Details
buildbot/vexp-code-patch-windows-amd64 Build done. Details
buildbot/vexp-code-patch-coordinator Build done. Details
251667efa3
Fix #120574: Broken animation when saving file with NLA tweak mode entered
Fix linking & library-overriding with NLA Tweak Mode enabled. This is a
two-pronged approach:

- When linking an animated ID from a library file, and it happens to be
  in NLA Tweak Mode, it is forced out of tweak mode. This ensures that
  the correct Action is loaded, and that all the NLA flags are set
  correctly to display the NLA animation (instead of only the tweaked
  strip).
- For library overrides there is now a post-process step that runs after
  all 'apply' functions have been run. This is necessary to ensure that
  all the flags and pointers that NLA Tweak Mode depends on are actually
  set correctly and consistently.

This also adds one utility function `BKE_nla_debug_print_flags()` that
is by now unused. It was very useful in debugging this, though, and I
think it'll be useful in the future as well.

Design task: #120573
Sybren A. Stüvel requested review from Nathan Vegdahl 2024-04-19 17:20:24 +02:00
Sybren A. Stüvel requested review from Bastien Montagne 2024-04-19 17:20:24 +02:00
Sybren A. Stüvel requested review from Simon Thommes 2024-04-19 17:20:31 +02:00
Author
Member

@blender-bot package

@blender-bot package
Member

Package build started. Download here when ready.

Package build started. [Download here](https://builder.blender.org/download/patch/PR120830) when ready.
Bastien Montagne approved these changes 2024-04-22 09:39:11 +02:00
Bastien Montagne left a comment
Owner

Generally looks good, some minor notes below.

Generally looks good, some minor notes below.
@ -5046,6 +5046,8 @@ void BKE_lib_override_library_update(Main *bmain, ID *local)
}
}
BKE_animdata_liboverride_post_process(local);

Wouldn't mind a comment explaining why this is needed, and (roughly) what it is doing ;)

Wouldn't mind a comment explaining why this is needed, and (roughly) what it is doing ;)
Author
Member

Which information do you feel is missing, that's not already described in the actual documentation of that function?

Which information do you feel is missing, that's not already described in the actual documentation of that function?

Documentation of the function is not directly available in code calling it, and since this is addressing a non-standard 'should not happen' case in liboverride handling, would like to have a quick summary of why this has to be called here.

Documentation of the function is not directly available in code calling it, and since this is addressing a non-standard 'should not happen' case in liboverride handling, would like to have a quick summary of why this has to be called here.
Author
Member

Documentation of the function is not directly available in code calling it

You need a better IDE ;-)

and since this is addressing a non-standard 'should not happen' case in liboverride handling, would like to have a quick summary of why this has to be called here.

I've added a comment to explain.

> Documentation of the function is not directly available in code calling it You need a better IDE ;-) > and since this is addressing a non-standard 'should not happen' case in liboverride handling, would like to have a quick summary of why this has to be called here. I've added a comment to explain.
dr.sybren marked this conversation as resolved
@ -2447,0 +2589,4 @@
}
/* In tweak mode, with tracks, so ensure that the active track/strip pointers are correct. */
if (!adt->act_track || !adt->actstrip) {

I would not condition this to nullptr check, but always run it. The reason being, this data may be set from the reference linked data, to some other track or strip... Better be safe here and always reset them to the expected values imho.

I would not condition this to nullptr check, but always run it. The reason being, this data _may_ be set from the reference linked data, to some other track or strip... Better be safe here and always reset them to the expected values imho.
dr.sybren marked this conversation as resolved
Sybren A. Stüvel added 2 commits 2024-04-22 10:52:38 +02:00
Sybren A. Stüvel added 1 commit 2024-04-22 11:54:28 +02:00
Member

Gave the PR a quick test and it seems to solve the issue well.

The animation does not break and in the lighting file tweak mode is not restored for the linked data-block when loading the file.
It is still possible to enter tweak mode on the linked data though, that seems to me like it could be a problem, but I'm too unfamiliar what tweak mode even is tbh. Just noticed this as a potential issue.

Gave the PR a quick test and it seems to solve the issue well. The animation does not break and in the lighting file tweak mode is not restored for the linked data-block when loading the file. It is still possible to enter tweak mode on the linked data though, that seems to me like it could be a problem, but I'm too unfamiliar what tweak mode even is tbh. Just noticed this as a potential issue.
Author
Member

Gave the PR a quick test and it seems to solve the issue well.

The animation does not break and in the lighting file tweak mode is not restored for the linked data-block when loading the file.

🥳

It is still possible to enter tweak mode on the linked data though, that seems to me like it could be a problem, but I'm too unfamiliar what tweak mode even is tbh. Just noticed this as a potential issue.

Thanks.

> Gave the PR a quick test and it seems to solve the issue well. > > The animation does not break and in the lighting file tweak mode is not restored for the linked data-block when loading the file. 🥳 > It is still possible to enter tweak mode on the linked data though, that seems to me like it could be a problem, but I'm too unfamiliar what tweak mode even is tbh. Just noticed this as a potential issue. Thanks.
Sybren A. Stüvel merged commit 910360637b into main 2024-04-22 14:56:19 +02:00
Sybren A. Stüvel deleted branch pr/fix-nla-linking-tweak-mode-exit 2024-04-22 14:56:21 +02:00
Sign in to join this conversation.
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
4 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#120830
No description provided.