Merge branch 'blender2.7'
[blender.git] / source / blender / editors / gizmo_library / gizmo_types / dial3d_gizmo.c
1 /*
2  * This program is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU General Public License
4  * as published by the Free Software Foundation; either version 2
5  * of the License, or (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software Foundation,
14  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15  *
16  * The Original Code is Copyright (C) 2014 Blender Foundation.
17  * All rights reserved.
18  */
19
20 /** \file \ingroup edgizmolib
21  *
22  * \name Dial Gizmo
23  *
24  * 3D Gizmo
25  *
26  * \brief Circle shaped gizmo for circular interaction.
27  * Currently no own handling, use with operator only.
28  *
29  * - `matrix[0]` is derived from Y and Z.
30  * - `matrix[1]` is 'up' when DialGizmo.use_start_y_axis is set.
31  * - `matrix[2]` is the axis the dial rotates around (all dials).
32  */
33
34 #include "MEM_guardedalloc.h"
35
36 #include "BLI_math.h"
37
38 #include "BKE_context.h"
39
40
41 #include "GPU_immediate.h"
42 #include "GPU_immediate_util.h"
43 #include "GPU_matrix.h"
44 #include "GPU_select.h"
45 #include "GPU_state.h"
46
47 #include "RNA_access.h"
48 #include "RNA_define.h"
49
50 #include "WM_api.h"
51 #include "WM_types.h"
52
53 #include "ED_screen.h"
54 #include "ED_view3d.h"
55 #include "ED_transform.h"
56 #include "ED_gizmo_library.h"
57
58 /* own includes */
59 #include "../gizmo_geometry.h"
60 #include "../gizmo_library_intern.h"
61
62 /* To use custom dials exported to geom_dial_gizmo.c */
63 // #define USE_GIZMO_CUSTOM_DIAL
64
65 typedef struct DialInteraction {
66         struct {
67                 float mval[2];
68                 /* Only for when using properties. */
69                 float prop_angle;
70         } init;
71         struct {
72                 /* Cache the last angle to detect rotations bigger than -/+ PI. */
73                 eWM_GizmoFlagTweak tweak_flag;
74                 float angle;
75         } prev;
76
77         /* Number of full rotations. */
78         int rotations;
79         bool has_drag;
80         float angle_increment;
81
82         /* Final output values, used for drawing. */
83         struct {
84                 float angle_ofs;
85                 float angle_delta;
86         } output;
87 } DialInteraction;
88
89 #define DIAL_WIDTH       1.0f
90 #define DIAL_RESOLUTION 48
91
92 /* Could make option, negative to clip more (don't show when view aligned). */
93 #define DIAL_CLIP_BIAS 0.02
94
95 /* -------------------------------------------------------------------- */
96
97 static void dial_geom_draw(
98         const float color[4], const float line_width,
99         const bool select,
100         const float axis_modal_mat[4][4], const float clip_plane[4],
101         const float arc_partial_angle, const float arc_inner_factor,
102         const int draw_options)
103 {
104 #ifdef USE_GIZMO_CUSTOM_DIAL
105         UNUSED_VARS(gz, axis_modal_mat, clip_plane);
106         wm_gizmo_geometryinfo_draw(&wm_gizmo_geom_data_dial, select, color);
107 #else
108         const bool filled = (draw_options & ED_GIZMO_DIAL_DRAW_FLAG_FILL) != 0;
109
110         GPU_line_width(line_width);
111
112         GPUVertFormat *format = immVertexFormat();
113         uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
114
115         if (clip_plane) {
116                 immBindBuiltinProgram(GPU_SHADER_3D_CLIPPED_UNIFORM_COLOR);
117                 immUniform4fv("ClipPlane", clip_plane);
118                 immUniformMatrix4fv("ModelMatrix", axis_modal_mat);
119                 glEnable(GL_CLIP_DISTANCE0);
120         }
121         else {
122                 immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);
123         }
124
125         immUniformColor4fv(color);
126
127         if (filled) {
128                 imm_draw_circle_fill_2d(pos, 0, 0, 1.0, DIAL_RESOLUTION);
129         }
130         else {
131                 if (arc_partial_angle == 0.0f) {
132                         imm_draw_circle_wire_2d(pos, 0, 0, 1.0, DIAL_RESOLUTION);
133                         if (arc_inner_factor != 0.0f) {
134                                 imm_draw_circle_wire_2d(pos, 0, 0, arc_inner_factor, DIAL_RESOLUTION);
135                         }
136                 }
137                 else {
138                         float arc_partial_deg = RAD2DEGF((M_PI * 2) - arc_partial_angle);
139                         imm_draw_circle_partial_wire_2d(
140                                 pos, 0, 0, 1.0, DIAL_RESOLUTION,
141                                 -arc_partial_deg / 2, arc_partial_deg);
142 #if 0
143                         if (arc_inner_factor != 0.0f) {
144                                 BLI_assert(0);
145                         }
146 #endif
147                 }
148         }
149
150         immUnbindProgram();
151
152         if (clip_plane) {
153                 glDisable(GL_CLIP_DISTANCE0);
154         }
155
156         UNUSED_VARS(select);
157 #endif
158 }
159
160 /**
161  * Draws a line from (0, 0, 0) to \a co_outer, at \a angle.
162  */
163 static void dial_ghostarc_draw_helpline(
164         const float angle, const float co_outer[3], const float color[4])
165 {
166         GPU_matrix_push();
167         GPU_matrix_rotate_3f(RAD2DEGF(angle), 0.0f, 0.0f, -1.0f);
168
169         uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 3, GPU_FETCH_FLOAT);
170
171         immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);
172
173         immUniformColor4fv(color);
174
175         immBegin(GPU_PRIM_LINE_STRIP, 2);
176         immVertex3f(pos, 0.0f, 0, 0.0f);
177         immVertex3fv(pos, co_outer);
178         immEnd();
179
180         immUnbindProgram();
181
182         GPU_matrix_pop();
183 }
184
185 /**
186  * Draws segments to indicate the position of each increment.
187  */
188 static void dial_ghostarc_draw_incremental_angle(
189         const float incremental_angle, const float offset)
190 {
191         const int tot_incr = (2 * M_PI) / incremental_angle;
192         GPU_line_width(1.0f);
193
194         uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 3, GPU_FETCH_FLOAT);
195         immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);
196         immUniformColor3f(1.0f, 1.0f, 1.0f);
197         immBegin(GPU_PRIM_LINES, tot_incr * 2);
198
199         float v[3] = { 0 };
200         for (int i = 0; i < tot_incr; i++) {
201                 v[0] = sinf(offset + incremental_angle * i);
202                 v[1] = cosf(offset + incremental_angle * i);
203
204                 mul_v2_fl(v, DIAL_WIDTH * 1.1f);
205                 immVertex3fv(pos, v);
206
207                 mul_v2_fl(v, 1.1f);
208                 immVertex3fv(pos, v);
209         }
210
211         immEnd();
212         immUnbindProgram();
213 }
214
215 static void dial_ghostarc_draw(
216         const float angle_ofs, const float angle_delta,
217         const float arc_inner_factor, const float color[4])
218 {
219         const float width_inner = DIAL_WIDTH;
220         GPUVertFormat *format = immVertexFormat();
221         uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
222         immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);
223
224         if (arc_inner_factor != 0.0) {
225                 float color_dark[4] = {0};
226                 color_dark[3] = color[3] / 2;
227                 immUniformColor4fv(color_dark);
228                 imm_draw_disk_partial_fill_2d(
229                         pos, 0, 0, arc_inner_factor, width_inner, DIAL_RESOLUTION, RAD2DEGF(angle_ofs), RAD2DEGF(M_PI * 2));
230         }
231
232         immUniformColor4fv(color);
233         imm_draw_disk_partial_fill_2d(
234                 pos, 0, 0, arc_inner_factor, width_inner, DIAL_RESOLUTION, RAD2DEGF(angle_ofs), RAD2DEGF(angle_delta));
235         immUnbindProgram();
236 }
237
238 static void dial_ghostarc_get_angles(
239         const wmGizmo *gz,
240         const wmEvent *event,
241         const ARegion *ar,
242         float mat[4][4], const float co_outer[3],
243         float *r_start, float *r_delta)
244 {
245         DialInteraction *inter = gz->interaction_data;
246         const RegionView3D *rv3d = ar->regiondata;
247         const float mval[2] = {event->x - ar->winrct.xmin, event->y - ar->winrct.ymin};
248
249         /* We might need to invert the direction of the angles. */
250         float view_vec[3], axis_vec[3];
251         ED_view3d_global_to_vector(rv3d, gz->matrix_basis[3], view_vec);
252         normalize_v3_v3(axis_vec, gz->matrix_basis[2]);
253
254         float proj_outer_rel[3];
255         mul_v3_project_m4_v3(proj_outer_rel, mat, co_outer);
256         sub_v3_v3(proj_outer_rel, gz->matrix_basis[3]);
257
258         float proj_mval_new_rel[3];
259         float proj_mval_init_rel[3];
260         float dial_plane[4];
261
262         plane_from_point_normal_v3(dial_plane, gz->matrix_basis[3], axis_vec);
263
264         if (!ED_view3d_win_to_3d_on_plane(ar, dial_plane, inter->init.mval, false, proj_mval_init_rel)) {
265                 goto fail;
266         }
267         sub_v3_v3(proj_mval_init_rel, gz->matrix_basis[3]);
268
269         if (!ED_view3d_win_to_3d_on_plane(ar, dial_plane, mval, false, proj_mval_new_rel)) {
270                 goto fail;
271         }
272         sub_v3_v3(proj_mval_new_rel, gz->matrix_basis[3]);
273
274         const int draw_options = RNA_enum_get(gz->ptr, "draw_options");
275
276         /* Start direction from mouse or set by user. */
277         const float *proj_init_rel =
278                 (draw_options & ED_GIZMO_DIAL_DRAW_FLAG_ANGLE_START_Y) ?
279                 gz->matrix_basis[1] : proj_mval_init_rel;
280
281         /* Return angles. */
282         const float start = angle_wrap_rad(angle_signed_on_axis_v3v3_v3(proj_outer_rel, proj_init_rel, axis_vec));
283         const float delta = angle_wrap_rad(angle_signed_on_axis_v3v3_v3(proj_mval_init_rel, proj_mval_new_rel, axis_vec));
284
285         /* Change of sign, we passed the 180 degree threshold. This means we need to add a turn
286          * to distinguish between transition from 0 to -1 and -PI to +PI, use comparison with PI/2.
287          * Logic taken from #BLI_dial_angle */
288         if ((delta * inter->prev.angle < 0.0f) &&
289             (fabsf(inter->prev.angle) > (float)M_PI_2))
290         {
291                 if (inter->prev.angle < 0.0f) {
292                         inter->rotations--;
293                 }
294                 else {
295                         inter->rotations++;
296                 }
297         }
298         inter->prev.angle = delta;
299
300         const bool wrap_angle = RNA_boolean_get(gz->ptr, "wrap_angle");
301         const double delta_final = (double)delta + ((2 * M_PI) * (double)inter->rotations);
302         *r_start = start;
303         *r_delta = (float)(wrap_angle ? fmod(delta_final, 2 * M_PI) : delta_final);
304         return;
305
306         /* If we can't project (unlikely). */
307 fail:
308         *r_start = 0.0;
309         *r_delta = 0.0;
310 }
311
312 static void dial_ghostarc_draw_with_helplines(
313         const float angle_ofs, const float angle_delta,
314         const float arc_inner_factor, const float color_helpline[4], const int draw_options)
315 {
316         /* Coordinate at which the arc drawing will be started. */
317         const float co_outer[4] = {0.0f, DIAL_WIDTH, 0.0f};
318         dial_ghostarc_draw(angle_ofs, angle_delta, arc_inner_factor, (const float[4]){0.8f, 0.8f, 0.8f, 0.4f});
319         GPU_line_width(1.0f);
320         dial_ghostarc_draw_helpline(angle_ofs, co_outer, color_helpline);
321         if (draw_options & ED_GIZMO_DIAL_DRAW_FLAG_ANGLE_VALUE) {
322                 GPU_line_width(3.0f);
323         }
324         dial_ghostarc_draw_helpline(angle_ofs + angle_delta, co_outer, color_helpline);
325 }
326
327 static void dial_draw_intern(
328         const bContext *C, wmGizmo *gz,
329         const bool select, const bool highlight, float clip_plane[4])
330 {
331         float matrix_final[4][4];
332         float color[4];
333
334         (void)C;
335         BLI_assert(CTX_wm_area(C)->spacetype == SPACE_VIEW3D);
336
337         gizmo_color_get(gz, highlight, color);
338
339         WM_gizmo_calc_matrix_final(gz, matrix_final);
340
341         const float arc_partial_angle = RNA_float_get(gz->ptr, "arc_partial_angle");
342         const float arc_inner_factor = RNA_float_get(gz->ptr, "arc_inner_factor");
343         int draw_options = RNA_enum_get(gz->ptr, "draw_options");
344         float angle_ofs = 0.0f;
345         float angle_delta = 0.0f;
346         float angle_increment = 0.0f;
347
348         if (select) {
349                 draw_options &= ~ED_GIZMO_DIAL_DRAW_FLAG_ANGLE_VALUE;
350         }
351
352         if (draw_options & ED_GIZMO_DIAL_DRAW_FLAG_ANGLE_VALUE &&
353             (gz->flag & WM_GIZMO_DRAW_VALUE))
354         {
355                 DialInteraction *inter = gz->interaction_data;
356                 if (inter) {
357                         angle_ofs = inter->output.angle_ofs;
358                         angle_delta = inter->output.angle_delta;
359                         angle_increment = inter->angle_increment;
360                 }
361                 else {
362                         wmGizmoProperty *gz_prop = WM_gizmo_target_property_find(gz, "offset");
363                         if (WM_gizmo_target_property_is_valid(gz_prop)) {
364                                 angle_delta = WM_gizmo_target_property_float_get(gz, gz_prop);
365                         }
366                 }
367         }
368
369         ED_gizmotypes_dial_3d_draw_util(
370                 gz->matrix_basis, matrix_final, gz->line_width, color,
371                 &(struct Dial3dParams){
372                     .draw_options = draw_options,
373                     .angle_ofs = angle_ofs,
374                     .angle_delta = angle_delta,
375                     .angle_increment = angle_increment,
376                     .arc_partial_angle = arc_partial_angle,
377                     .arc_inner_factor = arc_inner_factor,
378                     .clip_plane = clip_plane,
379                 });
380 }
381
382 static void gizmo_dial_draw_select(const bContext *C, wmGizmo *gz, int select_id)
383 {
384         float clip_plane_buf[4];
385         const int draw_options = RNA_enum_get(gz->ptr, "draw_options");
386         float *clip_plane = (draw_options & ED_GIZMO_DIAL_DRAW_FLAG_CLIP) ? clip_plane_buf : NULL;
387
388         if (clip_plane) {
389                 ARegion *ar = CTX_wm_region(C);
390                 RegionView3D *rv3d = ar->regiondata;
391
392                 copy_v3_v3(clip_plane, rv3d->viewinv[2]);
393                 clip_plane[3] = -dot_v3v3(rv3d->viewinv[2], gz->matrix_basis[3]);
394                 clip_plane[3] += DIAL_CLIP_BIAS;
395         }
396
397         GPU_select_load_id(select_id);
398         dial_draw_intern(C, gz, true, false, clip_plane);
399
400         if (clip_plane) {
401                 glDisable(GL_CLIP_DISTANCE0);
402         }
403 }
404
405 static void gizmo_dial_draw(const bContext *C, wmGizmo *gz)
406 {
407         const bool is_modal = gz->state & WM_GIZMO_STATE_MODAL;
408         const bool is_highlight = (gz->state & WM_GIZMO_STATE_HIGHLIGHT) != 0;
409         float clip_plane_buf[4];
410         const int draw_options = RNA_enum_get(gz->ptr, "draw_options");
411         float *clip_plane = (!is_modal && (draw_options & ED_GIZMO_DIAL_DRAW_FLAG_CLIP)) ? clip_plane_buf : NULL;
412
413         if (clip_plane) {
414                 ARegion *ar = CTX_wm_region(C);
415                 RegionView3D *rv3d = ar->regiondata;
416
417                 copy_v3_v3(clip_plane, rv3d->viewinv[2]);
418                 clip_plane[3] = -dot_v3v3(rv3d->viewinv[2], gz->matrix_basis[3]);
419                 clip_plane[3] += DIAL_CLIP_BIAS;
420         }
421
422         GPU_blend(true);
423         dial_draw_intern(C, gz, false, is_highlight, clip_plane);
424         GPU_blend(false);
425 }
426
427 static int gizmo_dial_modal(
428         bContext *C, wmGizmo *gz, const wmEvent *event,
429         eWM_GizmoFlagTweak tweak_flag)
430 {
431         DialInteraction *inter = gz->interaction_data;
432         if ((event->type != MOUSEMOVE) && (inter->prev.tweak_flag == tweak_flag)) {
433                 return OPERATOR_RUNNING_MODAL;
434         }
435         /* Coordinate at which the arc drawing will be started. */
436         const float co_outer[4] = {0.0f, DIAL_WIDTH, 0.0f};
437         float angle_ofs, angle_delta, angle_increment = 0.0f;
438
439         dial_ghostarc_get_angles(
440                 gz, event, CTX_wm_region(C), gz->matrix_basis, co_outer, &angle_ofs, &angle_delta);
441
442         if (tweak_flag & WM_GIZMO_TWEAK_SNAP) {
443                 angle_increment = RNA_float_get(gz->ptr, "incremental_angle");
444                 angle_delta = (float)roundf((double)angle_delta / angle_increment) * angle_increment;
445         }
446         if (tweak_flag & WM_GIZMO_TWEAK_PRECISE) {
447                 angle_increment *= 0.2f;
448                 angle_delta *= 0.2f;
449         }
450         if (angle_delta != 0.0f) {
451                 inter->has_drag = true;
452         }
453
454         inter->angle_increment = angle_increment;
455         inter->output.angle_delta = angle_delta;
456         inter->output.angle_ofs = angle_ofs;
457
458         /* Set the property for the operator and call its modal function. */
459         wmGizmoProperty *gz_prop = WM_gizmo_target_property_find(gz, "offset");
460         if (WM_gizmo_target_property_is_valid(gz_prop)) {
461                 WM_gizmo_target_property_float_set(C, gz, gz_prop, inter->init.prop_angle + angle_delta);
462         }
463
464         inter->prev.tweak_flag = tweak_flag;
465
466         return OPERATOR_RUNNING_MODAL;
467 }
468
469 static void gizmo_dial_exit(bContext *C, wmGizmo *gz, const bool cancel)
470 {
471         DialInteraction *inter = gz->interaction_data;
472         bool use_reset_value = false;
473         float reset_value = 0.0f;
474         if (cancel) {
475                 /* Set the property for the operator and call its modal function. */
476                 wmGizmoProperty *gz_prop = WM_gizmo_target_property_find(gz, "offset");
477                 if (WM_gizmo_target_property_is_valid(gz_prop)) {
478                         use_reset_value = true;
479                         reset_value = inter->init.prop_angle;
480                 }
481         }
482         else {
483                 if (inter->has_drag == false) {
484                         PropertyRNA *prop = RNA_struct_find_property(gz->ptr, "click_value");
485                         if (RNA_property_is_set(gz->ptr, prop)) {
486                                 use_reset_value = true;
487                                 reset_value = RNA_property_float_get(gz->ptr, prop);
488                         }
489                 }
490         }
491
492         if (use_reset_value) {
493                 wmGizmoProperty *gz_prop = WM_gizmo_target_property_find(gz, "offset");
494                 if (WM_gizmo_target_property_is_valid(gz_prop)) {
495                         WM_gizmo_target_property_float_set(C, gz, gz_prop, reset_value);
496                 }
497         }
498
499 }
500
501
502 static void gizmo_dial_setup(wmGizmo *gz)
503 {
504         const float dir_default[3] = {0.0f, 0.0f, 1.0f};
505
506         /* defaults */
507         copy_v3_v3(gz->matrix_basis[2], dir_default);
508 }
509
510 static int gizmo_dial_invoke(
511         bContext *UNUSED(C), wmGizmo *gz, const wmEvent *event)
512 {
513         DialInteraction *inter = MEM_callocN(sizeof(DialInteraction), __func__);
514
515         inter->init.mval[0] = event->mval[0];
516         inter->init.mval[1] = event->mval[1];
517
518         wmGizmoProperty *gz_prop = WM_gizmo_target_property_find(gz, "offset");
519         if (WM_gizmo_target_property_is_valid(gz_prop)) {
520                 inter->init.prop_angle = WM_gizmo_target_property_float_get(gz, gz_prop);
521         }
522
523         gz->interaction_data = inter;
524
525         return OPERATOR_RUNNING_MODAL;
526 }
527
528 /* -------------------------------------------------------------------- */
529 /** \name Dial Gizmo API
530  *
531  * \{ */
532
533 void ED_gizmotypes_dial_3d_draw_util(
534         const float matrix_basis[4][4],
535         const float matrix_final[4][4],
536         const float line_width,
537         const float color[4],
538         struct Dial3dParams *params)
539 {
540         GPU_matrix_push();
541         GPU_matrix_mul(matrix_final);
542
543         GPU_polygon_smooth(false);
544
545         if ((params->draw_options & ED_GIZMO_DIAL_DRAW_FLAG_ANGLE_VALUE) != 0) {
546                 /* Draw rotation indicator arc first. */
547                 dial_ghostarc_draw_with_helplines(
548                         params->angle_ofs, params->angle_delta,
549                         params->arc_inner_factor, color, params->draw_options);
550
551                 if ((params->draw_options & ED_GIZMO_DIAL_DRAW_FLAG_ANGLE_MIRROR) != 0) {
552                         dial_ghostarc_draw_with_helplines(
553                                 params->angle_ofs + M_PI, params->angle_delta,
554                                 params->arc_inner_factor, color, params->draw_options);
555                 }
556         }
557
558         if (params->angle_increment) {
559                 dial_ghostarc_draw_incremental_angle(params->angle_increment, params->angle_ofs);
560         }
561
562         /* Draw actual dial gizmo. */
563         dial_geom_draw(
564                 color, line_width, false, matrix_basis, params->clip_plane,
565                 params->arc_partial_angle, params->arc_inner_factor, params->draw_options);
566
567         GPU_matrix_pop();
568 }
569
570 static void GIZMO_GT_dial_3d(wmGizmoType *gzt)
571 {
572         /* identifiers */
573         gzt->idname = "GIZMO_GT_dial_3d";
574
575         /* api callbacks */
576         gzt->draw = gizmo_dial_draw;
577         gzt->draw_select = gizmo_dial_draw_select;
578         gzt->setup = gizmo_dial_setup;
579         gzt->invoke = gizmo_dial_invoke;
580         gzt->modal = gizmo_dial_modal;
581         gzt->exit = gizmo_dial_exit;
582
583         gzt->struct_size = sizeof(wmGizmo);
584
585         /* rna */
586         static EnumPropertyItem rna_enum_draw_options[] = {
587                 {ED_GIZMO_DIAL_DRAW_FLAG_CLIP, "CLIP", 0, "Clipped", ""},
588                 {ED_GIZMO_DIAL_DRAW_FLAG_FILL, "FILL", 0, "Filled", ""},
589                 {ED_GIZMO_DIAL_DRAW_FLAG_ANGLE_MIRROR, "ANGLE_MIRROR", 0, "Angle Mirror", ""},
590                 {ED_GIZMO_DIAL_DRAW_FLAG_ANGLE_START_Y, "ANGLE_START_Y", 0, "Angle Start Y", ""},
591                 {ED_GIZMO_DIAL_DRAW_FLAG_ANGLE_VALUE, "ANGLE_VALUE", 0, "Show Angle Value", ""},
592                 {0, NULL, 0, NULL, NULL},
593         };
594         RNA_def_enum_flag(gzt->srna, "draw_options", rna_enum_draw_options, 0, "Draw Options", "");
595         RNA_def_boolean(gzt->srna, "wrap_angle", true, "Wrap Angle", "");
596         RNA_def_float_factor(gzt->srna, "arc_inner_factor", 0.0f, 0.0f, 1.0f, "Arc Inner Factor", "", 0.0f, 1.0f);
597         RNA_def_float_factor(gzt->srna, "arc_partial_angle", 0.0f, 0.0f, M_PI * 2, "Show Partial Dial", "", 0.0f, M_PI * 2);
598         RNA_def_float_factor(
599                 gzt->srna, "incremental_angle", SNAP_INCREMENTAL_ANGLE, 0.0f,
600                 M_PI * 2, "Incremental Angle", "Angle to snap in steps", 0.0f, M_PI * 2);
601         RNA_def_float(
602                 gzt->srna, "click_value", 0.0f, -FLT_MAX, FLT_MAX,
603                 "Click Value", "Value to use for a single click action",
604                 -FLT_MAX, FLT_MAX);
605
606         WM_gizmotype_target_property_def(gzt, "offset", PROP_FLOAT, 1);
607 }
608
609 void ED_gizmotypes_dial_3d(void)
610 {
611         WM_gizmotype_append(GIZMO_GT_dial_3d);
612 }
613
614 /** \} */