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
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/blender/editors/gizmo_library
parent2b57222ecea2e73ce28027373c0f3b57c75011a9 (diff)
Gizmo: dial3d option to get angles w/o wrapping
Needed for spinning multiple revolutions.
Diffstat (limited to 'source/blender/editors/gizmo_library')
-rw-r--r--source/blender/editors/gizmo_library/gizmo_types/dial3d_gizmo.c5
1 files changed, 4 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);
}