Cleanup: remove redundant BKE/BLI/BIF headers
[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
48 #include "GPU_immediate.h"
49 #include "GPU_immediate_util.h"
50 #include "GPU_matrix.h"
51 #include "GPU_select.h"
52 #include "GPU_state.h"
53
54 #include "RNA_access.h"
55 #include "RNA_define.h"
56
57 #include "WM_api.h"
58 #include "WM_types.h"
59
60 #include "ED_screen.h"
61 #include "ED_view3d.h"
62 #include "ED_transform.h"
63 #include "ED_gizmo_library.h"
64
65 /* own includes */
66 #include "../gizmo_geometry.h"
67 #include "../gizmo_library_intern.h"
68
69 /* To use custom dials exported to geom_dial_gizmo.c */
70 // #define USE_GIZMO_CUSTOM_DIAL
71
72 typedef struct DialInteraction {
73         struct {
74                 float mval[2];
75                 /* Only for when using properties. */
76                 float prop_angle;
77         } init;
78         struct {
79                 /* Cache the last angle to detect rotations bigger than -/+ PI. */
80                 eWM_GizmoFlagTweak tweak_flag;
81                 float angle;
82         } prev;
83
84         /* Number of full rotations. */
85         int rotations;
86         bool has_drag;
87         float angle_increment;
88
89         /* Final output values, used for drawing. */
90         struct {
91                 float angle_ofs;
92                 float angle_delta;
93         } output;
94 } DialInteraction;
95
96 #define DIAL_WIDTH       1.0f
97 #define DIAL_RESOLUTION 48
98
99 /* Could make option, negative to clip more (don't show when view aligned). */
100 #define DIAL_CLIP_BIAS 0.02
101
102 /* -------------------------------------------------------------------- */
103
104 static void dial_geom_draw(
105         const float color[4], const float line_width,
106         const bool select,
107         const float axis_modal_mat[4][4], const float clip_plane[4],
108         const float arc_partial_angle, const float arc_inner_factor,
109         const int draw_options)
110 {
111 #ifdef USE_GIZMO_CUSTOM_DIAL
112         UNUSED_VARS(gz, axis_modal_mat, clip_plane);
113         wm_gizmo_geometryinfo_draw(&wm_gizmo_geom_data_dial, select, color);
114 #else
115         const bool filled = (draw_options & ED_GIZMO_DIAL_DRAW_FLAG_FILL) != 0;
116
117         GPU_line_width(line_width);
118
119         GPUVertFormat *format = immVertexFormat();
120         uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
121
122         if (clip_plane) {
123                 immBindBuiltinProgram(GPU_SHADER_3D_CLIPPED_UNIFORM_COLOR);
124                 immUniform4fv("ClipPlane", clip_plane);
125                 immUniformMatrix4fv("ModelMatrix", axis_modal_mat);
126                 glEnable(GL_CLIP_DISTANCE0);
127         }
128         else {
129                 immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);
130         }
131
132         immUniformColor4fv(color);
133
134         if (filled) {
135                 imm_draw_circle_fill_2d(pos, 0, 0, 1.0, DIAL_RESOLUTION);
136         }
137         else {
138                 if (arc_partial_angle == 0.0f) {
139                         imm_draw_circle_wire_2d(pos, 0, 0, 1.0, DIAL_RESOLUTION);
140                         if (arc_inner_factor != 0.0f) {
141                                 imm_draw_circle_wire_2d(pos, 0, 0, arc_inner_factor, DIAL_RESOLUTION);
142                         }
143                 }
144                 else {
145                         float arc_partial_deg = RAD2DEGF((M_PI * 2) - arc_partial_angle);
146                         imm_draw_circle_partial_wire_2d(
147                                 pos, 0, 0, 1.0, DIAL_RESOLUTION,
148                                 -arc_partial_deg / 2, arc_partial_deg);
149 #if 0
150                         if (arc_inner_factor != 0.0f) {
151                                 BLI_assert(0);
152                         }
153 #endif
154                 }
155         }
156
157         immUnbindProgram();
158
159         if (clip_plane) {
160                 glDisable(GL_CLIP_DISTANCE0);
161         }
162
163         UNUSED_VARS(select);
164 #endif
165 }
166
167 /**
168  * Draws a line from (0, 0, 0) to \a co_outer, at \a angle.
169  */
170 static void dial_ghostarc_draw_helpline(
171         const float angle, const float co_outer[3], const float color[4])
172 {
173         GPU_matrix_push();
174         GPU_matrix_rotate_3f(RAD2DEGF(angle), 0.0f, 0.0f, -1.0f);
175
176         uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 3, GPU_FETCH_FLOAT);
177
178         immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);
179
180         immUniformColor4fv(color);
181
182         immBegin(GPU_PRIM_LINE_STRIP, 2);
183         immVertex3f(pos, 0.0f, 0, 0.0f);
184         immVertex3fv(pos, co_outer);
185         immEnd();
186
187         immUnbindProgram();
188
189         GPU_matrix_pop();
190 }
191
192 /**
193  * Draws segments to indicate the position of each increment.
194  */
195 static void dial_ghostarc_draw_incremental_angle(
196         const float incremental_angle, const float offset)
197 {
198         const int tot_incr = (2 * M_PI) / incremental_angle;
199         GPU_line_width(1.0f);
200
201         uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 3, GPU_FETCH_FLOAT);
202         immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);
203         immUniformColor3f(1.0f, 1.0f, 1.0f);
204         immBegin(GPU_PRIM_LINES, tot_incr * 2);
205
206         float v[3] = { 0 };
207         for (int i = 0; i < tot_incr; i++) {
208                 v[0] = sinf(offset + incremental_angle * i);
209                 v[1] = cosf(offset + incremental_angle * i);
210
211                 mul_v2_fl(v, DIAL_WIDTH * 1.1f);
212                 immVertex3fv(pos, v);
213
214                 mul_v2_fl(v, 1.1f);
215                 immVertex3fv(pos, v);
216         }
217
218         immEnd();
219         immUnbindProgram();
220 }
221
222 static void dial_ghostarc_draw(
223         const float angle_ofs, const float angle_delta,
224         const float arc_inner_factor, const float color[4])
225 {
226         const float width_inner = DIAL_WIDTH;
227         GPUVertFormat *format = immVertexFormat();
228         uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
229         immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);
230
231         if (arc_inner_factor != 0.0) {
232                 float color_dark[4] = {0};
233                 color_dark[3] = color[3] / 2;
234                 immUniformColor4fv(color_dark);
235                 imm_draw_disk_partial_fill_2d(
236                         pos, 0, 0, arc_inner_factor, width_inner, DIAL_RESOLUTION, RAD2DEGF(angle_ofs), RAD2DEGF(M_PI * 2));
237         }
238
239         immUniformColor4fv(color);
240         imm_draw_disk_partial_fill_2d(
241                 pos, 0, 0, arc_inner_factor, width_inner, DIAL_RESOLUTION, RAD2DEGF(angle_ofs), RAD2DEGF(angle_delta));
242         immUnbindProgram();
243 }
244
245 static void dial_ghostarc_get_angles(
246         const wmGizmo *gz,
247         const wmEvent *event,
248         const ARegion *ar,
249         float mat[4][4], const float co_outer[3],
250         float *r_start, float *r_delta)
251 {
252         DialInteraction *inter = gz->interaction_data;
253         const RegionView3D *rv3d = ar->regiondata;
254         const float mval[2] = {event->x - ar->winrct.xmin, event->y - ar->winrct.ymin};
255
256         /* We might need to invert the direction of the angles. */
257         float view_vec[3], axis_vec[3];
258         ED_view3d_global_to_vector(rv3d, gz->matrix_basis[3], view_vec);
259         normalize_v3_v3(axis_vec, gz->matrix_basis[2]);
260
261         float proj_outer_rel[3];
262         mul_v3_project_m4_v3(proj_outer_rel, mat, co_outer);
263         sub_v3_v3(proj_outer_rel, gz->matrix_basis[3]);
264
265         float proj_mval_new_rel[3];
266         float proj_mval_init_rel[3];
267         float dial_plane[4];
268
269         plane_from_point_normal_v3(dial_plane, gz->matrix_basis[3], axis_vec);
270
271         if (!ED_view3d_win_to_3d_on_plane(ar, dial_plane, inter->init.mval, false, proj_mval_init_rel)) {
272                 goto fail;
273         }
274         sub_v3_v3(proj_mval_init_rel, gz->matrix_basis[3]);
275
276         if (!ED_view3d_win_to_3d_on_plane(ar, dial_plane, mval, false, proj_mval_new_rel)) {
277                 goto fail;
278         }
279         sub_v3_v3(proj_mval_new_rel, gz->matrix_basis[3]);
280
281         const int draw_options = RNA_enum_get(gz->ptr, "draw_options");
282
283         /* Start direction from mouse or set by user. */
284         const float *proj_init_rel =
285                 (draw_options & ED_GIZMO_DIAL_DRAW_FLAG_ANGLE_START_Y) ?
286                 gz->matrix_basis[1] : proj_mval_init_rel;
287
288         /* Return angles. */
289         const float start = angle_wrap_rad(angle_signed_on_axis_v3v3_v3(proj_outer_rel, proj_init_rel, axis_vec));
290         const float delta = angle_wrap_rad(angle_signed_on_axis_v3v3_v3(proj_mval_init_rel, proj_mval_new_rel, axis_vec));
291
292         /* Change of sign, we passed the 180 degree threshold. This means we need to add a turn
293          * to distinguish between transition from 0 to -1 and -PI to +PI, use comparison with PI/2.
294          * Logic taken from #BLI_dial_angle */
295         if ((delta * inter->prev.angle < 0.0f) &&
296             (fabsf(inter->prev.angle) > (float)M_PI_2))
297         {
298                 if (inter->prev.angle < 0.0f) {
299                         inter->rotations--;
300                 }
301                 else {
302                         inter->rotations++;
303                 }
304         }
305         inter->prev.angle = delta;
306
307         const bool wrap_angle = RNA_boolean_get(gz->ptr, "wrap_angle");
308         const double delta_final = (double)delta + ((2 * M_PI) * (double)inter->rotations);
309         *r_start = start;
310         *r_delta = (float)(wrap_angle ? fmod(delta_final, 2 * M_PI) : delta_final);
311         return;
312
313         /* If we can't project (unlikely). */
314 fail:
315         *r_start = 0.0;
316         *r_delta = 0.0;
317 }
318
319 static void dial_ghostarc_draw_with_helplines(
320         const float angle_ofs, const float angle_delta,
321         const float arc_inner_factor, const float color_helpline[4], const int draw_options)
322 {
323         /* Coordinate at which the arc drawing will be started. */
324         const float co_outer[4] = {0.0f, DIAL_WIDTH, 0.0f};
325         dial_ghostarc_draw(angle_ofs, angle_delta, arc_inner_factor, (const float[4]){0.8f, 0.8f, 0.8f, 0.4f});
326         GPU_line_width(1.0f);
327         dial_ghostarc_draw_helpline(angle_ofs, co_outer, color_helpline);
328         if (draw_options & ED_GIZMO_DIAL_DRAW_FLAG_ANGLE_VALUE) {
329                 GPU_line_width(3.0f);
330         }
331         dial_ghostarc_draw_helpline(angle_ofs + angle_delta, co_outer, color_helpline);
332 }
333
334 static void dial_draw_intern(
335         const bContext *C, wmGizmo *gz,
336         const bool select, const bool highlight, float clip_plane[4])
337 {
338         float matrix_final[4][4];
339         float color[4];
340
341         (void)C;
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, params->angle_ofs);
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 /** \} */