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:38:05 +0300
committerCampbell Barton <ideasman42@gmail.com>2018-09-18 07:38:05 +0300
commit2b57222ecea2e73ce28027373c0f3b57c75011a9 (patch)
treef20f1938d3d4efce461c3304198b653dc2eb526d /source/blender/editors/gizmo_library/gizmo_types/value2d_gizmo.c
parentf677ff274c6815d9aa8e0e16fe0dbbdd3d33990c (diff)
Gizmo: add snap & tweak to the dial widget
Allows holding Ctrl to snap w/ the spin tool.
Diffstat (limited to 'source/blender/editors/gizmo_library/gizmo_types/value2d_gizmo.c')
-rw-r--r--source/blender/editors/gizmo_library/gizmo_types/value2d_gizmo.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/source/blender/editors/gizmo_library/gizmo_types/value2d_gizmo.c b/source/blender/editors/gizmo_library/gizmo_types/value2d_gizmo.c
index 0f83e9a3514..46a6b8f3a5f 100644
--- a/source/blender/editors/gizmo_library/gizmo_types/value2d_gizmo.c
+++ b/source/blender/editors/gizmo_library/gizmo_types/value2d_gizmo.c
@@ -92,7 +92,9 @@ static int gizmo_value_modal(
if (tweak_flag & WM_GIZMO_TWEAK_SNAP) {
- value_delta = floorf((value_delta * 10.0f) + 0.5f) / 10.0f;
+ const double snap = 0.1;
+ value_delta = (float)roundf((double)value_delta / snap) * snap;
+
}
if (tweak_flag & WM_GIZMO_TWEAK_PRECISE) {
value_delta *= 0.1f;