[Bf-blender-cvs] [9605cebdd23] soc-2019-outliner: Outliner: Sync selection from sequencer

Nathan Craddock noreply at git.blender.org
Tue Jul 2 04:50:22 CEST 2019


Commit: 9605cebdd238c653a7c2c151fcde0116bbfd35bd
Author: Nathan Craddock
Date:   Mon Jul 1 20:49:39 2019 -0600
Branches: soc-2019-outliner
https://developer.blender.org/rB9605cebdd238c653a7c2c151fcde0116bbfd35bd

Outliner: Sync selection from sequencer

Sequencer selection operators now sync to outliners. Still needs
to sync the other direction

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

M	source/blender/editors/space_outliner/outliner_intern.h
M	source/blender/editors/space_outliner/outliner_sync.c
M	source/blender/editors/space_sequencer/sequencer_select.c

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

diff --git a/source/blender/editors/space_outliner/outliner_intern.h b/source/blender/editors/space_outliner/outliner_intern.h
index 818424cc13f..424f96d9bd3 100644
--- a/source/blender/editors/space_outliner/outliner_intern.h
+++ b/source/blender/editors/space_outliner/outliner_intern.h
@@ -470,10 +470,7 @@ bool outliner_is_element_visible(const TreeElement *te);
 
 /* outliner_sync.c ---------------------------------------------- */
 
-void outliners_mark_dirty(const struct bContext *C);
 void outliner_select_sync(struct bContext *C, struct SpaceOutliner *soops);
 void outliner_sync_selection(const struct bContext *C, struct SpaceOutliner *soops);
-void outliner_sync_selection_from_view_layer(struct ViewLayer *view_layer, struct ListBase *tree);
-void outliner_sync_selection_to_view_layer(struct bContext *C, struct ListBase *tree);
 
 #endif /* __OUTLINER_INTERN_H__ */
diff --git a/source/blender/editors/space_outliner/outliner_sync.c b/source/blender/editors/space_outliner/outliner_sync.c
index 09e3ac06e06..83f5b5e473f 100644
--- a/source/blender/editors/space_outliner/outliner_sync.c
+++ b/source/blender/editors/space_outliner/outliner_sync.c
@@ -26,6 +26,7 @@
 #include "DNA_layer_types.h"
 #include "DNA_outliner_types.h"
 #include "DNA_screen_types.h"
+#include "DNA_sequence_types.h"
 #include "DNA_space_types.h"
 
 #include "BKE_context.h"
@@ -45,19 +46,7 @@
 /* Default value for sync selection state */
 short sync_select_dirty_flag = SYNC_SELECT_NONE;
 
-/* Set clean outliner and mark other outliners for syncing */
-void outliner_select_sync(bContext *C, SpaceOutliner *soops)
-{
-  puts("Outliner select... Mark other outliners as dirty for syncing");
-  outliner_sync_selection_to_view_layer(C, &soops->tree);
-  sync_select_dirty_flag = SYNC_SELECT_NONE;
-
-  /* Don't need to mark self as dirty here... */
-  outliners_mark_dirty(C);
-  soops->flag &= ~SO_IS_DIRTY;
-}
-
-void outliners_mark_dirty(const bContext *C)
+static void outliners_mark_dirty(const bContext *C)
 {
   Main *bmain = CTX_data_main(C);
   for (bScreen *screen = bmain->screens.first; screen; screen = screen->id.next) {
@@ -75,7 +64,7 @@ void outliners_mark_dirty(const bContext *C)
 }
 
 /* Sync selection flags to active view layer */
-void outliner_sync_selection_to_view_layer(bContext *C, ListBase *tree)
+static void outliner_sync_selection_to_view_layer(bContext *C, ListBase *tree)
 {
   Scene *scene = CTX_data_scene(C);
   ViewLayer *view_layer = CTX_data_view_layer(C);
@@ -111,7 +100,7 @@ void outliner_sync_selection_to_view_layer(bContext *C, ListBase *tree)
 }
 
 /* Sync selection flags from active view layer */
-void outliner_sync_selection_from_view_layer(ViewLayer *view_layer, ListBase *tree)
+static void outliner_sync_selection_from_view_layer(ViewLayer *view_layer, ListBase *tree)
 {
   for (TreeElement *te = tree->first; te; te = te->next) {
     TreeStoreElem *tselem = TREESTORE(te);
@@ -143,6 +132,42 @@ void outliner_sync_selection_from_view_layer(ViewLayer *view_layer, ListBase *tr
   }
 }
 
+static void outliner_sync_selection_from_sequencer(ListBase *tree)
+{
+  for (TreeElement *te = tree->first; te; te = te->next) {
+    TreeStoreElem *tselem = TREESTORE(te);
+
+    tselem->flag &= ~TSE_ACTIVE;
+
+    if (tselem->type == TSE_SEQUENCE) {
+      printf("\t\tSyncing a sequence: %s\n", te->name);
+
+      Sequence *seq = (Sequence *)tselem->id;
+
+      if (seq->flag & SELECT) {
+        tselem->flag |= TSE_SELECTED;
+      }
+      else {
+        tselem->flag &= ~TSE_SELECTED;
+      }
+    }
+
+    outliner_sync_selection_from_sequencer(&te->subtree);
+  }
+}
+
+/* Set clean outliner and mark other outliners for syncing */
+void outliner_select_sync(bContext *C, SpaceOutliner *soops)
+{
+  puts("Outliner select... Mark other outliners as dirty for syncing");
+  outliner_sync_selection_to_view_layer(C, &soops->tree);
+  sync_select_dirty_flag = SYNC_SELECT_NONE;
+
+  /* Don't need to mark self as dirty here... */
+  outliners_mark_dirty(C);
+  soops->flag &= ~SO_IS_DIRTY;
+}
+
 void outliner_sync_selection(const bContext *C, SpaceOutliner *soops)
 {
   ViewLayer *view_layer = CTX_data_view_layer(C);
@@ -162,6 +187,9 @@ void outliner_sync_selection(const bContext *C, SpaceOutliner *soops)
 
     outliner_sync_selection_from_view_layer(view_layer, &soops->tree);
 
+    printf("\tSyncing sequences...\n");
+    outliner_sync_selection_from_sequencer(&soops->tree);
+
     soops->flag &= ~SO_IS_DIRTY;
   }
 }
diff --git a/source/blender/editors/space_sequencer/sequencer_select.c b/source/blender/editors/space_sequencer/sequencer_select.c
index 57f86059d9d..3ab9df74ead 100644
--- a/source/blender/editors/space_sequencer/sequencer_select.c
+++ b/source/blender/editors/space_sequencer/sequencer_select.c
@@ -41,6 +41,7 @@
 
 /* for menu/popup icons etc etc*/
 
+#include "ED_outliner.h"
 #include "ED_screen.h"
 #include "ED_sequencer.h"
 #include "ED_select_utils.h"
@@ -49,6 +50,12 @@
 
 /* own include */
 #include "sequencer_intern.h"
+
+static void sequencer_sync_selection()
+{
+  sync_select_dirty_flag = SYNC_SELECT_REPLACE;
+}
+
 static void *find_nearest_marker(int UNUSED(d1), int UNUSED(d2))
 {
   return NULL;
@@ -254,6 +261,8 @@ static int sequencer_de_select_all_exec(bContext *C, wmOperator *op)
     }
   }
 
