diff options
author | Alexander Gavrilov <angavrilov@gmail.com> | 2019-05-08 12:08:54 +0300 |
---|---|---|
committer | Alexander Gavrilov <angavrilov@gmail.com> | 2019-05-08 12:17:00 +0300 |
commit | 27b9a0cd670ff1dabe031596cef76908df76c3c8 (patch) | |
tree | 4ba6661dc88dc9667dbd1a993a2653904c746d5b /source/blender/blenkernel | |
parent | 08012ebeec74baa6037c88c7c75de0962e4a1b74 (diff) |
Copy Scale: support raising the copied scale to an arbitrary power.
Since scale is multiplicative, the appropriate way to partially copy
it is to use power. However, the influence slider of constraints uses
linear interpolation. Thus, there is no way to correctly split scale
via constraints without adding this feature.
In addition, this allows inverting scale by using negative powers,
fulfilling the function of Copy Rotation's Invert checkboxes.
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r-- | source/blender/blenkernel/intern/constraint.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/constraint.c b/source/blender/blenkernel/intern/constraint.c index 2ccfcf45e46..218dfbd7b14 100644 --- a/source/blender/blenkernel/intern/constraint.c +++ b/source/blender/blenkernel/intern/constraint.c @@ -1882,6 +1882,7 @@ static void sizelike_new_data(void *cdata) bSizeLikeConstraint *data = (bSizeLikeConstraint *)cdata; data->flag = SIZELIKE_X | SIZELIKE_Y | SIZELIKE_Z | SIZELIKE_MULTIPLY; + data->power = 1.0f; } static void sizelike_id_looper(bConstraint *con, ConstraintIDFunc func, void *userdata) @@ -1929,6 +1930,10 @@ static void sizelike_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *ta mat4_to_size(size, ct->matrix); mat4_to_size(obsize, cob->matrix); + for (int i = 0; i < 3; i++) { + size[i] = powf(size[i], data->power); + } + if (data->flag & SIZELIKE_OFFSET) { /* Scale is a multiplicative quantity, so adding it makes no sense. * However, the additive mode has to stay for backward compatibility. */ |