diff options
author | Germano Cavalcante <germano.costa@ig.com.br> | 2022-10-24 06:16:21 +0300 |
---|---|---|
committer | Germano Cavalcante <germano.costa@ig.com.br> | 2022-10-24 06:16:21 +0300 |
commit | b7c5ce8c2d2df9a06527651cfc301d7f2d45633a (patch) | |
tree | 4532fe43638520e2c2fdb16faf1586661cea13a5 /source/blender/editors/transform/transform_mode_curveshrinkfatten.c | |
parent | 93afc50ac3effb384d2fdcdbe193fb9da6191f96 (diff) |
Transform: limit zero radius Shrink/Fatten to only 1 curve point
rBb70bbfadfece allowed scaling of zero-radius points, but as it behaves
differently from other radius, it may not be suitable for multi-point
transformation.
Diffstat (limited to 'source/blender/editors/transform/transform_mode_curveshrinkfatten.c')
-rw-r--r-- | source/blender/editors/transform/transform_mode_curveshrinkfatten.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/source/blender/editors/transform/transform_mode_curveshrinkfatten.c b/source/blender/editors/transform/transform_mode_curveshrinkfatten.c index 76ce7b29619..d8f04dea161 100644 --- a/source/blender/editors/transform/transform_mode_curveshrinkfatten.c +++ b/source/blender/editors/transform/transform_mode_curveshrinkfatten.c @@ -101,12 +101,17 @@ void initCurveShrinkFatten(TransInfo *t) t->flag |= T_NO_CONSTRAINT; - if ((t->spacetype == SPACE_VIEW3D) && (t->region->regiontype == RGN_TYPE_WINDOW)) { - /* Save a factor to multiply the ratio and use in zero radius cases. */ + float scale_factor = 0.0f; + if ((t->spacetype == SPACE_VIEW3D) && (t->region->regiontype == RGN_TYPE_WINDOW) && + t->data_len_all == 1 || + (t->data_len_all == 3 && TRANS_DATA_CONTAINER_FIRST_OK(t)->data[0].val == NULL)) { + /* For cases where only one point on the curve is being transformed and the radius of that + * point is zero, use the factor to multiply the offset of the ratio and allow scaling. + * Note that for bezier curves, 3 TransData equals 1 point in most cases. */ RegionView3D *rv3d = t->region->regiondata; - float scale_factor = rv3d->pixsize * t->mouse.factor * t->zfac; - t->custom.mode.data = POINTER_FROM_UINT(float_as_uint(scale_factor)); + scale_factor = rv3d->pixsize * t->mouse.factor * t->zfac; } + t->custom.mode.data = POINTER_FROM_UINT(float_as_uint(scale_factor)); } /** \} */ |