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