[Bf-blender-cvs] [1f5ae1a5a50] master: UI: Move all Selected Strips and Strip Handles when Dragging

Julian Eisel noreply at git.blender.org
Fri Oct 4 16:52:24 CEST 2019


Commit: 1f5ae1a5a505ad5aba8bcae794ca0c4e9dd2d684
Author: Julian Eisel
Date:   Fri Oct 4 15:23:03 2019 +0200
Branches: master
https://developer.blender.org/rB1f5ae1a5a505ad5aba8bcae794ca0c4e9dd2d684

UI: Move all Selected Strips and Strip Handles when Dragging

Part of T57918. Selecting and dragging items were previously conflicting
actions when both were using the same mouse button. This avoids the
conflict.

See 056fcdfe7bbed3 for details on behavior.

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

M	source/blender/editors/space_sequencer/sequencer_select.c

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

diff --git a/source/blender/editors/space_sequencer/sequencer_select.c b/source/blender/editors/space_sequencer/sequencer_select.c
index affb6d3fd88..4c20fc1707a 100644
--- a/source/blender/editors/space_sequencer/sequencer_select.c
+++ b/source/blender/editors/space_sequencer/sequencer_select.c
@@ -319,7 +319,7 @@ void SEQUENCER_OT_select_inverse(struct wmOperatorType *ot)
   ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 }
 
