Anim: Remove 'Slotted Actions' experimental flag #128889

Merged
Sybren A. Stüvel merged 5 commits from dr.sybren/blender:anim/remove-slotted-actions-experimental-flag into main 2024-10-15 16:30:13 +02:00

TODO before landing:

  • !129002 should land first
  • Check that the Blender version is still bumped correctly, and checked for in the versioning code.

This commit takes the 'Slotted Actions' out of the experimental phase.
As a result:

  • All newly created Actions will be slotted Actions.
  • Legacy Actions loaded from disk will be versioned to slotted Actions.
  • The new Python API for slots, layers, strips, and channel bags is available.
  • The legacy Python API for accessing F-Curves and Action Groups is still available, and will operate on the F-Curves/Groups for the first slot only.
  • Creating an Action by keying (via the UI, operators, or the rna_struct.keyframe_insert function) will try and share Actions between related data-blocks. See !126655 for more info about this.
  • Assigning an Action to a data-block will auto-assign a suitable Action Slot. The logic for this is described below. However, There are cases where this does not automatically assign a slot, and thus the Action will effectively not animate the data-block. Effort has been spent to make Action selection work both reliably for Blender users as well as keep the behaviour the same for Python scripts. Where these two goals did not converge, reliability and understandability for users was prioritised.

Auto-selection of the Action Slot upon assigning the Action works as follows. The first rule to find a slot wins.

  1. The data-block remembers the slot name that was last assigned. If the newly assigned Action has a slot with that name, it is chosen.
  2. If the Action has a slot with the same name as the data-block, it is chosen.
  3. If the Action has only one slot, and it has never been assigned to anything, it is chosen.
  4. If the Action is assigned to an NLA strip or an Action constraint, and the Action has a single slot, and that slot has a suitable ID type, it is chosen.

This last step is what I was referring to with "Where these two goals did not converge, reliability and understandability for users was prioritised." For regular Action assignments (like via the Action selectors in the Properties editor) this rule doesn't apply, even though with legacy Actions the final state ("it is animated by this Action") differs from the final state with slotted Actions ("it has no slot so is not animated"). This is done to support the following workflow:

  • Create an Action by animating Cube.
  • In order to animate Suzanne with that same Action, assign the Action to Suzanne.
  • Start keying Suzanne. This auto-creates and auto-assigns a new slot for Suzanne.

If rule 4. above would apply in this case, the 2nd step would automatically select the Cube slot for Suzanne as well, which would immediately overwrite Suzanne's properties with the Cube animation.

Technically, this commit:

  • removes the WITH_ANIM_BAKLAVA build flag,
  • removes the use_animation_baklava experimental flag in preferences,
  • updates the code to properly deal with the fact that empty Actions are now always considered slotted/layered Actions (instead of that relying on the user preference).

Note that 'slotted Actions' and 'layered Actions' are the exact same thing, just focusing on different aspects (slot & layers) of the new data model.

The "Baklava phase 1" assumptions are still asserted. This means that:

  • an Action can have zero or one layer,
  • that layer can have zero or one strip,
  • that strip must be of type 'keyframe' and be infinite with zero offset.

The code to handle legacy Actions is NOT removed in this commit. It will be removed later. For now it's likely better to keep it around as reference to the old behaviour in order to aid in some inevitable bugfixing.

Ref: #120406


This PR also contains #128892, which should definitely land first. After that I'll rebase this PR to clean it up.

