[Bf-blender-cvs] [e4ed727f43d] soc-2019-outliner: Synced Selection: Sync active objects between outliner and view layer

Nathan Craddock noreply at git.blender.org
Wed Jun 26 23:06:47 CEST 2019


Commit: e4ed727f43d506e266767578ab64b18f0795a91d
Author: Nathan Craddock
Date:   Wed Jun 26 14:53:12 2019 -0600
Branches: soc-2019-outliner
https://developer.blender.org/rBe4ed727f43d506e266767578ab64b18f0795a91d

Synced Selection: Sync active objects between outliner and view layer

This adds the syncing of active elements. When synced selection is off
and elements are selected, no activation or selection will occur.
When synced selection is enabled, active bases will be synced
in both directions between outliner and view layer.

Currently some issues still exist, like selecting a collection
will mark it active.

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

M	source/blender/editors/space_outliner/outliner_draw.c
M	source/blender/editors/space_outliner/outliner_select.c

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

diff --git a/source/blender/editors/space_outliner/outliner_draw.c b/source/blender/editors/space_outliner/outliner_draw.c
index 793dac1d281..a9c8f421a18 100644
--- a/source/blender/editors/space_outliner/outliner_draw.c
+++ b/source/blender/editors/space_outliner/outliner_draw.c
@@ -3572,9 +3572,11 @@ void outliner_sync_selection_to_view_layer(bContext *C, ListBase *tree)
                                         BKE_view_layer_base_find(view_layer, ob);
 
         if (base) {
-          const bool is_selected = ((tselem->flag & TSE_SELECTED) != 0);
+          if (tselem->flag & TSE_ACTIVE) {
+            ED_object_base_activate(C, base);
+          }
 
-          if (is_selected) {
+          if (tselem->flag & TSE_SELECTED) {
             ED_object_base_select(base, BA_SELECT);
           }
           else {
@@ -3596,13 +3598,21 @@ static void outliner_sync_selection_from_view_layer(ViewLayer *view_layer, ListB
 {
   for (TreeElement *te = tree->first; te; te = te->next) {
     TreeStoreElem *tselem = TREESTORE(te);
+
+    tselem->flag &= ~TSE_ACTIVE;
+
     if (tselem->type == 0) {
       if (te->idcode == ID_OB) {
         Object *ob = (Object *)tselem->id;
+        Object *obact = OBACT(view_layer);
         Base *base = (te->directdata) ? (Base *)te->directdata :
                                         BKE_view_layer_base_find(view_layer, ob);
         const bool is_selected = (base != NULL) && ((base->flag & BASE_SELECTED) != 0);
 
+        if (base && (ob == obact)) {
+          tselem->flag |= TSE_ACTIVE;
+        }
+
         if (is_selected) {
           tselem->flag |= TSE_SELECTED;
         }
@@ -3659,6 +3669,9 @@ void draw_outliner(const bContext *C)
   if (soops->flag & SO_SYNC_SELECTION) {
     outliner_sync_selection(C, soops);
   }
+  else {
+    soops->flag |= SO_IS_DIRTY;
+  }
 
   /* force display to pixel coords */
   v2d->flag |= (V2D_PIXELOFS_X | V2D_PIXELOFS_Y);
diff --git a/source/blender/editors/space_outliner/outliner_select.c b/source/blender/editors/space_outliner/outliner_select.c
index 570bca6a7d6..7a16f416efa 100644
--- a/source/blender/editors/space_outliner/outliner_select.c
+++ b/source/blender/editors/space_outliner/outliner_select.c
@@ -1152,7 +1152,7 @@ static void do_outliner_item_activate_tree_element(bContext *C,
   else if (tselem->type == TSE_POSE_BASE) {
     /* Support pose mode toggle, keeping the active object as is. */
   }
-  else {
+  else if (soops->flag & SO_SYNC_SELECTION) {
     tree_element_set_active_object(C,
                                    scene,
                                    view_layer,



More information about the Bf-blender-cvs mailing list