Fix #143818: Clear Keyframes operator unassigns action
The `ANIM_OT_keyframe_clear_v3d` had a few issues The reason for the action disappearing was the call to `animdata_remove_empty_action`. This checked the curves on the action directly, thus failed with the layered actions. However with the change to the layered action, the convention is that actions are not unassigned when it is empty. This is why I also added a check for legacy actions before the call. I am doing this even though legacy actions will be removed in 5.0 because this needs to be backported. The third issue was that `changed` was never set to true with layered actions, which meant the notifier was never sent to update the UI. Pull Request: https://projects.blender.org/blender/blender/pulls/144001
This commit is contained in:
committed by
Christoph Lendenfeld
parent
5b78323450
commit
1dd06e6623
@@ -312,7 +312,8 @@ bool animdata_remove_empty_action(AnimData *adt)
|
||||
if (adt->action != nullptr) {
|
||||
bAction *act = adt->action;
|
||||
DEG_id_tag_update(&act->id, ID_RECALC_ANIMATION_NO_FLUSH);
|
||||
if (BLI_listbase_is_empty(&act->curves) && (adt->flag & ADT_NLA_EDIT_ON) == 0) {
|
||||
Action &action = act->wrap();
|
||||
if (action.is_empty() && (adt->flag & ADT_NLA_EDIT_ON) == 0) {
|
||||
id_us_min(&act->id);
|
||||
adt->action = nullptr;
|
||||
return true;
|
||||
|
||||
@@ -753,6 +753,8 @@ static wmOperatorStatus clear_anim_v3d_exec(bContext *C, wmOperator * /*op*/)
|
||||
});
|
||||
for (FCurve *fcurve : fcurves_to_delete) {
|
||||
action_fcurve_remove(action, *fcurve);
|
||||
DEG_id_tag_update(&ob->id, ID_RECALC_TRANSFORM);
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -768,7 +770,7 @@ static wmOperatorStatus clear_anim_v3d_exec(bContext *C, wmOperator * /*op*/)
|
||||
}
|
||||
|
||||
/* Delete the action itself if it is empty. */
|
||||
if (blender::animrig::animdata_remove_empty_action(adt)) {
|
||||
if (action.is_action_legacy() && blender::animrig::animdata_remove_empty_action(adt)) {
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user