[Bf-blender-cvs] [8116d460255] blender-v3.2-release: Fix T99364: Unable to select bones when custom shape display is disabled

Campbell Barton noreply at git.blender.org
Fri Jul 15 15:04:20 CEST 2022


Commit: 8116d460255c46590d7893ad21a9ae655da4ce56
Author: Campbell Barton
Date:   Fri Jul 8 11:09:47 2022 +1000
Branches: blender-v3.2-release
https://developer.blender.org/rB8116d460255c46590d7893ad21a9ae655da4ce56

Fix T99364: Unable to select bones when custom shape display is disabled

Regression in [0] which revealed an error in [1].
Logic for pose channel custom transform ignored ARM_NO_CUSTOM.

[0]: 3267c91b4d5caab7da8aef071a446dd2e86f86a9
[1]: c3fef001ee926fc183255b623f56da9fc5fcbb73

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

M	source/blender/blenkernel/intern/armature.c
M	source/blender/makesdna/DNA_action_types.h

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

diff --git a/source/blender/blenkernel/intern/armature.c b/source/blender/blenkernel/intern/armature.c
index 622ecde6a91..f29074c827c 100644
--- a/source/blender/blenkernel/intern/armature.c
+++ b/source/blender/blenkernel/intern/armature.c
@@ -2668,20 +2668,21 @@ void BKE_pchan_minmax(const Object *ob,
                       float r_max[3])
 {
   const bArmature *arm = ob->data;
-  const bPoseChannel *pchan_tx = (pchan->custom && pchan->custom_tx) ? pchan->custom_tx : pchan;
+  Object *ob_custom = (arm->flag & ARM_NO_CUSTOM) ? NULL : pchan->custom;
+  const bPoseChannel *pchan_tx = (ob_custom && pchan->custom_tx) ? pchan->custom_tx : pchan;
   const BoundBox *bb_custom = NULL;
   BoundBox bb_custom_buf;
 
-  if ((pchan->custom) && !(arm->flag & ARM_NO_CUSTOM)) {
+  if (ob_custom) {
     float min[3], max[3];
-    if (use_empty_drawtype && (pchan->custom->type == OB_EMPTY) &&
-        BKE_object_minmax_empty_drawtype(pchan->custom, min, max)) {
+    if (use_empty_drawtype && (ob_custom->type == OB_EMPTY) &&
+        BKE_object_minmax_empty_drawtype(ob_custom, min, max)) {
       memset(&bb_custom_buf, 0x0, sizeof(bb_custom_buf));
       BKE_boundbox_init_from_minmax(&bb_custom_buf, min, max);
       bb_custom = &bb_custom_buf;
     }
     else {
-      bb_custom = BKE_object_boundbox_get(pchan->custom);
+      bb_custom = BKE_object_boundbox_get(ob_custom);
     }
   }
 
diff --git a/source/blender/makesdna/DNA_action_types.h b/source/blender/makesdna/DNA_action_types.h
index 516d3ce94f9..53e87e905b5 100644
--- a/source/blender/makesdna/DNA_action_types.h
+++ b/source/blender/makesdna/DNA_action_types.h
@@ -251,12 +251,18 @@ typedef struct bPoseChannel {
 
   /** Motion path cache for this bone. */
   bMotionPath *mpath;
-  /** Draws custom object instead of default bone shape. */
+  /**
+   * Draws custom object instead of default bone shape.
+   *
+   * \note For the purpose of user interaction (selection, display etc),
+   * it's important this value is treated as NULL when #ARM_NO_CUSTOM is set.
+   */
   struct Object *custom;
   /**
-   * Odd feature, display with another bones transform.
-   * needed in rare cases for advanced rigs,
-   * since the alternative is highly complicated - campbell
+   * This is a specific feature to display with another bones transform.
+   * Needed in rare cases for advanced rigs, since alternative solutions are highly complicated.
+   *
+   * \note This depends #bPoseChannel.custom being set and the #ARM_NO_CUSTOM flag being unset.
    */
   struct bPoseChannel *custom_tx;
   float custom_scale; /* Deprecated */



More information about the Bf-blender-cvs mailing list