Anim: Make NLA Tweak Mode not affect library linking #120573

Closed
opened 2024-04-12 15:11:38 +02:00 by Sybren A. Stüvel · 1 comment

Entering NLA Tweak Mode swaps around some pointers: datablock.animation_data.action will point to the tweaked action (instead of to whatever action was originally assigned). Exiting tweak mode restores the original value of that pointer.

The result of this is that, when saving the blend file in tweak mode, linking the animated data-block into another file will behave incorrectly.

Forward Compatibility

For forward compatibility, care has to be taken that opening new files with an older Blender still works. We may need to add a few more pointers to the AnimData struct to make this work.

Suggested Approach

When saving the blend file to disk (but not to the in-memory undo buffer):

  • Detect that NLA tweak mode is enabled. Then write the animdata as if it is not (taking care of both the flags and the pointers).
  • When writing the scene, always clear the 'NLA tweak mode enabled' flag. Yes, this is stored on the scene too, for some reason.
  • Somehow store that tweak mode was enabled, and on which animated data-block. That way this change is transparent to the user, as when opening the file it is in the same state as when they saved it.

Chosen Approach

Instead of changing the writing, we chose to change the reading. This ensures forward compatibility (on disk, nothing changed) and avoids any unforseen side-effects.

  • When linking an animated ID, its NLA tweak mode is always disabled. This fixes the "ghost NLA tweak mode" that cannot be disabled (because linked data cannot be edited).
  • After applying library overrides, the pointers & flags that make up NLA Tweak Mode are made consistent. This ensures that tweak mode is either on, or off, but not in some in-between state.
Entering NLA Tweak Mode swaps around some pointers: `datablock.animation_data.action` will point to the tweaked action (instead of to whatever action was originally assigned). Exiting tweak mode restores the original value of that pointer. The result of this is that, when saving the blend file in tweak mode, linking the animated data-block into another file will behave incorrectly. ### Forward Compatibility For [forward compatibility](https://developer.blender.org/docs/handbook/guidelines/compatibility_handling_for_blend_files/#forward-compatibility), care has to be taken that opening new files with an older Blender still works. We may need to add a few more pointers to the `AnimData` struct to make this work. ### Suggested Approach When saving the blend file to disk (but not to the in-memory undo buffer): - Detect that NLA tweak mode is enabled. Then write the animdata as if it is not (taking care of both the flags and the pointers). - When writing the scene, always clear the 'NLA tweak mode enabled' flag. Yes, this is stored on the scene too, for some reason. - Somehow store that tweak mode was enabled, and on which animated data-block. That way this change is transparent to the user, as when opening the file it is in the same state as when they saved it. ### Chosen Approach Instead of changing the _writing_, we chose to change the _reading_. This ensures forward compatibility (on disk, nothing changed) and avoids any unforseen side-effects. - When linking an animated ID, its NLA tweak mode is always disabled. This fixes the "ghost NLA tweak mode" that cannot be disabled (because linked data cannot be edited). - After applying library overrides, the pointers & flags that make up NLA Tweak Mode are made consistent. This ensures that tweak mode is either on, or off, but not in some in-between state.
Sybren A. Stüvel added the
Module
Animation & Rigging
Type
Design
labels 2024-04-12 15:11:38 +02:00
Author
Member

Implemented in 910360637b

Implemented in 910360637b
Blender Bot added the
Status
Archived
label 2024-04-22 14:59:17 +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
1 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#120573
No description provided.