diff options
author | Campbell Barton <ideasman42@gmail.com> | 2020-04-17 11:52:27 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2020-04-17 11:52:27 +0300 |
commit | 53ff71725aa6ee734626de61867a1f4879049e09 (patch) | |
tree | e64a95493aba111c03d7c124cd35d239707b415d | |
parent | e77821eecac6abca20e90b1975940b62091e10c8 (diff) | |
parent | b6279b74156e1f6d17dc0fa324aee347b26c9bd0 (diff) |
Merge branch 'blender-v2.83-release'
-rw-r--r-- | source/blender/editors/object/object_transform.c | 28 |
1 files changed, 20 insertions, 8 deletions
diff --git a/source/blender/editors/object/object_transform.c b/source/blender/editors/object/object_transform.c index eef8e29640c..6cc148535c3 100644 --- a/source/blender/editors/object/object_transform.c +++ b/source/blender/editors/object/object_transform.c @@ -1923,7 +1923,7 @@ static int object_transform_axis_target_modal(bContext *C, wmOperator *op, const normal_found = true; } - if (normal_found) { + { #ifdef USE_RELATIVE_ROTATION if (is_translate_init && xfd->object_data_len > 1) { float xform_rot_offset_inv_first[3][3]; @@ -1952,16 +1952,26 @@ static int object_transform_axis_target_modal(bContext *C, wmOperator *op, const item->xform_dist = len_v3v3(item->ob->obmat[3], location_world); normalize_v3_v3(ob_axis, item->ob->obmat[2]); /* Scale to avoid adding distance when moving between surfaces. */ - float scale = fabsf(dot_v3v3(ob_axis, normal)); - item->xform_dist *= scale; + if (normal_found) { + float scale = fabsf(dot_v3v3(ob_axis, normal)); + item->xform_dist *= scale; + } } float target_normal[3]; - copy_v3_v3(target_normal, normal); + + if (normal_found) { + copy_v3_v3(target_normal, normal); + } + else { + normalize_v3_v3(target_normal, item->ob->obmat[2]); + } #ifdef USE_RELATIVE_ROTATION - if (i != 0) { - mul_m3_v3(item->xform_rot_offset, target_normal); + if (normal_found) { + if (i != 0) { + mul_m3_v3(item->xform_rot_offset, target_normal); + } } #endif { @@ -1978,8 +1988,10 @@ static int object_transform_axis_target_modal(bContext *C, wmOperator *op, const item->ob, item->rot_mat, item->rot_mat[2], location_world, item->is_z_flip); WM_event_add_notifier(C, NC_OBJECT | ND_TRANSFORM, item->ob); } - copy_v3_v3(xfd->prev.normal, normal); - xfd->prev.is_normal_valid = true; + if (normal_found) { + copy_v3_v3(xfd->prev.normal, normal); + xfd->prev.is_normal_valid = true; + } } } else { |