Fix sequencer modifier operators crashing with no active strip set

This commit is contained in:
Campbell Barton
2023-12-06 10:06:40 +11:00
parent 27992034f2
commit 8b26ad0a8a
3 changed files with 16 additions and 18 deletions

View File

@@ -202,6 +202,16 @@ bool sequencer_strip_poll(bContext *C)
}
#endif
bool sequencer_strip_editable_poll(bContext *C)
{
Scene *scene = CTX_data_scene(C);
if (ID_IS_LINKED(&scene->id)) {
return false;
}
Editing *ed = SEQ_editing_get(scene);
return (ed && (ed->act_seq != nullptr));
}
bool sequencer_strip_has_path_poll(bContext *C)
{
Editing *ed;

View File

@@ -142,6 +142,7 @@ bool sequencer_edit_with_channel_region_poll(bContext *C);
bool sequencer_editing_initialized_and_active(bContext *C);
/* UNUSED */
// bool sequencer_strip_poll( bContext *C);
bool sequencer_strip_editable_poll(bContext *C);
bool sequencer_strip_has_path_poll(bContext *C);
bool sequencer_view_has_preview_poll(bContext *C);
bool sequencer_view_preview_only_poll(const bContext *C);

View File

@@ -79,10 +79,7 @@ void SEQUENCER_OT_strip_modifier_add(wmOperatorType *ot)
/* api callbacks */
ot->exec = strip_modifier_add_exec;
/*
* No poll because a modifier can be applied to any kind of strip
*/
ot->poll = sequencer_strip_editable_poll;
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
@@ -138,9 +135,7 @@ void SEQUENCER_OT_strip_modifier_remove(wmOperatorType *ot)
/* api callbacks */
ot->exec = strip_modifier_remove_exec;
/*
* No poll is needed because all kind of strips can have their modifiers erased
*/
ot->poll = sequencer_strip_editable_poll;
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
@@ -219,10 +214,7 @@ void SEQUENCER_OT_strip_modifier_move(wmOperatorType *ot)
/* api callbacks */
ot->exec = strip_modifier_move_exec;
/*
* No poll is needed because all strips can have modifiers
*/
ot->poll = sequencer_strip_editable_poll;
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
@@ -321,9 +313,7 @@ void SEQUENCER_OT_strip_modifier_copy(wmOperatorType *ot)
/* api callbacks */
ot->invoke = WM_menu_invoke;
ot->exec = strip_modifier_copy_exec;
/*
* No poll is needed because all kind of strips can have modifier
*/
ot->poll = sequencer_strip_editable_poll;
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
@@ -378,10 +368,7 @@ void SEQUENCER_OT_strip_modifier_equalizer_redefine(wmOperatorType *ot)
/* api callbacks */
ot->exec = strip_modifier_equalizer_redefine_exec;
/*
* No poll because a modifier can be applied to any kind of strip
*/
ot->poll = sequencer_strip_editable_poll;
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;