Anim: Allow Stash and Push Down on empty Action
Add support for using the Stash (to NLA) and Push Down operators on empty Actions. In the past years, the NLA has seen stability updates that ensure strips are at least a single frame long, and with that even pushing down an empty Action will create a visible (albeit tiny) NLA strip. There doesn't seem to be a practical reason to disallow this any more. Pull Request: https://projects.blender.org/blender/blender/pulls/136604
This commit is contained in:
@@ -2222,16 +2222,6 @@ void BKE_nla_action_pushdown(const OwnedAnimData owned_adt, const bool is_libove
|
||||
return;
|
||||
}
|
||||
|
||||
/* if the action is empty, we also shouldn't try to add to stack,
|
||||
* as that will cause us grief down the track
|
||||
*/
|
||||
/* TODO: what about modifiers? */
|
||||
animrig::Action &action = adt->action->wrap();
|
||||
if (!action.has_keyframes(adt->slot_handle)) {
|
||||
CLOG_ERROR(&LOG, "action has no data");
|
||||
return;
|
||||
}
|
||||
|
||||
/* Add a new NLA strip to the track, which references the active action + slot. */
|
||||
strip = BKE_nlastack_add_strip(owned_adt, is_liboverride);
|
||||
if (strip == nullptr) {
|
||||
|
||||
@@ -339,7 +339,7 @@ static bool action_pushdown_poll(bContext *C)
|
||||
return (adt->flag & ADT_NLA_EDIT_ON) == 0;
|
||||
}
|
||||
|
||||
static wmOperatorStatus action_pushdown_exec(bContext *C, wmOperator *op)
|
||||
static wmOperatorStatus action_pushdown_exec(bContext *C, wmOperator * /*op*/)
|
||||
{
|
||||
SpaceAction *saction = (SpaceAction *)CTX_wm_space_data(C);
|
||||
ID *adt_id_owner = nullptr;
|
||||
@@ -349,14 +349,6 @@ static wmOperatorStatus action_pushdown_exec(bContext *C, wmOperator *op)
|
||||
if (adt && adt->action) {
|
||||
blender::animrig::Action &action = adt->action->wrap();
|
||||
|
||||
/* Perform the push-down operation
|
||||
* - This will deal with all the AnimData-side user-counts. */
|
||||
if (!action.has_keyframes(adt->slot_handle)) {
|
||||
/* action may not be suitable... */
|
||||
BKE_report(op->reports, RPT_WARNING, "Action must have at least one keyframe or F-Modifier");
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
|
||||
/* action can be safely added */
|
||||
BKE_nla_action_pushdown({*adt_id_owner, *adt}, ID_IS_OVERRIDE_LIBRARY(adt_id_owner));
|
||||
|
||||
@@ -407,13 +399,6 @@ static wmOperatorStatus action_stash_exec(bContext *C, wmOperator *op)
|
||||
|
||||
/* Perform stashing operation */
|
||||
if (adt) {
|
||||
/* don't do anything if this action is empty... */
|
||||
if (!adt->action->wrap().has_keyframes(adt->slot_handle)) {
|
||||
/* action may not be suitable... */
|
||||
BKE_report(op->reports, RPT_WARNING, "Action must have at least one keyframe or F-Modifier");
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
|
||||
/* stash the action */
|
||||
if (BKE_nla_action_stash({*adt_id_owner, *adt}, ID_IS_OVERRIDE_LIBRARY(adt_id_owner))) {
|
||||
/* The stash operation will remove the user already,
|
||||
@@ -516,13 +501,6 @@ static wmOperatorStatus action_stash_create_exec(bContext *C, wmOperator *op)
|
||||
}
|
||||
else if (adt) {
|
||||
/* Perform stashing operation */
|
||||
if (!adt->action->wrap().has_keyframes(adt->slot_handle)) {
|
||||
/* don't do anything if this action is empty... */
|
||||
BKE_report(op->reports, RPT_WARNING, "Action must have at least one keyframe or F-Modifier");
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
|
||||
/* stash the action */
|
||||
if (BKE_nla_action_stash({*adt_id_owner, *adt}, ID_IS_OVERRIDE_LIBRARY(adt_id_owner))) {
|
||||
bAction *new_action = nullptr;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user