diff options
author | Campbell Barton <ideasman42@gmail.com> | 2020-05-15 15:48:00 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2020-05-15 16:13:57 +0300 |
commit | fe0036c586d334a17a0b6bc008790749f58273be (patch) | |
tree | 7d687319527c12a2b284b4872771773e6a6841af /source/blender/editors/transform/transform_convert.c | |
parent | 0a32f6c8686c6a14a052f5b254655b3b69a581e3 (diff) |
Fix T76563: Transforming an auto-aligned point won't set it aligned
When local origins are used or a single control point is selected,
change the handle types from auto to aligned.
Diffstat (limited to 'source/blender/editors/transform/transform_convert.c')
-rw-r--r-- | source/blender/editors/transform/transform_convert.c | 37 |
1 files changed, 33 insertions, 4 deletions
diff --git a/source/blender/editors/transform/transform_convert.c b/source/blender/editors/transform/transform_convert.c index 6744f7b6262..65c0c20e0f3 100644 --- a/source/blender/editors/transform/transform_convert.c +++ b/source/blender/editors/transform/transform_convert.c @@ -83,16 +83,45 @@ #include "transform_convert.h" #include "transform_mode.h" +bool transform_mode_use_local_origins(const TransInfo *t) +{ + return ELEM(t->mode, TFM_ROTATION, TFM_RESIZE, TFM_TRACKBALL); +} + /** * Transforming around ourselves is no use, fallback to individual origins, * useful for curve/armatures. */ void transform_around_single_fallback(TransInfo *t) { - if ((t->data_len_all == 1) && - (ELEM(t->around, V3D_AROUND_CENTER_BOUNDS, V3D_AROUND_CENTER_MEDIAN, V3D_AROUND_ACTIVE)) && - (ELEM(t->mode, TFM_RESIZE, TFM_ROTATION, TFM_TRACKBALL))) { - t->around = V3D_AROUND_LOCAL_ORIGINS; + if ((ELEM(t->around, V3D_AROUND_CENTER_BOUNDS, V3D_AROUND_CENTER_MEDIAN, V3D_AROUND_ACTIVE)) && + transform_mode_use_local_origins(t)) { + + bool is_data_single = false; + if (t->data_len_all == 1) { + is_data_single = true; + } + else if (t->data_len_all == 3) { + if (t->obedit_type == OB_CURVE) { + /* Special case check for curve, if we have a single curve bezier triple selected + * treat */ + FOREACH_TRANS_DATA_CONTAINER (t, tc) { + if (!tc->data_len) { + continue; + } + if (tc->data_len == 3) { + const TransData *td = tc->data; + if ((td[0].loc == td[1].loc) && (td[1].loc == td[2].loc)) { + is_data_single = true; + } + } + break; + } + } + } + if (is_data_single) { + t->around = V3D_AROUND_LOCAL_ORIGINS; + } } } |