**TODO before landing:** - [x] !129002 should land first - [ ] Check that the Blender version is still bumped correctly, and checked for in the versioning code. This commit takes the 'Slotted Actions' out of the experimental phase. As a result: - All newly created Actions will be slotted Actions. - Legacy Actions loaded from disk will be versioned to slotted Actions. - The new Python API for slots, layers, strips, and channel bags is available. - The legacy Python API for accessing F-Curves and Action Groups is still available, and will operate on the F-Curves/Groups for the first slot only. - Creating an Action by keying (via the UI, operators, or the `rna_struct.keyframe_insert` function) will try and share Actions between related data-blocks. See !126655 for more info about this. - Assigning an Action to a data-block will auto-assign a suitable Action Slot. The logic for this is described below. However, There are cases where this does _not_ automatically assign a slot, and thus the Action will effectively _not_ animate the data-block. Effort has been spent to make Action selection work both reliably for Blender users as well as keep the behaviour the same for Python scripts. Where these two goals did not converge, reliability and understandability for users was prioritised. Auto-selection of the Action Slot upon assigning the Action works as follows. The first rule to find a slot wins. 1. The data-block remembers the slot name that was last assigned. If the newly assigned Action has a slot with that name, it is chosen. 2. If the Action has a slot with the same name as the data-block, it is chosen. 3. If the Action has only one slot, and it has never been assigned to anything, it is chosen. 4. If the Action is assigned to an NLA strip or an Action constraint, and the Action has a single slot, and that slot has a suitable ID type, it is chosen. This last step is what I was referring to with "Where these two goals did not converge, reliability and understandability for users was prioritised." For regular Action assignments (like via the Action selectors in the Properties editor) this rule doesn't apply, even though with legacy Actions the final state ("it is animated by this Action") differs from the final state with slotted Actions ("it has no slot so is not animated"). This is done to support the following workflow: - Create an Action by animating Cube. - In order to animate Suzanne with that same Action, assign the Action to Suzanne. - Start keying Suzanne. This auto-creates and auto-assigns a new slot for Suzanne. If rule 4. above would apply in this case, the 2nd step would automatically select the Cube slot for Suzanne as well, which would immediately overwrite Suzanne's properties with the Cube animation. Technically, this commit: - removes the `WITH_ANIM_BAKLAVA` build flag, - removes the `use_animation_baklava` experimental flag in preferences, - updates the code to properly deal with the fact that empty Actions are now always considered slotted/layered Actions (instead of that relying on the user preference). Note that 'slotted Actions' and 'layered Actions' are the exact same thing, just focusing on different aspects (slot & layers) of the new data model. The "Baklava phase 1" assumptions are still asserted. This means that: - an Action can have zero or one layer, - that layer can have zero or one strip, - that strip must be of type 'keyframe' and be infinite with zero offset. The code to handle legacy Actions is NOT removed in this commit. It will be removed later. For now it's likely better to keep it around as reference to the old behaviour in order to aid in some inevitable bugfixing. Ref: #120406 ------ This PR also contains #128892, which should definitely land first. After that I'll rebase this PR to clean it up.
Sybren A. Stüvel added the
Module
Animation & Rigging
label 2024-10-11 14:06:15 +02:00
Sybren A. Stüvel requested review from Nathan Vegdahl 2024-10-11 14:06:39 +02:00
Sybren A. Stüvel force-pushed anim/remove-slotted-actions-experimental-flag from 941f05070e to 8493c505b3 2024-10-11 14:09:35 +02:00 Compare
Sybren A. Stüvel force-pushed anim/remove-slotted-actions-experimental-flag from 8493c505b3 to 8b20a4b0cb 2024-10-11 15:30:30 +02:00 Compare
Author
Member

@blender-bot build

@blender-bot build
Sybren A. Stüvel force-pushed anim/remove-slotted-actions-experimental-flag from 8b20a4b0cb to bd59525805 2024-10-11 16:16:20 +02:00 Compare
Author
Member

@blender-bot build

@blender-bot build
Sybren A. Stüvel force-pushed anim/remove-slotted-actions-experimental-flag from bd59525805 to 6b316a115b 2024-10-11 16:29:39 +02:00 Compare
Sybren A. Stüvel force-pushed anim/remove-slotted-actions-experimental-flag from 6b316a115b to ae1e21d78e 2024-10-11 16:30:26 +02:00 Compare
Author
Member

@blender-bot build

@blender-bot build
Author
Member

@blender-bot build

@blender-bot build
Sybren A. Stüvel changed title from WIP: Anim: Remove 'Slotted Actions' experimental flag to Anim: Remove 'Slotted Actions' experimental flag 2024-10-14 09:27:09 +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/PR128889) when ready.
Sybren A. Stüvel force-pushed anim/remove-slotted-actions-experimental-flag from e322fd50e5 to f05d3e2979 2024-10-14 18:47:38 +02:00 Compare
Author
Member

@blender-bot build

@blender-bot build
Member

This PR also contains #128892, which should definitely land first. After that I'll rebase this PR to clean it up.

Based on what you said in person earlier and looking at the two PRs, I assume this is no longer true and has already been rebased?

> This PR also contains #128892, which should definitely land first. After that I'll rebase this PR to clean it up. Based on what you said in person earlier and looking at the two PRs, I assume this is no longer true and has already been rebased?
Nathan Vegdahl approved these changes 2024-10-14 19:57:35 +02:00
Nathan Vegdahl left a comment
Member

Didn't catch anything that looks wrong, so I think as soon as #129002 lands we can land this.

