diff options
author | Campbell Barton <ideasman42@gmail.com> | 2014-02-26 06:21:48 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2014-02-26 06:30:25 +0400 |
commit | ece755ffe6a228db40d1cd4073df29b6c0f03519 (patch) | |
tree | d4e8cfba7e92d4bb5724599981d12ddc0fdd7872 /source/blender/editors | |
parent | 497e1de25b35b453c0f93bade783fd15d19bde9b (diff) |
Fix for sequencer add operators showing up in spacebar search.
Diffstat (limited to 'source/blender/editors')
-rw-r--r-- | source/blender/editors/include/ED_screen.h | 1 | ||||
-rw-r--r-- | source/blender/editors/screen/screen_ops.c | 5 | ||||
-rw-r--r-- | source/blender/editors/space_sequencer/sequencer_add.c | 53 |
3 files changed, 13 insertions, 46 deletions
diff --git a/source/blender/editors/include/ED_screen.h b/source/blender/editors/include/ED_screen.h index b432e611c56..5e20734461b 100644 --- a/source/blender/editors/include/ED_screen.h +++ b/source/blender/editors/include/ED_screen.h @@ -144,6 +144,7 @@ int ED_operator_node_active(struct bContext *C); int ED_operator_node_editable(struct bContext *C); int ED_operator_graphedit_active(struct bContext *C); int ED_operator_sequencer_active(struct bContext *C); +int ED_operator_sequencer_active_editable(struct bContext *C); int ED_operator_image_active(struct bContext *C); int ED_operator_nla_active(struct bContext *C); int ED_operator_logic_active(struct bContext *C); diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c index 799db37a51e..aa5d9ef3bbb 100644 --- a/source/blender/editors/screen/screen_ops.c +++ b/source/blender/editors/screen/screen_ops.c @@ -281,6 +281,11 @@ int ED_operator_sequencer_active(bContext *C) return ed_spacetype_test(C, SPACE_SEQ); } +int ED_operator_sequencer_active_editable(bContext *C) +{ + return ed_spacetype_test(C, SPACE_SEQ) && ED_operator_scene_editable(C); +} + int ED_operator_image_active(bContext *C) { return ed_spacetype_test(C, SPACE_IMAGE); diff --git a/source/blender/editors/space_sequencer/sequencer_add.c b/source/blender/editors/space_sequencer/sequencer_add.c index 156df05c03d..e816494faaf 100644 --- a/source/blender/editors/space_sequencer/sequencer_add.c +++ b/source/blender/editors/space_sequencer/sequencer_add.c @@ -296,11 +296,6 @@ static int sequencer_add_scene_strip_exec(bContext *C, wmOperator *op) static int sequencer_add_scene_strip_invoke(bContext *C, wmOperator *op, const wmEvent *event) { - if (!ED_operator_sequencer_active(C)) { - BKE_report(op->reports, RPT_ERROR, "Sequencer area not active"); - return OPERATOR_CANCELLED; - } - if (!RNA_struct_property_is_set(op->ptr, "scene")) return WM_enum_search_invoke(C, op, event); @@ -324,7 +319,7 @@ void SEQUENCER_OT_scene_strip_add(struct wmOperatorType *ot) ot->invoke = sequencer_add_scene_strip_invoke; ot->exec = sequencer_add_scene_strip_exec; - ot->poll = ED_operator_scene_editable; + ot->poll = ED_operator_sequencer_active_editable; /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; @@ -394,11 +389,6 @@ static int sequencer_add_movieclip_strip_exec(bContext *C, wmOperator *op) static int sequencer_add_movieclip_strip_invoke(bContext *C, wmOperator *op, const wmEvent *event) { - if (!ED_operator_sequencer_active(C)) { - BKE_report(op->reports, RPT_ERROR, "Sequencer area not active"); - return OPERATOR_CANCELLED; - } - if (!RNA_struct_property_is_set(op->ptr, "clip")) return WM_enum_search_invoke(C, op, event); @@ -421,7 +411,7 @@ void SEQUENCER_OT_movieclip_strip_add(struct wmOperatorType *ot) ot->invoke = sequencer_add_movieclip_strip_invoke; ot->exec = sequencer_add_movieclip_strip_exec; - ot->poll = ED_operator_scene_editable; + ot->poll = ED_operator_sequencer_active_editable; /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; @@ -491,11 +481,6 @@ static int sequencer_add_mask_strip_exec(bContext *C, wmOperator *op) static int sequencer_add_mask_strip_invoke(bContext *C, wmOperator *op, const wmEvent *event) { - if (!ED_operator_sequencer_active(C)) { - BKE_report(op->reports, RPT_ERROR, "Sequencer area not active"); - return OPERATOR_CANCELLED; - } - if (!RNA_struct_property_is_set(op->ptr, "mask")) return WM_enum_search_invoke(C, op, event); @@ -519,7 +504,7 @@ void SEQUENCER_OT_mask_strip_add(struct wmOperatorType *ot) ot->invoke = sequencer_add_mask_strip_invoke; ot->exec = sequencer_add_mask_strip_exec; - ot->poll = ED_operator_scene_editable; + ot->poll = ED_operator_sequencer_active_editable; /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; @@ -608,12 +593,6 @@ static int sequencer_add_movie_strip_exec(bContext *C, wmOperator *op) static int sequencer_add_movie_strip_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event)) { - - if (!ED_operator_sequencer_active(C)) { - BKE_report(op->reports, RPT_ERROR, "Sequencer area not active"); - return OPERATOR_CANCELLED; - } - /* This is for drag and drop */ if ((RNA_struct_property_is_set(op->ptr, "files") && RNA_collection_length(op->ptr, "files")) || RNA_struct_property_is_set(op->ptr, "filepath")) @@ -643,7 +622,7 @@ void SEQUENCER_OT_movie_strip_add(struct wmOperatorType *ot) ot->invoke = sequencer_add_movie_strip_invoke; ot->exec = sequencer_add_movie_strip_exec; - ot->poll = ED_operator_scene_editable; + ot->poll = ED_operator_sequencer_active_editable; /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; @@ -663,12 +642,6 @@ static int sequencer_add_sound_strip_exec(bContext *C, wmOperator *op) static int sequencer_add_sound_strip_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event)) { - - if (!ED_operator_sequencer_active(C)) { - BKE_report(op->reports, RPT_ERROR, "Sequencer area not active"); - return OPERATOR_CANCELLED; - } - /* This is for drag and drop */ if ((RNA_struct_property_is_set(op->ptr, "files") && RNA_collection_length(op->ptr, "files")) || RNA_struct_property_is_set(op->ptr, "filepath")) @@ -698,7 +671,7 @@ void SEQUENCER_OT_sound_strip_add(struct wmOperatorType *ot) ot->invoke = sequencer_add_sound_strip_invoke; ot->exec = sequencer_add_sound_strip_exec; - ot->poll = ED_operator_scene_editable; + ot->poll = ED_operator_sequencer_active_editable; /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; @@ -775,13 +748,6 @@ static int sequencer_add_image_strip_exec(bContext *C, wmOperator *op) static int sequencer_add_image_strip_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event)) { - - if (!ED_operator_sequencer_active(C)) { - BKE_report(op->reports, RPT_ERROR, "Sequencer area not active"); - return OPERATOR_CANCELLED; - } - - /* drag drop has set the names */ if (RNA_struct_property_is_set(op->ptr, "files") && RNA_collection_length(op->ptr, "files")) { sequencer_generic_invoke_xy__internal(C, op, SEQPROP_ENDFRAME | SEQPROP_NOPATHS, SEQ_TYPE_IMAGE); @@ -807,7 +773,7 @@ void SEQUENCER_OT_image_strip_add(struct wmOperatorType *ot) ot->invoke = sequencer_add_image_strip_invoke; ot->exec = sequencer_add_image_strip_exec; - ot->poll = ED_operator_scene_editable; + ot->poll = ED_operator_sequencer_active_editable; /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; @@ -931,11 +897,6 @@ static int sequencer_add_effect_strip_invoke(bContext *C, wmOperator *op, const int type = -1; int prop_flag = SEQPROP_ENDFRAME; - if (!ED_operator_sequencer_active(C)) { - BKE_report(op->reports, RPT_ERROR, "Sequencer area not active"); - return OPERATOR_CANCELLED; - } - if (is_type_set) { type = RNA_enum_get(op->ptr, "type"); @@ -964,7 +925,7 @@ void SEQUENCER_OT_effect_strip_add(struct wmOperatorType *ot) ot->invoke = sequencer_add_effect_strip_invoke; ot->exec = sequencer_add_effect_strip_exec; - ot->poll = ED_operator_scene_editable; + ot->poll = ED_operator_sequencer_active_editable; /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; |