[Bf-blender-cvs] [b52b5e15af6] blender-v2.83-release: Outliner: Fix selection extend not toggling

Nathan Craddock noreply at git.blender.org
Fri May 1 21:06:43 CEST 2020


Commit: b52b5e15af682b64aeb11f4c3fc967b837590a8e
Author: Nathan Craddock
Date:   Fri May 1 12:52:32 2020 -0600
Branches: blender-v2.83-release
https://developer.blender.org/rBb52b5e15af682b64aeb11f4c3fc967b837590a8e

Outliner: Fix selection extend not toggling

An unintentional side-effect of rBfe7528ee919b was that when
extend-selecting a selected element in the outliner, it would be
deselected and activated rather than selected and activated.

This commit restores the expected toggling behavior. Consistent behavior
for extend-selecting child datablocks is not resolvable without a much
larger cleanup of the outliner select functions.

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

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

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

diff --git a/source/blender/editors/space_outliner/outliner_select.c b/source/blender/editors/space_outliner/outliner_select.c
index e87e71f0689..fa8422573ab 100644
--- a/source/blender/editors/space_outliner/outliner_select.c
+++ b/source/blender/editors/space_outliner/outliner_select.c
@@ -357,20 +357,24 @@ static eOLDrawState tree_element_set_active_object(bContext *C,
   }
 
   te_ob = outliner_find_id(soops, &soops->tree, (ID *)ob);
-  if (te_ob != NULL) {
+  if (te_ob != NULL && te_ob != te) {
     parent_tselem = TREESTORE(te_ob);
   }
 
-  if (!ELEM(NULL, parent_tselem, base)) {
+  if (base) {
     if (set == OL_SETSEL_EXTEND) {
       /* swap select */
       if (base->flag & BASE_SELECTED) {
         ED_object_base_select(base, BA_DESELECT);
-        parent_tselem->flag &= ~TSE_SELECTED;
+        if (parent_tselem) {
+          parent_tselem->flag &= ~TSE_SELECTED;
+        }
       }
       else {
         ED_object_base_select(base, BA_SELECT);
-        parent_tselem->flag |= TSE_SELECTED;
+        if (parent_tselem) {
+          parent_tselem->flag |= TSE_SELECTED;
+        }
       }
     }
     else {
@@ -386,7 +390,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);
-      parent_tselem->flag |= TSE_SELECTED;
+      if (parent_tselem) {
+        parent_tselem->flag |= TSE_SELECTED;
+      }
     }
 
     if (recursive) {



More information about the Bf-blender-cvs mailing list