(Although for some reason my attempt to kick off a build bot for that failed. I'll try again.)

Didn't catch anything that looks wrong, so I think as soon as #129002 lands we can land this. (Although for some reason my attempt to kick off a build bot for that failed. I'll try again.)
Sybren A. Stüvel added 1 commit 2024-10-15 08:20:20 +02:00
Sybren A. Stüvel added 1 commit 2024-10-15 08:21:25 +02:00
Remove print in test
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-arm64 Build done.
buildbot/vexp-code-patch-darwin-x86_64 Build done.
buildbot/vexp-code-patch-windows-amd64 Build done.
buildbot/vexp-code-patch-coordinator Build done.
b885c6dbd8
Author
Member

@blender-bot build

@blender-bot build
Sybren A. Stüvel added 1 commit 2024-10-15 14:51:38 +02:00
Merge remote-tracking branch 'origin/main' into anim/remove-slotted-actions-experimental-flag
Some checks failed
buildbot/vexp-code-patch-lint Build done.
buildbot/vexp-code-patch-linux-x86_64 Build done.
buildbot/vexp-code-patch-windows-amd64 Build done.
buildbot/vexp-code-patch-darwin-arm64 Build done.
buildbot/vexp-code-patch-darwin-x86_64 Build done.
buildbot/vexp-code-patch-coordinator Build done.
bf95f62c5c
Author
Member

@blender-bot build

@blender-bot build
Sybren A. Stüvel added 1 commit 2024-10-15 15:02:44 +02:00
Author
Member

The buildbot build was succesful. It just failed on the linter on code that isn't touched by this PR.

