[Bf-blender-cvs] [198c00f4ed0] master: Armature Constraint: don't calculate the unneeded ct->matrix for solve.

Alexander Gavrilov noreply at git.blender.org
Wed May 15 21:37:41 CEST 2019


Commit: 198c00f4ed09f8b9c7273c40f93c7f2630f14624
Author: Alexander Gavrilov
Date:   Wed May 15 21:49:27 2019 +0300
Branches: master
https://developer.blender.org/rB198c00f4ed09f8b9c7273c40f93c7f2630f14624

Armature Constraint: don't calculate the unneeded ct->matrix for solve.

This constraint requires full bone data to evaluate, so it can't
use the generic single target matrix system. Calculating it is
thus useless waste of CPU time.

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

M	source/blender/blenkernel/intern/constraint.c

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

diff --git a/source/blender/blenkernel/intern/constraint.c b/source/blender/blenkernel/intern/constraint.c
index 218dfbd7b14..c680e15763d 100644
--- a/source/blender/blenkernel/intern/constraint.c
+++ b/source/blender/blenkernel/intern/constraint.c
@@ -2422,7 +2422,8 @@ static void armdef_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *targ
     copy_v3_v3(input_co, cob->matrix[3]);
   }
 
-  /* Process all targets. */
+  /* Process all targets. This can't use ct->matrix, as armdef_get_tarmat is not
+   * called in solve for efficiency because the constraint needs bone data anyway. */
   for (bConstraintTarget *ct = targets->first; ct; ct = ct->next) {
     if (ct->weight <= 0.0f) {
       continue;
@@ -5617,6 +5618,11 @@ void BKE_constraint_targets_for_solving_get(struct Depsgraph *depsgraph,
      */
     cti->get_constraint_targets(con, targets);
 
+    /* The Armature constraint doesn't need ct->matrix for evaluate at all. */
+    if (ELEM(cti->type, CONSTRAINT_TYPE_ARMATURE)) {
+      return;
+    }
+
     /* set matrices
      * - calculate if possible, otherwise just initialize as identity matrix
      */



More information about the Bf-blender-cvs mailing list