Commit: 63ba4633d1287b5569ff2b13985caf46d3389d96
Author: Nathan Craddock
Date:   Thu Aug 6 11:30:41 2020 -0600
Branches: soc-2020-outliner
https://developer.blender.org/rB63ba4633d1287b5569ff2b13985caf46d3389d96

Outliner: Fix bone constraint selection not activating bone

If the clicked constraint is a bone, the parent bone should be activated
to ensure the properties tab switch works.

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

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 879555fa46e..cb58205e6fd 100644
--- a/source/blender/editors/space_outliner/outliner_select.c
+++ b/source/blender/editors/space_outliner/outliner_select.c
@@ -918,15 +918,26 @@ static eOLDrawState tree_element_active_psys(bContext *C,
 }
 
 static int tree_element_active_constraint(bContext *C,
-                                          Scene *UNUSED(scene),
-                                          ViewLayer *UNUSED(sl),
-                                          TreeElement *UNUSED(te),
+                                          Scene *scene,
+                                          ViewLayer *view_layer,
+                                          TreeElement *te,
                                           TreeStoreElem *tselem,
                                           const eOLSetState set)
 {
   if (set != OL_SETSEL_NONE) {
     Object *ob = (Object *)tselem->id;
 
+    /* Activate the parent bone if this is a bone constraint. */
+    te = te->parent;
+    while (te) {
+      tselem = TREESTORE(te);
+      if (tselem->type == TSE_POSE_CHANNEL) {
+        tree_element_active_posechannel(C, scene, view_layer, ob, te, tselem, 
set, false);
+        return OL_DRAWSEL_NONE;
+      }
+      te = te->parent;
+    }
+
     WM_event_add_notifier(C, NC_OBJECT | ND_CONSTRAINT, ob);
   }
 
@@ -1153,6 +1164,7 @@ eOLDrawState tree_element_type_active(bContext *C,
     case TSE_POSE_CHANNEL:
       return tree_element_active_posechannel(
           C, tvc->scene, tvc->view_layer, tvc->ob_pose, te, tselem, set, 
recursive);
+    case TSE_CONSTRAINT_BASE:
     case TSE_CONSTRAINT:
       return tree_element_active_constraint(C, tvc->scene, tvc->view_layer, 
te, tselem, set);
     case TSE_R_LAYER:

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

Reply via email to