-static int sequencer_select_invoke(bContext *C, wmOperator *op, const wmEvent *event)
+static int sequencer_select_exec(bContext *C, wmOperator *op)
 {
   View2D *v2d = UI_view2d_fromcontext(C);
   Scene *scene = CTX_data_scene(C);
@@ -328,7 +328,13 @@ static int sequencer_select_invoke(bContext *C, wmOperator *op, const wmEvent *e
   const bool deselect_all = RNA_boolean_get(op->ptr, "deselect_all");
   const bool linked_handle = RNA_boolean_get(op->ptr, "linked_handle");
   const bool linked_time = RNA_boolean_get(op->ptr, "linked_time");
+  bool wait_to_deselect_others = RNA_boolean_get(op->ptr, "wait_to_deselect_others");
   int left_right = RNA_enum_get(op->ptr, "left_right");
+  int mval[2];
+  int ret_value = OPERATOR_CANCELLED;
+
+  mval[0] = RNA_int_get(op->ptr, "mouse_x");
+  mval[1] = RNA_int_get(op->ptr, "mouse_y");
 
   Sequence *seq, *neighbor, *act_orig;
   int hand, sel_side;
@@ -338,9 +344,13 @@ static int sequencer_select_invoke(bContext *C, wmOperator *op, const wmEvent *e
     return OPERATOR_CANCELLED;
   }
 
+  if (extend) {
+    wait_to_deselect_others = false;
+  }
+
   marker = find_nearest_marker(SCE_MARKERS, 1);  // XXX - dummy function for now
 
-  seq = find_nearest_seq(scene, v2d, &hand, event->mval);
+  seq = find_nearest_seq(scene, v2d, &hand, mval);
 
   // XXX - not nice, Ctrl+RMB needs to do left_right only when not over a strip
   if (seq && linked_time && (left_right == SEQ_SELECT_LR_MOUSE)) {
@@ -364,6 +374,8 @@ static int sequencer_select_invoke(bContext *C, wmOperator *op, const wmEvent *e
       /* deselect_markers(0, 0); */
       marker->flag |= SELECT;
     }
+
+    ret_value = OPERATOR_FINISHED;
   }
   else if (left_right != SEQ_SELECT_LR_NONE) {
     /* use different logic for this */
@@ -374,7 +386,7 @@ static int sequencer_select_invoke(bContext *C, wmOperator *op, const wmEvent *e
 
     switch (left_right) {
       case SEQ_SELECT_LR_MOUSE:
-        x = UI_view2d_region_to_view_x(v2d, event->mval[0]);
+        x = UI_view2d_region_to_view_x(v2d, mval[0]);
         break;
       case SEQ_SELECT_LR_LEFT:
         x = CFRA - 1.0f;
@@ -409,13 +421,27 @@ static int sequencer_select_invoke(bContext *C, wmOperator *op, const wmEvent *e
         }
       }
     }
+
+    ret_value = OPERATOR_FINISHED;
   }
   else {
     act_orig = ed->act_seq;
 
     if (seq) {
-      if (!extend && !linked_handle) {
+      /* Are we trying to select a handle that's already selected? */
+      const bool handle_selected = ((hand == SEQ_SIDE_LEFT) && (seq->flag & SEQ_LEFTSEL)) ||
+                                   ((hand == SEQ_SIDE_RIGHT) && (seq->flag & SEQ_RIGHTSEL));
+
+      if (wait_to_deselect_others && (seq->flag & SELECT) &&
+          (hand == SEQ_SIDE_NONE || handle_selected)) {
+        ret_value = OPERATOR_RUNNING_MODAL;
+      }
+      else if (!extend && !linked_handle) {
         ED_sequencer_deselect_all(scene);
+        ret_value = OPERATOR_FINISHED;
+      }
+      else {
+        ret_value = OPERATOR_FINISHED;
       }
 
       BKE_sequencer_active_set(scene, seq);
@@ -509,6 +535,8 @@ static int sequencer_select_invoke(bContext *C, wmOperator *op, const wmEvent *e
             select_active_side(ed->seqbasep, sel_side, seq->machine, seq->startdisp);
           }
         }
+
+        ret_value = OPERATOR_FINISHED;
       }
       else {
         if (extend && (seq->flag & SELECT) && ed->act_seq == act_orig) {
@@ -525,6 +553,7 @@ static int sequencer_select_invoke(bContext *C, wmOperator *op, const wmEvent *e
               seq->flag ^= SEQ_RIGHTSEL;
               break;
           }
+          ret_value = OPERATOR_FINISHED;
         }
         else {
           seq->flag |= SELECT;
@@ -542,9 +571,12 @@ static int sequencer_select_invoke(bContext *C, wmOperator *op, const wmEvent *e
       if (linked_time) {
         select_linked_time(ed->seqbasep, seq);
       }
+
+      BLI_assert((ret_value & OPERATOR_CANCELLED) == 0);
     }
     else if (deselect_all) {
       ED_sequencer_deselect_all(scene);
+      ret_value = OPERATOR_FINISHED;
     }
   }
 
@@ -552,8 +584,7 @@ static int sequencer_select_invoke(bContext *C, wmOperator *op, const wmEvent *e
 
   WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER | NA_SELECTED, scene);
 
-  /* allowing tweaks */
-  return OPERATOR_FINISHED | OPERATOR_PASS_THROUGH;
+  return ret_value;
 }
 
 void SEQUENCER_OT_select(wmOperatorType *ot)
@@ -565,6 +596,7 @@ void SEQUENCER_OT_select(wmOperatorType *ot)
       {SEQ_SELECT_LR_RIGHT, "RIGHT", 0, "Right", "Select right"},
       {0, NULL, 0, NULL, NULL},
   };
+  PropertyRNA *prop;
 
   /* identifiers */
   ot->name = "Select";
@@ -572,14 +604,16 @@ void SEQUENCER_OT_select(wmOperatorType *ot)
   ot->description = "Select a strip (last selected becomes the \"active strip\")";
 
   /* api callbacks */
-  ot->invoke = sequencer_select_invoke;
+  ot->exec = sequencer_select_exec;
+  ot->invoke = WM_generic_select_invoke;
+  ot->modal = WM_generic_select_modal;
   ot->poll = ED_operator_sequencer_active;
 
   /* flags */
   ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 
   /* properties */
-  PropertyRNA *prop;
+  WM_operator_properties_generic_select(ot);
   RNA_def_boolean(ot->srna, "extend", 0, "Extend", "Extend the selection");
   prop = RNA_def_boolean(ot->srna,
                          "deselect_all",



More information about the Bf-blender-cvs mailing list