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