Refactor: Anim, simplify action_pushdown_poll()
Simplify `action_pushdown_poll()` by flipping conditions & returning early. No functional changes.
This commit is contained in:
@@ -300,23 +300,21 @@ void ACTION_OT_new(wmOperatorType *ot)
|
||||
|
||||
static bool action_pushdown_poll(bContext *C)
|
||||
{
|
||||
if (ED_operator_action_active(C)) {
|
||||
SpaceAction *saction = (SpaceAction *)CTX_wm_space_data(C);
|
||||
AnimData *adt = ED_actedit_animdata_from_context(C, nullptr);
|
||||
|
||||
/* Check for AnimData, Actions, and that tweak-mode is off. */
|
||||
if (adt && saction->action) {
|
||||
/* NOTE: We check this for the AnimData block in question and not the global flag,
|
||||
* as the global flag may be left dirty by some of the browsing ops here.
|
||||
*/
|
||||
if (!(adt->flag & ADT_NLA_EDIT_ON)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (!ED_operator_action_active(C)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/* something failed... */
|
||||
return false;
|
||||
SpaceAction *saction = (SpaceAction *)CTX_wm_space_data(C);
|
||||
AnimData *adt = ED_actedit_animdata_from_context(C, nullptr);
|
||||
|
||||
if (!adt || !saction->action) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/* NOTE: We check this for the AnimData block in question and not the global flag,
|
||||
* as the global flag may be left dirty by some of the browsing ops here.
|
||||
*/
|
||||
return (adt->flag & ADT_NLA_EDIT_ON) == 0;
|
||||
}
|
||||
|
||||
static int action_pushdown_exec(bContext *C, wmOperator *op)
|
||||
|
||||
Reference in New Issue
Block a user