The [buildbot build](https://builder.blender.org/admin/#/builders/210/builds/4583) was succesful. It just failed on the linter on code that isn't touched by this PR.
Sybren A. Stüvel merged commit 43d7558e5b into main 2024-10-15 16:30:13 +02:00
Sybren A. Stüvel deleted branch anim/remove-slotted-actions-experimental-flag 2024-10-15 16:30:17 +02:00
Author
Member

The tests we performed before accepting & landing this PR:

Slotted Action Testing

A list of issues discovered while testing slotted actions with addons, production files, etc. after taking them out of experimental:

#128889: WIP: Anim: Remove 'Slotted Actions' experimental flag

General Poking

  • Inserting keys (that create new fcurves) isn't auto-creating the channel groups like it should. (#128891)
    • Fixed!

Addon Testing

  • Camera Shakify:

    • The code that assigns the action to the action constraints no longer works, breaking the addon. This is a twofold issue:
      1. Just in general, assigning an action with one slot with an unspecified id_type doesn't auto-assign the slot like it should.
      2. Camera Shakify has a workaround for a (now fixed) bug in Blender, and that work-around sets the id_type of the slot before attempting to assign to the action constraint.
    • Fixed!
  • Action to Scene Range

    • Wasn't able to test due to encountering a crash (BLI_assert) when trying to switch actions. Come back to this later after that's fixed.
    • Sybren writes: the add-on also won't do the auto-switching, because the bpy.types.SpaceDopeSheetEditor property doesn't change any more. We may want to see if we can get that to work again. (add-on source)
  • Nuke Animation Format (.chan)

    • Works like a charm, and even ends up putting related data into the same action (e.g. camera transforms and camera data) just because of how automatic action assignment works when keyframing.
  • Bake Shape Keys

    • Works like a charm.
  • Convert Rotation Mode

    • Works at least as well as before.
    • It even works on the appropriate slot when converting the keys of a multi-slot action!
  • Export Camera Animation

    • Works like a charm.
  • Unreal PSK/PSA (.psk/.psa)

    • Crashes immediately after selecting the "Export -> Unreal PSA" menu item.
      • ...but that's already the case in main.
      • Come back to this later once that's fixed.
  • ?? VRM format

    • Exporting .vrm is broken, but the error is complaining about not being able to do Python import of gltf, so probably not us.
      • Was able to export from Blender 4.2.2
    • Exporting .vrma doesn't seem to work, but it's identical in Blender 4.2.2.
    • Importing .vrm doesn't do anything, but it's identical in Blender 4.2.2.
    • Didn't test importing .vrma because I wasn't able to export any files to test with.
    • All-in-all this addon seems badly broken even without our help. But maybe I'm just not using it right...?
  • Real Time Paths

    • Works at least as well as before.
      • Only works in "After Change" mode, not "Real Time" mode, but it's identical in Blender 4.2.2.
      • Only works with things animated on the first slot, although that's probably to be expected with the backwards-compat APIs.
  • AnimAll

    • Works like a charm.
    • Even with multiple IDs animated by different slots on the same action.
  • Cake_Particles

    • Works like a charm.
    • (Side note: creates an action for every particle. Seems like a prime example of an addon that could take great advantage of slotted actions!)
  • CloudRig

    • Works great, including the action constraint features.
  • Rigify

    • Works great, including the action constraint features.
    • (In theory there could still be issues with external feature sets if they use action constraints, but given that action constraints are working with everything else, that seems unlikely.)

Gold Production File Testing

  • Open a variety of animation files (both heavy and light) from a variety of scenes and test playback.
    • No apparent issues: they load and playback correctly compared to opening them in 4.2.2 as well as 4.3 beta.
    • Performance with an optimized build is also very comparable: sometimes a little slower, sometimes a little faster, but always in the same ballpark (to the point that I had to check the fps numbers to tell if they were different).
  • Test out editing the animations.
    • Opened a handful of animation files and screwed up the animator's beautiful animations. Everything worked fine.
    • Saved one of them and then opened in 4.3 beta, and the forwards compatability stuff worked: opened perfectly, including my screwed up version of the animation.
  • Test out lighting files (to test linked animation).
    • Opened a handful of lighting files, and the animation all played back correctly. Looking at the Action editor, the actions from the linked files were properly upgraded, along with the auto-created slots from the upgrade being assigned correctly.
    • Opened the lighting file for the animation file that I messed with and saved. That also worked correctly.
      • Also tested the same in 4.3 beta, and the forwards-compatability worked correctly from the lighting file as well.

Grease Pencil Demos

  • Color Void
    • Tested animation and lighting file for shots 0010 and 0060.
    • Everything loaded and played back correctly, comparing to Blender 4.3 beta.
  • Cowboi
    • Tested all files under shots directory for playback, and they all worked identically to Blender 4.3 beta.
  • Windmill
    • Tested playback in the animation and lighting file.
      • Embedded node trees (at least in materials) are not getting their new slot assigned when upgrading actions. In this case this leads to the water texture not animating. (Fix: #129002)
      • Otherwise everything appears to be working.

Other test files

  • From blender.org demo files:
    • Ellie Pose Library (use within the same file) (found issue, fixed in #128992)
    • Bike Ride (playback)
    • 'Hi, my name is Amy' (playback)
    • Internal Air Pressure (playback)
    • Chains Compound Collision (playback)
    • Weight Shift (playback)
The tests we performed before accepting & landing this PR: # Slotted Action Testing A list of issues discovered while testing slotted actions with addons, production files, etc. after taking them out of experimental: [#128889: WIP: Anim: Remove 'Slotted Actions' experimental flag](https://projects.blender.org/blender/blender/pulls/128889) ## General Poking - [x] Inserting keys (that create new fcurves) isn't auto-creating the channel groups like it should. ([#128891](https://projects.blender.org/blender/blender/pulls/128891)) - Fixed! ## Addon Testing - ✅ [Camera Shakify](https://github.com/EatTheFuture/camera_shakify/): - ~~The code that assigns the action to the action constraints no longer works, breaking the addon. This is a twofold issue:~~ 1. ~~Just in general, assigning an action with one slot with an unspecified id_type doesn't auto-assign the slot like it should.~~ 2. ~~Camera Shakify has a workaround for a (now fixed) bug in Blender, and that work-around sets the id_type of the slot before attempting to assign to the action constraint.~~ - Fixed! - [Action to Scene Range](https://extensions.blender.org/add-ons/action-to-scene-range/) - Wasn't able to test due to encountering a crash (`BLI_assert`) when trying to switch actions. Come back to this later after that's fixed. - Sybren writes: the add-on also won't do the auto-switching, because the `bpy.types.SpaceDopeSheetEditor` property doesn't change any more. We may want to see if we can get that to work again. ([add-on source](https://projects.blender.org/extensions/action_to_scene_range/src/branch/main/source/__init__.py)) - ✅ [Nuke Animation Format (.chan)](https://extensions.blender.org/add-ons/nuke-animation-format-chan/) - Works like a charm, and even ends up putting related data into the same action (e.g. camera transforms and camera data) just because of how automatic action assignment works when keyframing. - ✅ [Bake Shape Keys](https://extensions.blender.org/add-ons/bake-shape-keys/) - Works like a charm. - ✅ [Convert Rotation Mode](https://extensions.blender.org/add-ons/convert-rotation-mode/) - Works at least as well as before. - It even works on the appropriate slot when converting the keys of a multi-slot action! - ✅ [Export Camera Animation](https://extensions.blender.org/add-ons/export-camera-animation/) - Works like a charm. - [Unreal PSK/PSA (.psk/.psa)](https://extensions.blender.org/add-ons/io-scene-psk-psa/) - Crashes immediately after selecting the "Export -> Unreal PSA" menu item. - ...but that's already the case in main. - Come back to this later once that's fixed. - ?? [VRM format](https://extensions.blender.org/add-ons/vrm/) - Exporting .vrm is broken, but the error is complaining about not being able to do Python `import` of gltf, so probably not us. - Was able to export from Blender 4.2.2 - Exporting .vrma doesn't seem to work, but it's identical in Blender 4.2.2. - Importing .vrm doesn't do anything, but it's identical in Blender 4.2.2. - Didn't test importing .vrma because I wasn't able to export any files to test with. - All-in-all this addon seems badly broken even without our help. But maybe I'm just not using it right...? - ✅ [Real Time Paths](https://extensions.blender.org/add-ons/real-time-paths/) - Works at least as well as before. - Only works in "After Change" mode, not "Real Time" mode, but it's identical in Blender 4.2.2. - Only works with things animated on the first slot, although that's probably to be expected with the backwards-compat APIs. - ✅ [AnimAll](https://extensions.blender.org/add-ons/animall/) - Works like a charm. - Even with multiple IDs animated by different slots on the same action. - ✅ [Cake_Particles](https://extensions.blender.org/add-ons/cake-particles/) - Works like a charm. - (Side note: creates an action for every particle. Seems like a prime example of an addon that could take great advantage of slotted actions!) - ✅ [CloudRig](https://extensions.blender.org/add-ons/cloudrig/) - Works great, including the action constraint features. - ✅ Rigify - Works great, including the action constraint features. - (In theory there could still be issues with external feature sets if they use action constraints, but given that action constraints are working with everything else, that seems unlikely.) ## ✅ Gold Production File Testing - [x] Open a variety of animation files (both heavy and light) from a variety of scenes and test playback. - No apparent issues: they load and playback correctly compared to opening them in 4.2.2 as well as 4.3 beta. - Performance with an optimized build is also very comparable: sometimes a little slower, sometimes a little faster, but always in the same ballpark (to the point that I had to check the fps numbers to tell if they were different). - [x] Test out editing the animations. - Opened a handful of animation files and screwed up the animator's beautiful animations. Everything worked fine. - Saved one of them and then opened in 4.3 beta, and the forwards compatability stuff worked: opened perfectly, including my screwed up version of the animation. - [x] Test out lighting files (to test linked animation). - Opened a handful of lighting files, and the animation all played back correctly. Looking at the Action editor, the actions from the linked files were properly upgraded, along with the auto-created slots from the upgrade being assigned correctly. - Opened the lighting file for the animation file that I messed with and saved. That also worked correctly. - Also tested the same in 4.3 beta, and the forwards-compatability worked correctly from the lighting file as well. ## Grease Pencil Demos - [x] Color Void - Tested animation and lighting file for shots 0010 and 0060. - Everything loaded and played back correctly, comparing to Blender 4.3 beta. - [x] Cowboi - Tested all files under `shots` directory for playback, and they all worked identically to Blender 4.3 beta. - [x] Windmill - Tested playback in the animation and lighting file. - [x] Embedded node trees (at least in materials) are not getting their new slot assigned when upgrading actions. In this case this leads to the water texture not animating. (Fix: [#129002](https://projects.blender.org/blender/blender/pulls/129002)) - Otherwise everything appears to be working. ## Other test files - From [blender.org demo files](https://www.blender.org/download/demo-files/): - [x] Ellie Pose Library (use within the same file) (found issue, fixed in #128992) - [x] Bike Ride (playback) - [x] 'Hi, my name is Amy' (playback) - [x] Internal Air Pressure (playback) - [x] Chains Compound Collision (playback) - [x] [Weight Shift](https://studio.blender.org/training/animation-fundamentals/5d7108e641dac1bab63cccc1/) (playback)
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
Code Documentation
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
FBX
Interest
Freestyle
Interest
Geometry Nodes
Interest
glTF
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 & 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
Asset System
Module
Core
Module
Development Management
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline & 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
3 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#128889
No description provided.