+  sequencer_sync_selection();
+
   WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER | NA_SELECTED, scene);
 
   return OPERATOR_FINISHED;
@@ -293,6 +302,8 @@ static int sequencer_select_inverse_exec(bContext *C, wmOperator *UNUSED(op))
     }
   }
 
+  sequencer_sync_selection();
+
   WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER | NA_SELECTED, scene);
 
   return OPERATOR_FINISHED;
@@ -542,6 +553,8 @@ static int sequencer_select_invoke(bContext *C, wmOperator *op, const wmEvent *e
     }
   }
 
+  sequencer_sync_selection();
+
   WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER | NA_SELECTED, scene);
 
   /* allowing tweaks */
@@ -668,6 +681,8 @@ static int sequencer_select_more_exec(bContext *C, wmOperator *UNUSED(op))
     return OPERATOR_CANCELLED;
   }
 
+  sequencer_sync_selection();
+
   WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER | NA_SELECTED, scene);
 
   return OPERATOR_FINISHED;
@@ -699,6 +714,8 @@ static int sequencer_select_less_exec(bContext *C, wmOperator *UNUSED(op))
     return OPERATOR_CANCELLED;
   }
 
+  sequencer_sync_selection();
+
   WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER | NA_SELECTED, scene);
 
   return OPERATOR_FINISHED;
@@ -750,6 +767,8 @@ static int sequencer_select_linked_pick_invoke(bContext *C, wmOperator *op, cons
     selected = select_more_less_seq__internal(scene, 1, 1);
   }
 
+  sequencer_sync_selection();
+
   WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER | NA_SELECTED, scene);
 
   return OPERATOR_FINISHED;
@@ -784,6 +803,8 @@ static int sequencer_select_linked_exec(bContext *C, wmOperator *UNUSED(op))
     selected = select_more_less_seq__internal(scene, true, true);
   }
 
+  sequencer_sync_selection();
+
   WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER | NA_SELECTED, scene);
 
   return OPERATOR_FINISHED;
@@ -832,6 +853,8 @@ static int sequencer_select_handles_exec(bContext *C, wmOperator *op)
     }
   }
 
+  sequencer_sync_selection();
+
   WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER | NA_SELECTED, scene);
 
   return OPERATOR_FINISHED;
@@ -876,6 +899,8 @@ static int sequencer_select_active_side_exec(bContext *C, wmOperator *op)
   select_active_side(
       ed->seqbasep, RNA_enum_get(op->ptr, "side"), seq_act->machine, seq_act->startdisp);
 
+  sequencer_sync_selection();
+
   WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER | NA_SELECTED, scene);
 
   return OPERATOR_FINISHED;
@@ -934,6 +959,8 @@ static int sequencer_box_select_exec(bContext *C, wmOperator *op)
     }
   }
 
+  sequencer_sync_selection();
+
   WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER | NA_SELECTED, scene);
 
   return OPERATOR_FINISHED;
@@ -1311,6 +1338,7 @@ static int sequencer_select_grouped_exec(bContext *C, wmOperator *op)
   }
 
   if (changed) {
+    sequencer_sync_selection();
     WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER | NA_SELECTED, scene);
     return OPERATOR_FINISHED;
   }



More information about the Bf-blender-cvs mailing list