diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2012-01-24 17:17:32 +0400 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2012-01-24 17:17:32 +0400 |
commit | 925234f1e07fd445d67dd0ca3fb66a11e4a5c164 (patch) | |
tree | 91b4994c2edc25f21d4bf3a6816cc2e70ffb6b4d /source/blender/blenkernel/intern/constraint.c | |
parent | 1c33126cf50f43f0abf14706ab211a998868c669 (diff) |
New fix for [#29940] Stretch To constraint breaks scaling in Transform constraint, previous one caused bug [#29962] linked objects not correct on r4361, should be fixed now.
Org code was working with isotropic scaling, but when scaling only one axis, it was broken. First fix just disabled completly scale handling. This version only takes into account scaling along local Y axis, as this is the only one affecting that constraint!
Sorry for the mistake, hope this time it will be ok.
Diffstat (limited to 'source/blender/blenkernel/intern/constraint.c')
-rw-r--r-- | source/blender/blenkernel/intern/constraint.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/source/blender/blenkernel/intern/constraint.c b/source/blender/blenkernel/intern/constraint.c index 2bda3066af0..8118cf64429 100644 --- a/source/blender/blenkernel/intern/constraint.c +++ b/source/blender/blenkernel/intern/constraint.c @@ -2775,8 +2775,7 @@ static void stretchto_evaluate (bConstraint *con, bConstraintOb *cob, ListBase * /* store Z orientation before destroying obmat */ normalize_v3_v3(zz, cob->matrix[2]); - dist = len_v3v3(cob->matrix[3], ct->matrix[3]); - /* XXX What was all that for??? Makes the constraint buggy with scaled objects, see #29940. */ + /* XXX That makes the constraint buggy with asymmetrically scaled objects, see #29940. */ /* sub_v3_v3v3(vec, cob->matrix[3], ct->matrix[3]);*/ /* vec[0] /= size[0];*/ /* vec[1] /= size[1];*/ @@ -2784,10 +2783,14 @@ static void stretchto_evaluate (bConstraint *con, bConstraintOb *cob, ListBase * /* dist = normalize_v3(vec);*/ + dist = len_v3v3(cob->matrix[3], ct->matrix[3]); + /* Only Y constrained object axis scale should be used, to keep same length when scaling it. */ + dist /= size[1]; + /* data->orglength==0 occurs on first run, and after 'R' button is clicked */ - if (data->orglength == 0) + if (data->orglength == 0) data->orglength = dist; - if (data->bulge == 0) + if (data->bulge == 0) data->bulge = 1.0; scale[1] = dist/data->orglength; |