Assigned action is lost if file is saved while in NLA tweaking mode on a linked object with linked animation data #106801

Closed
opened 2023-04-11 13:05:02 +02:00 by Corrado Piscitelli · 12 comments

System Information
Operating system: macOS-13.3-arm64-arm-64bit 64 Bits
Graphics card: Metal API Apple M1 Pro 1.2

Blender Version
Broken: version: 3.5.0, branch: blender-v3.5-release, commit date: 2023-03-29 02:56, hash: 1be25cfff18b
Worked: NA

Short description of error
NLA Editor loses original assigned action to a linked rig generated with rigify if file is saved in tweaking mode on a strip with a different action.

Entering tweaking mode temporarily changes the assigned action in Action Editor with the one the user wants to edit. Normally saving the file in this state and then reopening it will not be a problem, the user will find the interface exactly as it was saved, with tweaking mode active, and getting out of tweaking mode will reset the action in Action Editor to the previous assigned one.

However, if this is done to a linked rig generated with rigify (I could test and reproduce this bug on a human metarig and on a rig with just a pivot with the switchable parent property) reopening the file will result in tweaking mode being off and the termporary assigned action now being the permanent one in Action Editor (with the possible loss of the previous one).

Exact steps for others to reproduce the error
Complete list:
Create a file with a human metarig and generate rig with rigify.
Link the collection with the generated rig in a new file.
Now you have to make a library override, either using the drop down menus in the 3d view "Object -> Relations -> Make Library Override", or "Object -> Library Override -> Make", or by using the right click menu in the outliner going in "Library Override -> Make -> Selected and Content".
Create an action strip (Action_A).
Create a new action in action editor without creating a new strip (Action_B).
Enter tweaking mode on the previous action strip (Action_A).
Save file, then reopen.
Now the action in Action Editor will be Action_A, even though it should still be Action_B. Action_B should now still be in the file with 0 users.

Short list:
Open attached file:[animation_human_clean.blend] 01_base_file.png
Enter Tweaking mode on action strip, as shown in screenshot 02_how_to_reproduce.png
Save file, then reopen.
You should find this result 03_effect.png

By making a few tests I've been able to narrow it down to there being any bone with a "switchable parent" rigify property generating this bug.

*Edited the post to add clearer linking and library override instructios in the complete list.

**System Information** Operating system: macOS-13.3-arm64-arm-64bit 64 Bits Graphics card: Metal API Apple M1 Pro 1.2 **Blender Version** Broken: version: 3.5.0, branch: blender-v3.5-release, commit date: 2023-03-29 02:56, hash: `1be25cfff18b` Worked: NA **Short description of error** NLA Editor loses original assigned action to a linked rig generated with rigify if file is saved in tweaking mode on a strip with a different action. Entering tweaking mode temporarily changes the assigned action in Action Editor with the one the user wants to edit. Normally saving the file in this state and then reopening it will not be a problem, the user will find the interface exactly as it was saved, with tweaking mode active, and getting out of tweaking mode will reset the action in Action Editor to the previous assigned one. However, if this is done to a linked rig generated with rigify (I could test and reproduce this bug on a human metarig and on a rig with just a pivot with the switchable parent property) reopening the file will result in tweaking mode being off and the termporary assigned action now being the permanent one in Action Editor (with the possible loss of the previous one). **Exact steps for others to reproduce the error** Complete list: Create a file with a human metarig and generate rig with rigify. Link the collection with the generated rig in a new file. Now you have to make a library override, either using the drop down menus in the 3d view "Object -> Relations -> Make Library Override", or "Object -> Library Override -> Make", or by using the right click menu in the outliner going in "Library Override -> Make -> Selected and Content". Create an action strip (Action_A). Create a new action in action editor without creating a new strip (Action_B). Enter tweaking mode on the previous action strip (Action_A). Save file, then reopen. Now the action in Action Editor will be Action_A, even though it should still be Action_B. Action_B should now still be in the file with 0 users. Short list: Open attached file:[animation_human_clean.blend] ![01_base_file.png](/attachments/afd358f0-22fe-48c3-b71f-57c7e451acf4) Enter Tweaking mode on action strip, as shown in screenshot ![02_how_to_reproduce.png](/attachments/6aaef6e9-d903-43c3-a09f-2ec8c59f8fba) Save file, then reopen. You should find this result ![03_effect.png](/attachments/d4e43486-9e3b-41b1-96e5-48408b774338) By making a few tests I've been able to narrow it down to there being any bone with a "switchable parent" rigify property generating this bug. *Edited the post to add clearer linking and library override instructios in the complete list.
Corrado Piscitelli added the
Type
Report
Status
Needs Triage
Priority
Normal
labels 2023-04-11 13:05:02 +02:00

