Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2018-09-18 07:58:20 +0300
committerCampbell Barton <ideasman42@gmail.com>2018-09-18 07:58:20 +0300
commit0a3b66cfb573a91ba3b19f30ead4a026bdfa6873 (patch)
tree7f91df7970a4d4b20b9fe99fab5dbfc130334c6b /source
parent2b57222ecea2e73ce28027373c0f3b57c75011a9 (diff)
Gizmo: dial3d option to get angles w/o wrapping
Needed for spinning multiple revolutions.
Diffstat (limited to 'source')
-rw-r--r--source/blender/editors/gizmo_library/gizmo_types/dial3d_gizmo.c5
-rw-r--r--source/blender/editors/mesh/editmesh_extrude_spin_gizmo.c2
2 files changed, 6 insertions, 1 deletions
diff --git a/source/blender/editors/gizmo_library/gizmo_types/dial3d_gizmo.c b/source/blender/editors/gizmo_library/gizmo_types/dial3d_gizmo.c
index 4acd033a6e2..7ceb46f20de 100644
--- a/source/blender/editors/gizmo_library/gizmo_types/dial3d_gizmo.c
+++ b/source/blender/editors/gizmo_library/gizmo_types/dial3d_gizmo.c
@@ -267,8 +267,10 @@ static void dial_ghostarc_get_angles(
}
inter->prev.angle = delta;
+ const bool wrap_angle = RNA_boolean_get(gz->ptr, "wrap_angle");
+ const double delta_final = (double)delta + ((2 * M_PI) * (double)inter->rotations);
*r_start = start;
- *r_delta = fmod(delta + 2.0f * (float)M_PI * inter->rotations, 2 * (float)M_PI);
+ *r_delta = (float)(wrap_angle ? fmod(delta_final, 2 * M_PI) : delta_final);
return;
/* If we can't project (unlikely). */
@@ -492,6 +494,7 @@ static void GIZMO_GT_dial_3d(wmGizmoType *gzt)
{0, NULL, 0, NULL, NULL}
};
RNA_def_enum_flag(gzt->srna, "draw_options", rna_enum_draw_options, 0, "Draw Options", "");
+ RNA_def_boolean(gzt->srna, "wrap_angle", true, "Wrap Angle", "");
WM_gizmotype_target_property_def(gzt, "offset", PROP_FLOAT, 1);
}
diff --git a/source/blender/editors/mesh/editmesh_extrude_spin_gizmo.c b/source/blender/editors/mesh/editmesh_extrude_spin_gizmo.c
index b7aca5811be..800e679b8a9 100644
--- a/source/blender/editors/mesh/editmesh_extrude_spin_gizmo.c
+++ b/source/blender/editors/mesh/editmesh_extrude_spin_gizmo.c
@@ -557,6 +557,8 @@ static void gizmo_mesh_spin_redo_setup(const bContext *C, wmGizmoGroup *gzgroup)
RNA_enum_set(ggd->translate_z->ptr, "draw_style", ED_GIZMO_ARROW_STYLE_NORMAL);
RNA_enum_set(ggd->translate_c->ptr, "draw_style", ED_GIZMO_MOVE_STYLE_RING_2D);
+ RNA_boolean_set(ggd->angle_z->ptr, "wrap_angle", false);
+
WM_gizmo_set_flag(ggd->translate_c, WM_GIZMO_DRAW_VALUE, true);
WM_gizmo_set_flag(ggd->rotate_c, WM_GIZMO_DRAW_VALUE, true);
WM_gizmo_set_flag(ggd->angle_z, WM_GIZMO_DRAW_VALUE, true);