Commit: ece755ffe6a228db40d1cd4073df29b6c0f03519
Author: Campbell Barton
Date:   Wed Feb 26 13:21:48 2014 +1100
https://developer.blender.org/rBece755ffe6a228db40d1cd4073df29b6c0f03519

Fix for sequencer add operators showing up in spacebar search.

===================================================================

M       source/blender/editors/include/ED_screen.h
M       source/blender/editors/screen/screen_ops.c
M       source/blender/editors/space_sequencer/sequencer_add.c

===================================================================

diff --git a/source/blender/editors/include/ED_screen.h 
b/source/blender/editors/include/ED_screen.h
index b432e61..5e20734 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 799db37..aa5d9ef 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 156df05..e816494 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;

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to