[Bf-blender-cvs] [cebafc9854f] soc-2020-outliner: Outliner: Remove outliner parent object selection

Nathan Craddock noreply at git.blender.org
Fri Jul 24 05:43:03 CEST 2020


Commit: cebafc9854f61b3776524ea9d7586b03afc8af2f
Author: Nathan Craddock
Date:   Thu Jul 23 21:33:23 2020 -0600
Branches: soc-2020-outliner
https://developer.blender.org/rBcebafc9854f61b3776524ea9d7586b03afc8af2f

Outliner: Remove outliner parent object selection

In order to fix T74332 it was necessary to flag parent elements as
selected in the outliner to prevent the bases from being deselected on
the selection sync. This ensures the parent object is selected for
editing drivers, etc.

An annoying issue that results from this is the context menu shows
Object entries even when the target is a data (material, action, bone)
type. This also causes issues with drag and drop and other operations.

This adds a new TSE flag to prevent a selection sync on a per-element
case. This is used to prevent a parent element sync which ensures the
parent object stays selected, but it does not draw as selected in the
outliner.

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

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 2de96fcbc97..15411f26f3d 100644
--- a/source/blender/editors/space_outliner/outliner_select.c
+++ b/source/blender/editors/space_outliner/outliner_select.c
@@ -418,15 +418,9 @@ 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 {
@@ -442,9 +436,12 @@ 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 (parent_tselem) {
-        parent_tselem->flag |= TSE_SELECTED;
-      }
+    }
+
+    /* 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 (recursive) {
diff --git a/source/blender/editors/space_outliner/outliner_sync.c b/source/blender/editors/space_outliner/outliner_sync.c
index a4be4062746..a2e45a9b76f 100644
--- a/source/blender/editors/space_outliner/outliner_sync.c
+++ b/source/blender/editors/space_outliner/outliner_sync.c
@@ -322,6 +322,14 @@ 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);
@@ -342,9 +350,6 @@ 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 490abbf9381..4e85c9b70e2 100644
--- a/source/blender/makesdna/DNA_outliner_types.h
+++ b/source/blender/makesdna/DNA_outliner_types.h
@@ -64,6 +64,8 @@ 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 */



More information about the Bf-blender-cvs mailing list