diff options
author | Sybren A. Stüvel <sybren@blender.org> | 2020-11-27 14:11:43 +0300 |
---|---|---|
committer | Sybren A. Stüvel <sybren@blender.org> | 2020-11-27 14:11:43 +0300 |
commit | 24e57eea4325bf39617114c182430691d74c78e9 (patch) | |
tree | 729c6dfa0bbb855efb9b95a2000e220634a87193 /source/blender/blenkernel/intern/object.c | |
parent | e4b6afbe6bb4783a76ad2129ad1b57af56409986 (diff) |
Fix T82156: Object with constraints translates when parented
Avoid the evaluation 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.
Reviewed By: looch
Differential Revision: https://developer.blender.org/D9413
Diffstat (limited to 'source/blender/blenkernel/intern/object.c')
-rw-r--r-- | source/blender/blenkernel/intern/object.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c index 430d28f67c2..242c0edd5a4 100644 --- a/source/blender/blenkernel/intern/object.c +++ b/source/blender/blenkernel/intern/object.c @@ -3473,7 +3473,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)); |