From 198c00f4ed09f8b9c7273c40f93c7f2630f14624 Mon Sep 17 00:00:00 2001 From: Alexander Gavrilov Date: Wed, 15 May 2019 21:49:27 +0300 Subject: 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. --- source/blender/blenkernel/intern/constraint.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'source/blender/blenkernel') 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 */ -- cgit v1.2.3