diff options
author | Campbell Barton <ideasman42@gmail.com> | 2018-09-25 07:15:12 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2018-09-25 07:24:19 +0300 |
commit | ebdeb3eca0d6ea483a4ef057c5ffbbb20938d25b (patch) | |
tree | d47eff729dd38471a4df79fe0a6c504074e53075 /source | |
parent | a7bf4966e2d691be90a55b1189846bfaa17a9ef7 (diff) |
Gizmo: support spin tool normal flipping
Use the 2x spin tool has 2x handles to control normal direction,
dragging either handle backwards now reverses normals.
Previously it was common for the spin result to have normals
flipped the wrong way.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/editors/mesh/editmesh_extrude_spin.c | 6 | ||||
-rw-r--r-- | source/blender/editors/mesh/editmesh_extrude_spin_gizmo.c | 9 |
2 files changed, 11 insertions, 4 deletions
diff --git a/source/blender/editors/mesh/editmesh_extrude_spin.c b/source/blender/editors/mesh/editmesh_extrude_spin.c index c351d80dec8..4f9aab165d0 100644 --- a/source/blender/editors/mesh/editmesh_extrude_spin.c +++ b/source/blender/editors/mesh/editmesh_extrude_spin.c @@ -70,8 +70,8 @@ static int edbm_spin_exec(bContext *C, wmOperator *op) RNA_float_get_array(op->ptr, "center", cent); RNA_float_get_array(op->ptr, "axis", axis); const int steps = RNA_int_get(op->ptr, "steps"); - const float angle = -RNA_float_get(op->ptr, "angle"); - const bool use_normal_flip = RNA_boolean_get(op->ptr, "use_normal_flip"); + const float angle = RNA_float_get(op->ptr, "angle"); + const bool use_normal_flip = RNA_boolean_get(op->ptr, "use_normal_flip") ^ (angle < 0.0f); const bool dupli = RNA_boolean_get(op->ptr, "dupli"); if (is_zero_v3(axis)) { @@ -93,7 +93,7 @@ static int edbm_spin_exec(bContext *C, wmOperator *op) em, &spinop, op, "spin geom=%hvef cent=%v axis=%v dvec=%v steps=%i angle=%f space=%m4 " "use_normal_flip=%b use_duplicate=%b", - BM_ELEM_SELECT, cent, axis, d, steps, angle, obedit->obmat, use_normal_flip, dupli)) + BM_ELEM_SELECT, cent, axis, d, steps, -angle, obedit->obmat, use_normal_flip, dupli)) { continue; } diff --git a/source/blender/editors/mesh/editmesh_extrude_spin_gizmo.c b/source/blender/editors/mesh/editmesh_extrude_spin_gizmo.c index e3fa02e946e..5978f521bb9 100644 --- a/source/blender/editors/mesh/editmesh_extrude_spin_gizmo.c +++ b/source/blender/editors/mesh/editmesh_extrude_spin_gizmo.c @@ -197,7 +197,14 @@ static void gizmo_mesh_spin_init_refresh_axis_orientation( for (int j = 0; j < 2; j++) { gz = ggd->gizmos.icon_button[axis_index][j]; PointerRNA *ptr = WM_gizmo_operator_set(gz, 0, ggd->data.ot_spin, NULL); - RNA_float_set_array(ptr, "axis", axis_vec); + float axis_vec_flip[3]; + if (0 == j) { + negate_v3_v3(axis_vec_flip, axis_vec); + } + else { + copy_v3_v3(axis_vec_flip, axis_vec); + } + RNA_float_set_array(ptr, "axis", axis_vec_flip); } } } |