diff options
author | Sybren A. Stüvel <sybren@blender.org> | 2020-09-25 12:07:32 +0300 |
---|---|---|
committer | Sybren A. Stüvel <sybren@blender.org> | 2020-09-25 15:20:59 +0300 |
commit | 64583f3e8d0f337a977c9a90b874bee733a37402 (patch) | |
tree | 3356dd4b14ed5f0cbaf0236b2ac51f7f4dad1ec0 /source/blender/blenkernel/BKE_anim_data.h | |
parent | 5419f9a845ed58205ffbf38497ce9ff595499466 (diff) |
Animation: set Action `idroot` at assignment instead of just at evaluation
Actions are either locked to a specific ID type, or "floating". Actions
in the floating state are now locked when they are assigned to an ID block.
Previously (rB94b99b5d4a7c20cf2) this was done at evaluation time, which
caused various problems:
- The ID type was set on the evaluated copy, and inconsistently flushed
back to the original.
- A newly created Action could not be assigned to an Action constraint,
unless a depsgraph evaluation was be forced first.
This is now resolved by calling `BKE_animdata_set_action()` to set the
action (instead of direct assignment) where possible, and calling
`BKE_animdata_action_ensure_idroot()` otherwise.
Manifest Task: https://developer.blender.org/T80986
Diffstat (limited to 'source/blender/blenkernel/BKE_anim_data.h')
-rw-r--r-- | source/blender/blenkernel/BKE_anim_data.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/source/blender/blenkernel/BKE_anim_data.h b/source/blender/blenkernel/BKE_anim_data.h index 48ea06ea9d8..5293d8dd9b0 100644 --- a/source/blender/blenkernel/BKE_anim_data.h +++ b/source/blender/blenkernel/BKE_anim_data.h @@ -58,6 +58,10 @@ bool BKE_animdata_set_action(struct ReportList *reports, struct ID *id, struct b bool BKE_animdata_action_editable(const struct AnimData *adt); +/* Ensure that the action's idroot is set correctly given the ID type of the owner. + * Return true if it is, false if it was already set to an incompatible type. */ +bool BKE_animdata_action_ensure_idroot(const struct ID *owner, struct bAction *action); + /* Free AnimData */ void BKE_animdata_free(struct ID *id, const bool do_id_user); |