diff options
author | Colin Basnett <cmbasnett> | 2022-06-23 12:41:44 +0300 |
---|---|---|
committer | Sybren A. Stüvel <sybren@blender.org> | 2022-06-23 12:45:53 +0300 |
commit | 091100bfd757b886527b465aef19a88ba261d7ec (patch) | |
tree | af7b67293092d1207f38421b477b0ae62ed6e4db /source/blender/blenkernel/intern | |
parent | 2ae4397ec9905a0055ad80675ade2696137a7ca2 (diff) |
Animation: Add function to remove all FCurves from an Action
Add a `BKE_action_fcurves_clear(action)` function, which removes all the
Action's FCurves, and expose it as `ActionFCurves.clear()` in RNA.
This is more ergonomic than calling `remove` on f-curves until the list
is empty.
Reviewed By: sybren
Differential Revision: https://developer.blender.org/D14660
Diffstat (limited to 'source/blender/blenkernel/intern')
-rw-r--r-- | source/blender/blenkernel/intern/action.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/action.c b/source/blender/blenkernel/intern/action.c index 05b51e0c9fa..fee7582acb3 100644 --- a/source/blender/blenkernel/intern/action.c +++ b/source/blender/blenkernel/intern/action.c @@ -1983,3 +1983,16 @@ void BKE_pose_blend_read_expand(BlendExpander *expander, bPose *pose) BLO_expand(expander, chan->custom); } } + +void BKE_action_fcurves_clear(bAction *act) +{ + if (!act) { + return; + } + while (act->curves.first) { + FCurve *fcu = act->curves.first; + action_groups_remove_channel(act, fcu); + BKE_fcurve_free(fcu); + } + DEG_id_tag_update(&act->id, ID_RECALC_ANIMATION_NO_FLUSH); +} |