Gizmo: add option to move & dial gizmos to select as filled
[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
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 = (
110                 (draw_options &
111                  (select ?
112                   (ED_GIZMO_DIAL_DRAW_FLAG_FILL | ED_GIZMO_DIAL_DRAW_FLAG_FILL_SELECT) :
113                   ED_GIZMO_DIAL_DRAW_FLAG_FILL)));
114
115         GPU_line_width(line_width);
116
117         GPUVertFormat *format = immVertexFormat();
118         uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
119
120         if (clip_plane) {
121                 immBindBuiltinProgram(GPU_SHADER_3D_CLIPPED_UNIFORM_COLOR);
122                 immUniform4fv("ClipPlane", clip_plane);
123                 immUniformMatrix4fv("ModelMatrix", axis_modal_mat);
124                 glEnable(GL_CLIP_DISTANCE0);
125         }
126         else {
127                 immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);
128         }
129
130         immUniformColor4fv(color);
131
132         if (filled) {
133                 imm_draw_circle_fill_2d(pos, 0, 0, 1.0, DIAL_RESOLUTION);
134         }
135         else {
136                 if (arc_partial_angle == 0.0f) {
137                         imm_draw_circle_wire_2d(pos, 0, 0, 1.0, DIAL_RESOLUTION);
138                         if (arc_inner_factor != 0.0f) {
139                                 imm_draw_circle_wire_2d(pos, 0, 0, arc_inner_factor, DIAL_RESOLUTION);
140                         }
141                 }
142                 else {
143                         float arc_partial_deg = RAD2DEGF((M_PI * 2) - arc_partial_angle);
144                         imm_draw_circle_partial_wire_2d(
145                                 pos, 0, 0, 1.0, DIAL_RESOLUTION,
146                                 -arc_partial_deg / 2, arc_partial_deg);
147 #if 0
148                         if (arc_inner_factor != 0.0f) {
149                                 BLI_assert(0);
150                         }
151 #endif
152                 }
153         }
154
155         immUnbindProgram();
156
157         if (clip_plane) {
158                 glDisable(GL_CLIP_DISTANCE0);
159         }
160
161         UNUSED_VARS(select);
162 #endif
163 }
164
165 /**
166  * Draws a line from (0, 0, 0) to \a co_outer, at \a angle.
167  */
168 static void dial_ghostarc_draw_helpline(
169         const float angle, const float co_outer[3], const float color[4])
170 {
171         GPU_matrix_push();
172         GPU_matrix_rotate_3f(RAD2DEGF(angle), 0.0f, 0.0f, -1.0f);
173
174         uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 3, GPU_FETCH_FLOAT);
175
176         immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);
177
178         immUniformColor4fv(color);
179
180         immBegin(GPU_PRIM_LINE_STRIP, 2);
181         immVertex3f(pos, 0.0f, 0, 0.0f);
182         immVertex3fv(pos, co_outer);
183         immEnd();
184
185         immUnbindProgram();
186
187         GPU_matrix_pop();
188 }
189
190 /**
191  * Draws segments to indicate the position of each increment.
192  */
193 static void dial_ghostarc_draw_incremental_angle(
194         const float incremental_angle, const float offset)
195 {
196         const int tot_incr = (2 * M_PI) / incremental_angle;
197         GPU_line_width(1.0f);
198
199         uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 3, GPU_FETCH_FLOAT);
200         immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);
201         immUniformColor3f(1.0f, 1.0f, 1.0f);
202         immBegin(GPU_PRIM_LINES, tot_incr * 2);
203
204         float v[3] = { 0 };
205         for (int i = 0; i < tot_incr; i++) {
206                 v[0] = sinf(offset + incremental_angle * i);
207                 v[1] = cosf(offset + incremental_angle * i);
208
209                 mul_v2_fl(v, DIAL_WIDTH * 1.1f);
210                 immVertex3fv(pos, v);
211
212                 mul_v2_fl(v, 1.1f);
213                 immVertex3fv(pos, v);
214         }
215
216         immEnd();
217         immUnbindProgram();
218 }
219
220 static void dial_ghostarc_draw(
221         const float angle_ofs, const float angle_delta,
222         const float arc_inner_factor, const float color[4])
223 {
224         const float width_inner = DIAL_WIDTH;
225         GPUVertFormat *format = immVertexFormat();
226         uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
227         immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);
228
229         if (arc_inner_factor != 0.0) {
230                 float color_dark[4] = {0};
231                 color_dark[3] = color[3] / 2;
232                 immUniformColor4fv(color_dark);
233                 imm_draw_disk_partial_fill_2d(
234                         pos, 0, 0, arc_inner_factor, width_inner, DIAL_RESOLUTION, RAD2DEGF(angle_ofs), RAD2DEGF(M_PI * 2));
235         }
236
237         immUniformColor4fv(color);
238         imm_draw_disk_partial_fill_2d(
239                 pos, 0, 0, arc_inner_factor, width_inner, DIAL_RESOLUTION, RAD2DEGF(angle_ofs), RAD2DEGF(angle_delta));
240         immUnbindProgram();
241 }
242
243 static void dial_ghostarc_get_angles(
244         const wmGizmo *gz,
245         const wmEvent *event,
246         const ARegion *ar,
247         float mat[4][4], const float co_outer[3],
248         float *r_start, float *r_delta)
249 {
250         DialInteraction *inter = gz->interaction_data;
251         const RegionView3D *rv3d = ar->regiondata;
252         const float mval[2] = {event->x - ar->winrct.xmin, event->y - ar->winrct.ymin};
253
254         /* We might need to invert the direction of the angles. */
255         float view_vec[3], axis_vec[3];
256         ED_view3d_global_to_vector(rv3d, gz->matrix_basis[3], view_vec);
257         normalize_v3_v3(axis_vec, gz->matrix_basis[2]);
258
259         float proj_outer_rel[3];
260         mul_v3_project_m4_v3(proj_outer_rel, mat, co_outer);
261         sub_v3_v3(proj_outer_rel, gz->matrix_basis[3]);
262
263         float proj_mval_new_rel[3];
264         float proj_mval_init_rel[3];
265         float dial_plane[4];
266
267         plane_from_point_normal_v3(dial_plane, gz->matrix_basis[3], axis_vec);
268
269         if (!ED_view3d_win_to_3d_on_plane(ar, dial_plane, inter->init.mval, false, proj_mval_init_rel)) {
270                 goto fail;
271         }
272         sub_v3_v3(proj_mval_init_rel, gz->matrix_basis[3]);
273
274         if (!ED_view3d_win_to_3d_on_plane(ar, dial_plane, mval, false, proj_mval_new_rel)) {
275                 goto fail;
276         }
277         sub_v3_v3(proj_mval_new_rel, gz->matrix_basis[3]);
278
279         const int draw_options = RNA_enum_get(gz->ptr, "draw_options");
280
281         /* Start direction from mouse or set by user. */
282         const float *proj_init_rel =
283                 (draw_options & ED_GIZMO_DIAL_DRAW_FLAG_ANGLE_START_Y) ?
284                 gz->matrix_basis[1] : proj_mval_init_rel;
285
286         /* Return angles. */
287         const float start = angle_wrap_rad(angle_signed_on_axis_v3v3_v3(proj_outer_rel, proj_init_rel, axis_vec));
288         const float delta = angle_wrap_rad(angle_signed_on_axis_v3v3_v3(proj_mval_init_rel, proj_mval_new_rel, axis_vec));
289
290         /* Change of sign, we passed the 180 degree threshold. This means we need to add a turn
291          * to distinguish between transition from 0 to -1 and -PI to +PI, use comparison with PI/2.
292          * Logic taken from #BLI_dial_angle */
293         if ((delta * inter->prev.angle < 0.0f) &&
294             (fabsf(inter->prev.angle) > (float)M_PI_2))
295         {
296                 if (inter->prev.angle < 0.0f) {
297                         inter->rotations--;
298                 }
299                 else {
300                         inter->rotations++;
301                 }
302         }
303         inter->prev.angle = delta;
304
305         const bool wrap_angle = RNA_boolean_get(gz->ptr, "wrap_angle");
306         const double delta_final = (double)delta + ((2 * M_PI) * (double)inter->rotations);
307         *r_start = start;
308         *r_delta = (float)(wrap_angle ? fmod(delta_final, 2 * M_PI) : delta_final);
309         return;
310
311         /* If we can't project (unlikely). */
312 fail:
313         *r_start = 0.0;
314         *r_delta = 0.0;
315 }
316
317 static void dial_ghostarc_draw_with_helplines(
318         const float angle_ofs, const float angle_delta,
319         const float arc_inner_factor, const float color_helpline[4], const int draw_options)
320 {
321         /* Coordinate at which the arc drawing will be started. */
322         const float co_outer[4] = {0.0f, DIAL_WIDTH, 0.0f};
323         dial_ghostarc_draw(angle_ofs, angle_delta, arc_inner_factor, (const float[4]){0.8f, 0.8f, 0.8f, 0.4f});
324         GPU_line_width(1.0f);
325         dial_ghostarc_draw_helpline(angle_ofs, co_outer, color_helpline);
326         if (draw_options & ED_GIZMO_DIAL_DRAW_FLAG_ANGLE_VALUE) {
327                 GPU_line_width(3.0f);
328         }
329         dial_ghostarc_draw_helpline(angle_ofs + angle_delta, co_outer, color_helpline);
330 }
331
332 static void dial_draw_intern(
333         const bContext *C, wmGizmo *gz,
334         const bool select, const bool highlight, float clip_plane[4])
335 {
336         float matrix_final[4][4];
337         float color[4];
338
339         (void)C;
340         BLI_assert(CTX_wm_area(C)->spacetype == SPACE_VIEW3D);
341
342         gizmo_color_get(gz, highlight, color);
343
344         WM_gizmo_calc_matrix_final(gz, matrix_final);
345
346         const float arc_partial_angle = RNA_float_get(gz->ptr, "arc_partial_angle");
347         const float arc_inner_factor = RNA_float_get(gz->ptr, "arc_inner_factor");
348         int draw_options = RNA_enum_get(gz->ptr, "draw_options");
349         float angle_ofs = 0.0f;
350         float angle_delta = 0.0f;
351         float angle_increment = 0.0f;
352
353         if (select) {
354                 draw_options &= ~ED_GIZMO_DIAL_DRAW_FLAG_ANGLE_VALUE;
355         }
356
357         if (draw_options & ED_GIZMO_DIAL_DRAW_FLAG_ANGLE_VALUE &&
358             (gz->flag & WM_GIZMO_DRAW_VALUE))
359         {
360                 DialInteraction *inter = gz->interaction_data;
361                 if (inter) {
362                         angle_ofs = inter->output.angle_ofs;
363                         angle_delta = inter->output.angle_delta;
364                         angle_increment = inter->angle_increment;
365                 }
366                 else {
367                         wmGizmoProperty *gz_prop = WM_gizmo_target_property_find(gz, "offset");
368                         if (WM_gizmo_target_property_is_valid(gz_prop)) {
369                                 angle_delta = WM_gizmo_target_property_float_get(gz, gz_prop);
370                         }
371                 }
372         }
373
374         ED_gizmotypes_dial_3d_draw_util(
375                 gz->matrix_basis, matrix_final, gz->line_width, color, select,
376                 &(struct Dial3dParams){
377                     .draw_options = draw_options,
378                     .angle_ofs = angle_ofs,
379                     .angle_delta = angle_delta,
380                     .angle_increment = angle_increment,
381                     .arc_partial_angle = arc_partial_angle,
382                     .arc_inner_factor = arc_inner_factor,
383                     .clip_plane = clip_plane,
384                 });
385 }
386
387 static void gizmo_dial_draw_select(const bContext *C, wmGizmo *gz, int select_id)
388 {
389         float clip_plane_buf[4];
390         const int draw_options = RNA_enum_get(gz->ptr, "draw_options");
391         float *clip_plane = (draw_options & ED_GIZMO_DIAL_DRAW_FLAG_CLIP) ? clip_plane_buf : NULL;
392
393         if (clip_plane) {
394                 ARegion *ar = CTX_wm_region(C);
395                 RegionView3D *rv3d = ar->regiondata;
396
397                 copy_v3_v3(clip_plane, rv3d->viewinv[2]);
398                 clip_plane[3] = -dot_v3v3(rv3d->viewinv[2], gz->matrix_basis[3]);
399                 clip_plane[3] += DIAL_CLIP_BIAS;
400         }
401
402         GPU_select_load_id(select_id);
403         dial_draw_intern(C, gz, true, false, clip_plane);
404
405         if (clip_plane) {
406                 glDisable(GL_CLIP_DISTANCE0);
407         }
408 }
409
410 static void gizmo_dial_draw(const bContext *C, wmGizmo *gz)
411 {
412         const bool is_modal = gz->state & WM_GIZMO_STATE_MODAL;
413         const bool is_highlight = (gz->state & WM_GIZMO_STATE_HIGHLIGHT) != 0;
414         float clip_plane_buf[4];
415         const int draw_options = RNA_enum_get(gz->ptr, "draw_options");
416         float *clip_plane = (!is_modal && (draw_options & ED_GIZMO_DIAL_DRAW_FLAG_CLIP)) ? clip_plane_buf : NULL;
417
418         if (clip_plane) {
419                 ARegion *ar = CTX_wm_region(C);
420                 RegionView3D *rv3d = ar->regiondata;
421
422                 copy_v3_v3(clip_plane, rv3d->viewinv[2]);
423                 clip_plane[3] = -dot_v3v3(rv3d->viewinv[2], gz->matrix_basis[3]);
424                 clip_plane[3] += DIAL_CLIP_BIAS;
425         }
426
427         GPU_blend(true);
428         dial_draw_intern(C, gz, false, is_highlight, clip_plane);
429         GPU_blend(false);
430 }
431
432 static int gizmo_dial_modal(
433         bContext *C, wmGizmo *gz, const wmEvent *event,
434         eWM_GizmoFlagTweak tweak_flag)
435 {
436         DialInteraction *inter = gz->interaction_data;
437         if ((event->type != MOUSEMOVE) && (inter->prev.tweak_flag == tweak_flag)) {
438                 return OPERATOR_RUNNING_MODAL;
439         }
440         /* Coordinate at which the arc drawing will be started. */
441         const float co_outer[4] = {0.0f, DIAL_WIDTH, 0.0f};
442         float angle_ofs, angle_delta, angle_increment = 0.0f;
443
444         dial_ghostarc_get_angles(
445                 gz, event, CTX_wm_region(C), gz->matrix_basis, co_outer, &angle_ofs, &angle_delta);
446
447         if (tweak_flag & WM_GIZMO_TWEAK_SNAP) {
448                 angle_increment = RNA_float_get(gz->ptr, "incremental_angle");
449                 angle_delta = (float)roundf((double)angle_delta / angle_increment) * angle_increment;
450         }
451         if (tweak_flag & WM_GIZMO_TWEAK_PRECISE) {
452                 angle_increment *= 0.2f;
453                 angle_delta *= 0.2f;
454         }
455         if (angle_delta != 0.0f) {
456                 inter->has_drag = true;
457         }
458
459         inter->angle_increment = angle_increment;
460         inter->output.angle_delta = angle_delta;
461         inter->output.angle_ofs = angle_ofs;
462
463         /* Set the property for the operator and call its modal function. */
464         wmGizmoProperty *gz_prop = WM_gizmo_target_property_find(gz, "offset");
465         if (WM_gizmo_target_property_is_valid(gz_prop)) {
466                 WM_gizmo_target_property_float_set(C, gz, gz_prop, inter->init.prop_angle + angle_delta);
467         }
468
469         inter->prev.tweak_flag = tweak_flag;
470
471         return OPERATOR_RUNNING_MODAL;
472 }
473
474 static void gizmo_dial_exit(bContext *C, wmGizmo *gz, const bool cancel)
475 {
476         DialInteraction *inter = gz->interaction_data;
477         bool use_reset_value = false;
478         float reset_value = 0.0f;
479         if (cancel) {
480                 /* Set the property for the operator and call its modal function. */
481                 wmGizmoProperty *gz_prop = WM_gizmo_target_property_find(gz, "offset");
482                 if (WM_gizmo_target_property_is_valid(gz_prop)) {
483                         use_reset_value = true;
484                         reset_value = inter->init.prop_angle;
485                 }
486         }
487         else {
488                 if (inter->has_drag == false) {
489                         PropertyRNA *prop = RNA_struct_find_property(gz->ptr, "click_value");
490                         if (RNA_property_is_set(gz->ptr, prop)) {
491                                 use_reset_value = true;
492                                 reset_value = RNA_property_float_get(gz->ptr, prop);
493                         }
494                 }
495         }
496
497         if (use_reset_value) {
498                 wmGizmoProperty *gz_prop = WM_gizmo_target_property_find(gz, "offset");
499                 if (WM_gizmo_target_property_is_valid(gz_prop)) {
500                         WM_gizmo_target_property_float_set(C, gz, gz_prop, reset_value);
501                 }
502         }
503
504 }
505
506
507 static void gizmo_dial_setup(wmGizmo *gz)
508 {
509         const float dir_default[3] = {0.0f, 0.0f, 1.0f};
510
511         /* defaults */
512         copy_v3_v3(gz->matrix_basis[2], dir_default);
513 }
514
515 static int gizmo_dial_invoke(
516         bContext *UNUSED(C), wmGizmo *gz, const wmEvent *event)
517 {
518         DialInteraction *inter = MEM_callocN(sizeof(DialInteraction), __func__);
519
520         inter->init.mval[0] = event->mval[0];
521         inter->init.mval[1] = event->mval[1];
522
523         wmGizmoProperty *gz_prop = WM_gizmo_target_property_find(gz, "offset");
524         if (WM_gizmo_target_property_is_valid(gz_prop)) {
525                 inter->init.prop_angle = WM_gizmo_target_property_float_get(gz, gz_prop);
526         }
527
528         gz->interaction_data = inter;
529
530         return OPERATOR_RUNNING_MODAL;
531 }
532
533 /* -------------------------------------------------------------------- */
534 /** \name Dial Gizmo API
535  *
536  * \{ */
537
538 void ED_gizmotypes_dial_3d_draw_util(
539         const float matrix_basis[4][4],
540         const float matrix_final[4][4],
541         const float line_width,
542         const float color[4],
543         const bool select,
544         struct Dial3dParams *params)
545 {
546         GPU_matrix_push();
547         GPU_matrix_mul(matrix_final);
548
549         GPU_polygon_smooth(false);
550
551         if ((params->draw_options & ED_GIZMO_DIAL_DRAW_FLAG_ANGLE_VALUE) != 0) {
552                 /* Draw rotation indicator arc first. */
553                 dial_ghostarc_draw_with_helplines(
554                         params->angle_ofs, params->angle_delta,
555                         params->arc_inner_factor, color, params->draw_options);
556
557                 if ((params->draw_options & ED_GIZMO_DIAL_DRAW_FLAG_ANGLE_MIRROR) != 0) {
558                         dial_ghostarc_draw_with_helplines(
559                                 params->angle_ofs + M_PI, params->angle_delta,
560                                 params->arc_inner_factor, color, params->draw_options);
561                 }
562         }
563
564         if (params->angle_increment) {
565                 dial_ghostarc_draw_incremental_angle(params->angle_increment, params->angle_ofs);
566         }
567
568         /* Draw actual dial gizmo. */
569         dial_geom_draw(
570                 color, line_width, select, matrix_basis, params->clip_plane,
571                 params->arc_partial_angle, params->arc_inner_factor, params->draw_options);
572
573         GPU_matrix_pop();
574 }
575
576 static void GIZMO_GT_dial_3d(wmGizmoType *gzt)
577 {
578         /* identifiers */
579         gzt->idname = "GIZMO_GT_dial_3d";
580
581         /* api callbacks */
582         gzt->draw = gizmo_dial_draw;
583         gzt->draw_select = gizmo_dial_draw_select;
584         gzt->setup = gizmo_dial_setup;
585         gzt->invoke = gizmo_dial_invoke;
586         gzt->modal = gizmo_dial_modal;
587         gzt->exit = gizmo_dial_exit;
588
589         gzt->struct_size = sizeof(wmGizmo);
590
591         /* rna */
592         static EnumPropertyItem rna_enum_draw_options[] = {
593                 {ED_GIZMO_DIAL_DRAW_FLAG_CLIP, "CLIP", 0, "Clipped", ""},
594                 {ED_GIZMO_DIAL_DRAW_FLAG_FILL, "FILL", 0, "Filled", ""},
595                 {ED_GIZMO_DIAL_DRAW_FLAG_FILL_SELECT, "FILL_SELECT", 0, "Use fill for selection test", ""},
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 /** \} */