@bclark This is the issue @icappiello was talking about.

@bclark This is the issue @icappiello was talking about.
Member

@angavrilov this seems something that you should have a look too. it seems to happen only when a rig contains a rigify space switching enabled sub-rig (basic pivot, limbs, spine)

@angavrilov this seems something that you should have a look too. it seems to happen only when a rig contains a rigify space switching enabled sub-rig (basic pivot, limbs, spine)
Richard Antalik added
Module
Animation & Rigging
Status
Confirmed
and removed
Status
Needs Triage
labels 2023-04-13 07:05:38 +02:00
Member

Thanks, I didn't get the tag notification here :(
Looking.

Thanks, I didn't get the tag notification here :( Looking.
Member

We need to update the ticket to include the entire process including how you made the library override.

We need to update the ticket to include the entire process including how you made the library override.

I have edited the post by adding a few more informations on the library override.
I basically tested every method I knew to make them and always got the same result.

By the way, the added lines are these:
Link the collection with the generated rig in a new file.
Now you have to make a library override, either using the drop down menus in the 3d view "Object -> Relations -> Make Library Override", or "Object -> Library Override -> Make", or by using the right click menu in the outliner going in "Library Override -> Make -> Selected and Content".

If there's more to add, I'm here.

I have edited the post by adding a few more informations on the library override. I basically tested every method I knew to make them and always got the same result. By the way, the added lines are these: Link the collection with the generated rig in a new file. Now you have to make a library override, either using the drop down menus in the 3d view "Object -> Relations -> Make Library Override", or "Object -> Library Override -> Make", or by using the right click menu in the outliner going in "Library Override -> Make -> Selected and Content". If there's more to add, I'm here.
Nathan Vegdahl self-assigned this 2023-05-11 19:04:54 +02:00
Sybren A. Stüvel added this to the Animation & Rigging project 2023-05-15 11:46:01 +02:00
Member

I've narrowed down the problematic case a bit. This doesn't happen with all rigify rigs. For example, if you create a metarig that only has the super_copy rig type in it, everything works fine.

It appears to be the case that this only happens with Rigify rigs that include rig types that trigger the creation of a weird sub-track on the NLA:

weird_sub_track.png

The rig types that trigger the creation of this sub-track at least include the limb.arm and limb.leg types. And this sub-track is created when Rigify generates the rig (i.e. the weird sub-track is already in the rig file, not just when linking).

It's not clear to me yet what that sub-track is (presumably an NLA feature I'm not familiar with?), nor is it at all clear to me why Rigify is messing with NLA tracks at all. But I think this at least narrows things down a little bit.

I've narrowed down the problematic case a bit. This doesn't happen with all rigify rigs. For example, if you create a metarig that only has the `super_copy` rig type in it, everything works fine. It appears to be the case that this only happens with Rigify rigs that include rig types that trigger the creation of a weird sub-track on the NLA: ![weird_sub_track.png](/attachments/9ad62e58-4947-45d5-9ce0-c47e0d28b23e) The rig types that trigger the creation of this sub-track at least include the `limb.arm` and `limb.leg` types. And this sub-track is created when Rigify generates the rig (i.e. the weird sub-track is already in the rig file, not just when linking). It's not clear to me yet what that sub-track is (presumably an NLA feature I'm not familiar with?), nor is it at all clear to me why Rigify is messing with NLA tracks at all. But I think this at least narrows things down a little bit.
Member

