[Bf-blender-cvs] [75d1139fb52] temp-T82156-parenting-and-constraints: Fix T82156: Object with Copy Rotation Constraints translates when being parented

Sybren A. Stüvel noreply at git.blender.org
Mon Nov 2 15:50:23 CET 2020


Commit: 75d1139fb522b15655efca103f3354e8018fb591
Author: Sybren A. Stüvel
Date:   Mon Nov 2 15:20:33 2020 +0100
Branches: temp-T82156-parenting-and-constraints
https://developer.blender.org/rB75d1139fb522b15655efca103f3354e8018fb591

Fix T82156: Object with Copy Rotation Constraints translates when being parented

Avoid application of constraints when computing the parent-inverse
matrix.

Constraints are meant to be evaluated last; object transforms are
computed this order:

1. `parent->obmat` (the parent object's world matrix)
2. `ob->parentinv` (the object's parent-inverse matrix)
3. Object's loc/rot/scale
4. Object's constraint evaluation

When the constraints are used to compute the parent-inverse matrix,
their effect is moved from step 4 to step 2 in this list, potentially
rotating or scaling the object's local transform. This causes unwanted
movement as reported in T82156.

This behaviour (erroneously taking the constraints into account) has
been in Blender since the first commit, so historically I can only find
"Initial revision" as context.

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

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

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

diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c
index 6bfee0194b0..8f3cb06273d 100644
--- a/source/blender/blenkernel/intern/object.c
+++ b/source/blender/blenkernel/intern/object.c
@@ -2855,7 +2855,11 @@ void BKE_object_workob_calc_parent(Depsgraph *depsgraph, Scene *scene, Object *o
   workob->par2 = ob->par2;
   workob->par3 = ob->par3;
 
-  workob->constraints = ob->constraints;
+  /* The effects of constraints should NOT be included in the parent-inverse matrix. Constraints
+   * are supposed to be applied after the object's local loc/rot/scale. If the (inverted) effect of
+   * constraints would be included in the parent inverse matrix, these would be applied before the
+   * object's local loc/rot/scale instead of after. For example, a "Copy Rotation" constraint would
+   * rotate the object's local translation as well. See T82156. */
 
   BLI_strncpy(workob->parsubstr, ob->parsubstr, sizeof(workob->parsubstr));



More information about the Bf-blender-cvs mailing list