[Bf-blender-cvs] [e0bd7e67c12] soc-2019-outliner: Outliner: prevent bone selection when sync select disabled

Nathan Craddock noreply at git.blender.org
Thu Jul 11 21:46:49 CEST 2019


Commit: e0bd7e67c12d46dd178e939899ab0d8674bc9670
Author: Nathan Craddock
Date:   Thu Jul 11 13:46:23 2019 -0600
Branches: soc-2019-outliner
https://developer.blender.org/rBe0bd7e67c12d46dd178e939899ab0d8674bc9670

Outliner: prevent bone selection when sync select disabled

More refinements to the synced selection code

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

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

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

diff --git a/source/blender/editors/space_outliner/outliner_select.c b/source/blender/editors/space_outliner/outliner_select.c
index 27fae072b1f..7258d6f122c 100644
--- a/source/blender/editors/space_outliner/outliner_select.c
+++ b/source/blender/editors/space_outliner/outliner_select.c
@@ -1132,27 +1132,24 @@ static void do_outliner_item_activate_tree_element(bContext *C,
   TreeElement *te_active = outliner_find_element_with_flag(&soops->tree, TSE_ACTIVE);
   Object *obact = OBACT(view_layer);
 
-  if (tselem->id && OB_DATA_SUPPORT_EDITMODE(te->idcode)) {
+  /* Always makes active object, except for some specific types. */
+  if (ELEM(tselem->type,
+           TSE_SEQUENCE,
+           TSE_SEQ_STRIP,
+           TSE_SEQUENCE_DUP,
+           TSE_EBONE,
+           TSE_LAYER_COLLECTION)) {
+    /* Note about TSE_EBONE: In case of a same ID_AR datablock shared among several objects,
+     * we do not want to switch out of edit mode (see T48328 for details). */
+  }
+  else if (tselem->id && OB_DATA_SUPPORT_EDITMODE(te->idcode)) {
     /* Support edit-mode toggle, keeping the active object as is. */
   }
   else if (tselem->type == TSE_POSE_BASE) {
     /* Support pose mode toggle, keeping the active object as is. */
   }
-  else if ((obact->mode != OB_MODE_OBJECT) && (te != te_active)) {
-    /* Select rather than activate other elements when ouside of object mode */
-    return;
-  }
-  /* Always makes active object, except for some specific types. */
-  else if (ELEM(tselem->type,
-                TSE_SEQUENCE,
-                TSE_SEQ_STRIP,
-                TSE_SEQUENCE_DUP,
-                TSE_EBONE,
-                TSE_LAYER_COLLECTION)) {
-    /* Note about TSE_EBONE: In case of a same ID_AR datablock shared among several objects,
-     * we do not want to switch out of edit mode (see T48328 for details). */
-  }
   else if (soops->flag & SO_SYNC_SELECTION) {
+    /* Only activate when synced selection is enabled */
     tree_element_set_active_object(C,
                                    scene,
                                    view_layer,
@@ -1230,7 +1227,7 @@ static void do_outliner_item_activate_tree_element(bContext *C,
       tree_element_active(C, scene, view_layer, soops, te, OL_SETSEL_NORMAL, false);
     }
   }
-  else {
+  else if (soops->flag & SO_SYNC_SELECTION) {
     tree_element_type_active(C,
                              scene,
                              view_layer,
diff --git a/source/blender/editors/space_outliner/outliner_sync.c b/source/blender/editors/space_outliner/outliner_sync.c
index e82d88cd5c9..b6545c9fbb3 100644
--- a/source/blender/editors/space_outliner/outliner_sync.c
+++ b/source/blender/editors/space_outliner/outliner_sync.c
@@ -149,7 +149,8 @@ static void outliner_sync_selection_to_outliner(const bContext *C,
 {
   Scene *scene = CTX_data_scene(C);
   Object *obact = OBACT(view_layer);
-  Sequence *seq_act = BKE_sequencer_active_get(scene);
+  Sequence *sequence_active = BKE_sequencer_active_get(scene);
+  bPoseChannel *pchan_active = CTX_data_active_pose_bone(C);
 
   for (TreeElement *te = tree->first; te; te = te->next) {
     TreeStoreElem *tselem = TREESTORE(te);
@@ -188,6 +189,10 @@ static void outliner_sync_selection_to_outliner(const bContext *C,
       bPoseChannel *pchan = (bPoseChannel *)te->directdata;
       Bone *bone = pchan->bone;
 
+      if (pchan == pchan_active) {
+        tselem->flag |= TSE_ACTIVE;
+      }
+
       if (bone->flag & BONE_SELECTED) {
         tselem->flag |= TSE_SELECTED;
       }
@@ -199,7 +204,7 @@ static void outliner_sync_selection_to_outliner(const bContext *C,
       printf("\t\tSyncing a sequence: %s\n", te->name);
       Sequence *seq = (Sequence *)tselem->id;
 
-      if (seq == seq_act) {
+      if (seq == sequence_active) {
         outliner_element_activate(soops, tselem);
       }



More information about the Bf-blender-cvs mailing list