With the help of @dr.sybren I figured out what that sub-track is, and was also able to create a minimal repro.

Minimal Repro

Files:

These were created by hand without Rigify. They have the same general structure as the repro files from @CorradoPiscitelli, and the same reported (short list) steps can be used to repro with these files.

Explanation

The weird sub-track turns out to be the animation data of the armature data block (not object).

The situation that triggers this bug is when the rig has animation data on both the armature object and the armature data, in the rig file itself. Having animation data on only the armature object or the armature data block is not enough. Both have to have animation data on them. I must have messed up my testing. The triggering case is specifically having animation data on the armature object. Whether it's on the armature data block or not is irrelevant. (Which makes a lot more sense.)

(Side note: although this does mean the bug isn't specific to Rigify, it's still mysterious to me why Rigify is adding animation data to the armature data block. So that might be worth investigating separately.)

(Edit: turns out the reason for Rigify adding animation data to the armature data block is for drivers. For example, to let the animator tweak the curvature of rubber-hose limbs, since that's all b-bone based and the b-bone properties are on the armature data.)

With the help of @dr.sybren I figured out what that sub-track is, and was also able to create a minimal repro. ### Minimal Repro Files: - [`rig.blend`](/attachments/ddd62354-56ba-41d7-a6b8-0f57693db462) - [`animation.blend`](/attachments/3ffa3b34-c5bf-4c2c-a178-1d787c8ef70e) These were created by hand without Rigify. They have the same general structure as the repro files from @CorradoPiscitelli, and the same reported (short list) steps can be used to repro with these files. ### Explanation The weird sub-track turns out to be the animation data of the *armature data block* (not object). ~~The situation that triggers this bug is when the rig has animation data on both the armature object *and* the armature data, in the rig file itself. Having animation data on only the armature object *or* the armature data block is not enough. Both have to have animation data on them.~~ I must have messed up my testing. The triggering case is specifically having animation data on the armature *object*. Whether it's on the armature data block or not is irrelevant. (Which makes a lot more sense.) (Side note: although this does mean the bug isn't specific to Rigify, it's still mysterious to me why Rigify is adding animation data to the armature data block. So that might be worth investigating separately.) (Edit: turns out the reason for Rigify adding animation data to the armature data block is for drivers. For example, to let the animator tweak the curvature of rubber-hose limbs, since that's all b-bone based and the b-bone properties are on the armature data.)
Member

Thanks for tracking that down!
What is our bug/priority level for this now that we have it narrowed down to reproduce?

Thanks for tracking that down! What is our bug/priority level for this now that we have it narrowed down to reproduce?
Member

What is our bug/priority level for this now that we have it narrowed down to reproduce?

There's some potential for data loss here, with the following situation:

  1. Someone saves the file while in tweak mode.
  2. Later they open it up again, continue working without noticing anything is off yet. But Action_B is no longer used by anything (zero users).
  3. They save again. And Blender doesn't save Action_B, so it's lost on next open.

It's a little unlikely, since the situation will probably be noticed by the user at step 2 above. And if they're using the NLA, they're probably aware of how actions work and can re-assign Action_B without trouble. But I think it's probably worth making this high priority nevertheless. Data loss is one of the worst things you can do to a user.

I'll keep looking at it today, and see if I can fix it, or at least narrow it down enough to figure out who best to ping about it.

> What is our bug/priority level for this now that we have it narrowed down to reproduce? There's some potential for data loss here, with the following situation: 1. Someone saves the file while in tweak mode. 2. Later they open it up again, continue working without noticing anything is off yet. But Action_B is no longer used by anything (zero users). 3. They save again. And Blender doesn't save Action_B, so it's lost on next open. It's a *little* unlikely, since the situation will probably be noticed by the user at step 2 above. And if they're using the NLA, they're probably aware of how actions work and can re-assign Action_B without trouble. But I think it's probably worth making this high priority nevertheless. Data loss is one of the worst things you can do to a user. I'll keep looking at it today, and see if I can fix it, or at least narrow it down enough to figure out who best to ping about it.
Nathan Vegdahl added
Priority
High
and removed
Priority
Normal
labels 2023-05-16 10:09:30 +02:00
Member

Thanks to blender-asset-tracer, I've confirmed that the bug is happening on file save, not load. Action_B is already replaced by Action_A in the on-disk saved file.

Thanks to [`blender-asset-tracer`](https://pypi.org/project/blender-asset-tracer/), I've confirmed that the bug is happening on file *save*, not load. Action_B is already replaced by Action_A in the on-disk saved file.
Nathan Vegdahl added
Type
Bug
and removed
Type
Report
labels 2023-05-19 15:04:57 +02:00
Nathan Vegdahl changed title from Rigify + NLA - assigned action is lost if file is saved while in tweaking mode on rigify generated linked rig to Assigned action is lost if file is saved while in NLA tweaking mode on a linked armature with both object and data animation 2023-05-19 15:06:23 +02:00
Member

Nevermind, I was reading the data wrong (*facepalm*). It appears that the saved data is actually correct. So I think whatever is happening is happening on load.

Specifically, the on-disk blend file after saving has the following animdata fields set correctly:

  • action: set to Action_A
  • tmpact: set to Action_B
  • flag: set to 4 (which indicates being in tweak mode, and that the main action has been temporarily moved to tmpact while the tweaking action has been moved to action).
Nevermind, I was reading the data wrong (\*facepalm\*). It appears that the saved data is actually correct. So I think whatever is happening is happening on load. Specifically, the on-disk blend file after saving has the following animdata fields set correctly: - `action`: set to `Action_A` - `tmpact`: set to `Action_B` - `flag`: set to 4 (which indicates being in tweak mode, and that the main action has been temporarily moved to `tmpact` while the tweaking action has been moved to `action`).
Member

I re-tested the triggering cases, and I must have messed up my previous testing, because it appears that only the armature object's animation data is relevant here. This time around I tried all the following permutations in the rig file:

  • Object w/o animdata, Armature w/o animdata: no bug.
  • Object w/o animdata, Armature w animdata: no bug.
  • Object w animdata, Armature w/o animdata: bug triggered.
  • Object w animdata, Armature w animdata: bug triggered.

Investigating further, it looks like what's going on here is that because the tmpact field of animdata isn't exposed in RNA, the override system doesn't know anything about it and thus it doesn't get preserved in the linking file if there's animdata in the rig file to overwrite it.

The solution (assuming I've identified the source of the bug accurately) is to expose tmpact to RNA as well, so that its state gets properly preserved and overridden locally.

I re-tested the triggering cases, and I must have messed up my previous testing, because it appears that only the armature *object*'s animation data is relevant here. This time around I tried all the following permutations in the rig file: - Object w/o animdata, Armature w/o animdata: no bug. - Object w/o animdata, Armature w animdata: no bug. - Object w animdata, Armature w/o animdata: bug triggered. - Object w animdata, Armature w animdata: bug triggered. Investigating further, it looks like what's going on here is that because the `tmpact` field of animdata isn't exposed in RNA, the override system doesn't know anything about it and thus it doesn't get preserved in the linking file if there's animdata in the rig file to overwrite it. The solution (assuming I've identified the source of the bug accurately) is to expose `tmpact` to RNA as well, so that its state gets properly preserved and overridden locally.
Nathan Vegdahl changed title from Assigned action is lost if file is saved while in NLA tweaking mode on a linked armature with both object and data animation to Assigned action is lost if file is saved while in NLA tweaking mode on a linked object with linked animation data 2023-06-02 16:15:04 +02:00
Blender Bot added
Status
Resolved
and removed
Status
Confirmed
labels 2023-06-06 11:11:07 +02:00
Sybren A. Stüvel removed this from the Animation & Rigging project 2023-06-08 10:26:00 +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#106801
No description provided.