[Bf-blender-cvs] [8d69c6c4e7c] master: Constraints: add checks to specially handle the custom space target.

Alexander Gavrilov noreply at git.blender.org
Wed Jul 20 13:18:26 CEST 2022


Commit: 8d69c6c4e7c5417f88603d5ccb2c4bb0e156aa1e
Author: Alexander Gavrilov
Date:   Sat Jun 18 19:08:51 2022 +0300
Branches: master
https://developer.blender.org/rB8d69c6c4e7c5417f88603d5ccb2c4bb0e156aa1e

Constraints: add checks to specially handle the custom space target.

- The custom space target never needs B-Bone data (used by depsgraph).
- When drawing the relationship lines use the space matrix directly.
- Don't use the custom target to control the target space type dropdown.

Differential Revision: https://developer.blender.org/D9732

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

M	source/blender/blenkernel/intern/constraint.c
M	source/blender/draw/engines/overlay/overlay_extra.c
M	source/blender/makesrna/intern/rna_constraint.c

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

diff --git a/source/blender/blenkernel/intern/constraint.c b/source/blender/blenkernel/intern/constraint.c
index c32a6c6c515..0534899a86c 100644
--- a/source/blender/blenkernel/intern/constraint.c
+++ b/source/blender/blenkernel/intern/constraint.c
@@ -5844,9 +5844,12 @@ static bConstraint *add_new_constraint(Object *ob,
   return con;
 }
 
-bool BKE_constraint_target_uses_bbone(struct bConstraint *con,
-                                      struct bConstraintTarget *UNUSED(ct))
+bool BKE_constraint_target_uses_bbone(struct bConstraint *con, struct bConstraintTarget *ct)
 {
+  if (ct->flag & CONSTRAINT_TAR_CUSTOM_SPACE) {
+    return false;
+  }
+
   return (con->flag & CONSTRAINT_BBONE_SHAPE) || (con->type == CONSTRAINT_TYPE_ARMATURE);
 }
 
diff --git a/source/blender/draw/engines/overlay/overlay_extra.c b/source/blender/draw/engines/overlay/overlay_extra.c
index 738ea5dd8e7..4354777986c 100644
--- a/source/blender/draw/engines/overlay/overlay_extra.c
+++ b/source/blender/draw/engines/overlay/overlay_extra.c
@@ -1319,7 +1319,10 @@ static void OVERLAY_relationship_lines(OVERLAY_ExtraCallBuffers *cb,
 
           for (ct = targets.first; ct; ct = ct->next) {
             /* calculate target's matrix */
-            if (cti->get_target_matrix) {
+            if (ct->flag & CONSTRAINT_TAR_CUSTOM_SPACE) {
+              copy_m4_m4(ct->matrix, cob->space_obj_world_matrix);
+            }
+            else if (cti->get_target_matrix) {
               cti->get_target_matrix(depsgraph, curcon, cob, ct, DEG_get_ctime(depsgraph));
             }
             else {
diff --git a/source/blender/makesrna/intern/rna_constraint.c b/source/blender/makesrna/intern/rna_constraint.c
index 1420ef36493..986de0930ed 100644
--- a/source/blender/makesrna/intern/rna_constraint.c
+++ b/source/blender/makesrna/intern/rna_constraint.c
@@ -603,7 +603,7 @@ static const EnumPropertyItem *rna_Constraint_target_space_itemf(bContext *UNUSE
 
   if (BKE_constraint_targets_get(con, &targets)) {
     for (ct = targets.first; ct; ct = ct->next) {
-      if (ct->tar && ct->tar->type == OB_ARMATURE) {
+      if (ct->tar && ct->tar->type == OB_ARMATURE && !(ct->flag & CONSTRAINT_TAR_CUSTOM_SPACE)) {
         break;
       }
     }



More information about the Bf-blender-cvs mailing list