Commit: be10ffb56daf13abf528a7a88f7244bb20c518ba
Author: Nathan Craddock
Date:   Thu Aug 13 11:40:17 2020 -0600
Branches: soc-2020-outliner
https://developer.blender.org/rBbe10ffb56daf13abf528a7a88f7244bb20c518ba

Revert "Outliner: Remove outliner parent object selection"

This reverts commit cebafc9854f61b3776524ea9d7586b03afc8af2f.

While this solution does work, it's not perfect and occasionally breaks,
leaving the outliner in a half-synced state.

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

M       source/blender/editors/space_outliner/outliner_select.c
M       source/blender/editors/space_outliner/outliner_sync.c
M       source/blender/makesdna/DNA_outliner_types.h

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

diff --git a/source/blender/editors/space_outliner/outliner_select.c 
b/source/blender/editors/space_outliner/outliner_select.c
index 5cd819465c3..4745ecb820a 100644
--- a/source/blender/editors/space_outliner/outliner_select.c
+++ b/source/blender/editors/space_outliner/outliner_select.c
@@ -470,9 +470,15 @@ static eOLDrawState 
tree_element_set_active_object(bContext *C,
       /* swap select */
       if (base->flag & BASE_SELECTED) {
         ED_object_base_select(base, BA_DESELECT);
+        if (parent_tselem) {
+          parent_tselem->flag &= ~TSE_SELECTED;
+        }
       }
       else {
         ED_object_base_select(base, BA_SELECT);
+        if (parent_tselem) {
+          parent_tselem->flag |= TSE_SELECTED;
+        }
       }
     }
     else {
@@ -488,12 +494,9 @@ static eOLDrawState 
tree_element_set_active_object(bContext *C,
         BKE_view_layer_base_deselect_all(view_layer);
       }
       ED_object_base_select(base, BA_SELECT);
-    }
-
-    /* If a parent base has been selected, ensure it is not unselected by the 
selection sync from
-     * the outliner. */
-    if (parent_tselem) {
-      parent_tselem->flag |= TSE_SKIP_SELECT_SYNC;
+      if (parent_tselem) {
+        parent_tselem->flag |= TSE_SELECTED;
+      }
     }
 
     if (recursive) {
diff --git a/source/blender/editors/space_outliner/outliner_sync.c 
b/source/blender/editors/space_outliner/outliner_sync.c
index 1ff84fecafc..3055d15725b 100644
--- a/source/blender/editors/space_outliner/outliner_sync.c
+++ b/source/blender/editors/space_outliner/outliner_sync.c
@@ -324,14 +324,6 @@ static void outliner_sync_selection_from_outliner(Scene 
*scene,
   LISTBASE_FOREACH (TreeElement *, te, tree) {
     TreeStoreElem *tselem = TREESTORE(te);
 
-    outliner_sync_selection_from_outliner(
-        scene, view_layer, &te->subtree, sync_types, selected_items);
-
-    if (tselem->flag & TSE_SKIP_SELECT_SYNC) {
-      tselem->flag &= ~TSE_SKIP_SELECT_SYNC;
-      continue;
-    }
-
     if (tselem->type == 0 && te->idcode == ID_OB) {
       if (sync_types->object) {
         outliner_select_sync_to_object(view_layer, te, tselem, 
selected_items->objects);
@@ -352,6 +344,9 @@ static void outliner_sync_selection_from_outliner(Scene 
*scene,
         outliner_select_sync_to_sequence(scene, tselem);
       }
     }
+
+    outliner_sync_selection_from_outliner(
+        scene, view_layer, &te->subtree, sync_types, selected_items);
   }
 }
 
diff --git a/source/blender/makesdna/DNA_outliner_types.h 
b/source/blender/makesdna/DNA_outliner_types.h
index 346b00735f0..24634412a55 100644
--- a/source/blender/makesdna/DNA_outliner_types.h
+++ b/source/blender/makesdna/DNA_outliner_types.h
@@ -63,8 +63,6 @@ enum {
   TSE_ACTIVE = (1 << 9),
   /* TSE_ACTIVE_WALK = (1 << 10), */ /* Unused */
   TSE_DRAG_ANY = (TSE_DRAG_INTO | TSE_DRAG_BEFORE | TSE_DRAG_AFTER),
-  /* Prevent a selection sync for the element */
-  TSE_SKIP_SELECT_SYNC = (1 << 10),
 };
 
 /* TreeStoreElem->types */

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

Reply via email to