Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorJoshua Leung <aligorith@gmail.com>2011-03-25 02:34:43 +0300
committerJoshua Leung <aligorith@gmail.com>2011-03-25 02:34:43 +0300
commit561b6e34f05d6714d2ed294040a6c4947d943da3 (patch)
treec6693e628cd923da710ecf317bf5aeebef369d14 /source
parent70d7884792e883f8d7093b6c74e9d9936084884f (diff)
Bugfix:
[#25725] Transform bone constraint & 'local with parent' as owners space [#26014] ChildOf Bone Constrain (influence) works in wrong workspace Moved the influence calculation stuff outside of the space conversions (i.e. so that it is done in worldspace only) fixes these problems, which seem to arise when a constraint doesn't work in worldspace AND doesn't need to apply inverse correct for this space conversion when it's done, hence resulting in mismatch between spaces for old and new matrices resulting in all the weird behaviour. Patch to fix this from Jahka. Cheers!
Diffstat (limited to 'source')
-rw-r--r--source/blender/blenkernel/intern/constraint.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/source/blender/blenkernel/intern/constraint.c b/source/blender/blenkernel/intern/constraint.c
index ba5b7e3ae4a..9f646a93b6a 100644
--- a/source/blender/blenkernel/intern/constraint.c
+++ b/source/blender/blenkernel/intern/constraint.c
@@ -4465,9 +4465,11 @@ void solve_constraints (ListBase *conlist, bConstraintOb *cob, float ctime)
*/
enf = con->enforce;
+ /* make copy of worldspace matrix pre-constraint for use with blending later */
+ copy_m4_m4(oldmat, cob->matrix);
+
/* move owner matrix into right space */
constraint_mat_convertspace(cob->ob, cob->pchan, cob->matrix, CONSTRAINT_SPACE_WORLD, con->ownspace);
- copy_m4_m4(oldmat, cob->matrix);
/* prepare targets for constraint solving */
if (cti->get_constraint_targets) {
@@ -4503,16 +4505,20 @@ void solve_constraints (ListBase *conlist, bConstraintOb *cob, float ctime)
cti->flush_constraint_targets(con, &targets, 1);
}
- /* Interpolate the enforcement, to blend result of constraint into final owner transform */
+ /* move owner back into worldspace for next constraint/other business */
+ if ((con->flag & CONSTRAINT_SPACEONCE) == 0)
+ constraint_mat_convertspace(cob->ob, cob->pchan, cob->matrix, con->ownspace, CONSTRAINT_SPACE_WORLD);
+
+ /* Interpolate the enforcement, to blend result of constraint into final owner transform
+ * - all this happens in worldspace to prevent any weirdness creeping in ([#26014] and [#25725]),
+ * since some constraints may not convert the solution back to the input space before blending
+ * but all are guaranteed to end up in good "worldspace" result
+ */
/* Note: all kind of stuff here before (caused trouble), much easier to just interpolate, or did I miss something? -jahka */
if (enf < 1.0) {
float solution[4][4];
copy_m4_m4(solution, cob->matrix);
blend_m4_m4m4(cob->matrix, oldmat, solution, enf);
}
-
- /* move owner back into worldspace for next constraint/other business */
- if ((con->flag & CONSTRAINT_SPACEONCE) == 0)
- constraint_mat_convertspace(cob->ob, cob->pchan, cob->matrix, con->ownspace, CONSTRAINT_SPACE_WORLD);
}
}