Anim: migrate Action assignments to the new API #128026
No reviewers
Labels
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
2 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender#128026
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "dr.sybren/blender:anim/refactor-action-assignments"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Instead of assigning Actions by direct pointer manipulation (and the
corresponding juggling of user counts), call
animrig::assign_action()
and
animrig::unassign_action()
.These functions not only correctly handle user counts, but also ensure
that slot assignments & user tracking works. The former always happens,
the latter only when building with experimental features enabled.
Because (un)assigning slotted Actions need the animated ID (instead of
just the
AnimData *
), more functions now require anOwnedAnimData
.Note that there is still some user count juggling. This is caused by
BKE_id_new()
, and by extensionBKE_action_add
, returning an ID withuser count = 1, even though that ID is not yet used. A todo task #128017
has been made to change
BKE_action_add()
so that the Action it returnscan be directly fed into
animrig::assign_action()
.This PR updates the following areas:
the animation data. This PR just handles the assignment of a new
Action.
No functional changes.
Ref: #123424
This PR sits on top of #128030, will rebase later.
BKE_animdata_from_id()
3e60c85f0aBKE_animdata_action_ensure_idroot
compat with layered Actions cc95aaba68animdata_copy_id_action
d400dfd9a1id_action_ensure()
@blender-bot build
bc57f6994d
to7c2fd9f964
anim/refactor-action-assignmentsto Anim: migrate Action assignments to the new APIJust one place where I think the code could be clearer, which can be addressed while landing. Otherwise looks good, and kicking the tires a bit didn't reveal any issues.
@ -746,3 +761,1 @@
id_us_min(&dstAdt->action->id);
dstAdt->action = BKE_action_add(bmain, dstAdt->action->id.name + 2);
BKE_animdata_action_ensure_idroot(dstID, dstAdt->action);
if (dstAdt->action) {
If I understand correctly, what this is really saying is
if (dstAdt->action == srcAdt->action)
. But you have to reason about the outer if's conditions to see that.I think this can be refactored to be clearer by changing this to
if (dstAdt->action == srcAdt->action)
and moving it above theif (!dstAdt->action || dstAdt->action == srcAdt->action)
block. And then also changing that to justif (!dstAdt->action)
.In other words, the flow would then be:
7c2fd9f964
to77d51d1603