Merge branch 'blender2.7'
[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(
198         const float incremental_angle, const float offset)
199 {
200         const int tot_incr = (2 * M_PI) / incremental_angle;
201         GPU_line_width(1.0f);
202
203         uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 3, GPU_FETCH_FLOAT);
204         immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);
205         immUniformColor3f(1.0f, 1.0f, 1.0f);
206         immBegin(GPU_PRIM_LINES, tot_incr * 2);
207
208         float v[3] = { 0 };
209         for (int i = 0; i < tot_incr; i++) {
210                 v[0] = sinf(offset + incremental_angle * i);
211                 v[1] = cosf(offset + incremental_angle * i);
212
213                 mul_v2_fl(v, DIAL_WIDTH * 1.1f);
214                 immVertex3fv(pos, v);
215
216                 mul_v2_fl(v, 1.1f);
217                 immVertex3fv(pos, v);
218         }
219
220         immEnd();
221         immUnbindProgram();
222 }
223
224 static void dial_ghostarc_draw(
225         const float angle_ofs, const float angle_delta,
226         const float arc_inner_factor, const float color[4])
227 {
228         const float width_inner = DIAL_WIDTH;
229         GPUVertFormat *format = immVertexFormat();
230         uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
231         immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);
232
233         if (arc_inner_factor != 0.0) {
234                 float color_dark[4] = {0};
235                 color_dark[3] = color[3] / 2;
236                 immUniformColor4fv(color_dark);
237                 imm_draw_disk_partial_fill_2d(
238                         pos, 0, 0, arc_inner_factor, width_inner, DIAL_RESOLUTION, RAD2DEGF(angle_ofs), RAD2DEGF(M_PI * 2));
239         }
240
241         immUniformColor4fv(color);
242         imm_draw_disk_partial_fill_2d(
243                 pos, 0, 0, arc_inner_factor, width_inner, DIAL_RESOLUTION, RAD2DEGF(angle_ofs), RAD2DEGF(angle_delta));
244         immUnbindProgram();
245 }
246
247 static void dial_ghostarc_get_angles(
248         const wmGizmo *gz,
249         const wmEvent *event,
250         const ARegion *ar,
251         float mat[4][4], const float co_outer[3],
252         float *r_start, float *r_delta)
253 {
254         DialInteraction *inter = gz->interaction_data;
255         const RegionView3D *rv3d = ar->regiondata;
256         const float mval[2] = {event->x - ar->winrct.xmin, event->y - ar->winrct.ymin};
257
258         /* We might need to invert the direction of the angles. */
259         float view_vec[3], axis_vec[3];
260         ED_view3d_global_to_vector(rv3d, gz->matrix_basis[3], view_vec);
261         normalize_v3_v3(axis_vec, gz->matrix_basis[2]);
262
263         float proj_outer_rel[3];
264         mul_v3_project_m4_v3(proj_outer_rel, mat, co_outer);
265         sub_v3_v3(proj_outer_rel, gz->matrix_basis[3]);
266
267         float proj_mval_new_rel[3];
268         float proj_mval_init_rel[3];
269         float dial_plane[4];
270
271         plane_from_point_normal_v3(dial_plane, gz->matrix_basis[3], axis_vec);
272
273         if (!ED_view3d_win_to_3d_on_plane(ar, dial_plane, inter->init.mval, false, proj_mval_init_rel)) {
274                 goto fail;
275         }
276         sub_v3_v3(proj_mval_init_rel, gz->matrix_basis[3]);
277
278         if (!ED_view3d_win_to_3d_on_plane(ar, dial_plane, mval, false, proj_mval_new_rel)) {
279                 goto fail;
280         }
281         sub_v3_v3(proj_mval_new_rel, gz->matrix_basis[3]);
282
283         const int draw_options = RNA_enum_get(gz->ptr, "draw_options");
284
285         /* Start direction from mouse or set by user. */
286         const float *proj_init_rel =
287                 (draw_options & ED_GIZMO_DIAL_DRAW_FLAG_ANGLE_START_Y) ?
288                 gz->matrix_basis[1] : proj_mval_init_rel;
289
290         /* Return angles. */
291         const float start = angle_wrap_rad(angle_signed_on_axis_v3v3_v3(proj_outer_rel, proj_init_rel, axis_vec));
292         const float delta = angle_wrap_rad(angle_signed_on_axis_v3v3_v3(proj_mval_init_rel, proj_mval_new_rel, axis_vec));
293
294         /* Change of sign, we passed the 180 degree threshold. This means we need to add a turn
295          * to distinguish between transition from 0 to -1 and -PI to +PI, use comparison with PI/2.
296          * Logic taken from #BLI_dial_angle */
297         if ((delta * inter->prev.angle < 0.0f) &&
298             (fabsf(inter->prev.angle) > (float)M_PI_2))
299         {
300                 if (inter->prev.angle < 0.0f) {
301                         inter->rotations--;
302                 }
303                 else {
304                         inter->rotations++;
305                 }
306         }
307         inter->prev.angle = delta;
308
309         const bool wrap_angle = RNA_boolean_get(gz->ptr, "wrap_angle");
310         const double delta_final = (double)delta + ((2 * M_PI) * (double)inter->rotations);
311         *r_start = start;
312         *r_delta = (float)(wrap_angle ? fmod(delta_final, 2 * M_PI) : delta_final);
313         return;
314
315         /* If we can't project (unlikely). */
316 fail:
317         *r_start = 0.0;
318         *r_delta = 0.0;
319 }
320
321 static void dial_ghostarc_draw_with_helplines(
322         const float angle_ofs, const float angle_delta,
323         const float arc_inner_factor, const float color_helpline[4], const int draw_options)
324 {
325         /* Coordinate at which the arc drawing will be started. */
326         const float co_outer[4] = {0.0f, DIAL_WIDTH, 0.0f};
327         dial_ghostarc_draw(angle_ofs, angle_delta, arc_inner_factor, (const float[4]){0.8f, 0.8f, 0.8f, 0.4f});
328         GPU_line_width(1.0f);
329         dial_ghostarc_draw_helpline(angle_ofs, co_outer, color_helpline);
330         if (draw_options & ED_GIZMO_DIAL_DRAW_FLAG_ANGLE_VALUE) {
331                 GPU_line_width(3.0f);
332         }
333         dial_ghostarc_draw_helpline(angle_ofs + angle_delta, co_outer, color_helpline);
334 }
335
336 static void dial_draw_intern(
337         const bContext *C, wmGizmo *gz,
338         const bool select, const bool highlight, float clip_plane[4])
339 {
340         float matrix_final[4][4];
341         float color[4];
342
343         (void)C;
344         BLI_assert(CTX_wm_area(C)->spacetype == SPACE_VIEW3D);
345
346         gizmo_color_get(gz, highlight, color);
347
348         WM_gizmo_calc_matrix_final(gz, matrix_final);
349
350         const float arc_partial_angle = RNA_float_get(gz->ptr, "arc_partial_angle");
351         const float arc_inner_factor = RNA_float_get(gz->ptr, "arc_inner_factor");
352         int draw_options = RNA_enum_get(gz->ptr, "draw_options");
353         float angle_ofs = 0.0f;
354         float angle_delta = 0.0f;
355         float angle_increment = 0.0f;
356
357         if (select) {
358                 draw_options &= ~ED_GIZMO_DIAL_DRAW_FLAG_ANGLE_VALUE;
359         }
360
361         if (draw_options & ED_GIZMO_DIAL_DRAW_FLAG_ANGLE_VALUE &&
362             (gz->flag & WM_GIZMO_DRAW_VALUE))
363         {
364                 DialInteraction *inter = gz->interaction_data;
365                 if (inter) {
366                         angle_ofs = inter->output.angle_ofs;
367                         angle_delta = inter->output.angle_delta;
368                         angle_increment = inter->angle_increment;
369                 }
370                 else {
371                         wmGizmoProperty *gz_prop = WM_gizmo_target_property_find(gz, "offset");
372                         if (WM_gizmo_target_property_is_valid(gz_prop)) {
373                                 angle_delta = WM_gizmo_target_property_float_get(gz, gz_prop);
374                         }
375                 }
376         }
377
378         ED_gizmotypes_dial_3d_draw_util(
379                 gz->matrix_basis, matrix_final, gz->line_width, color,
380                 &(struct Dial3dParams){
381                     .draw_options = draw_options,
382                     .angle_ofs = angle_ofs,
383                     .angle_delta = angle_delta,
384                     .angle_increment = angle_increment,
385                     .arc_partial_angle = arc_partial_angle,
386                     .arc_inner_factor = arc_inner_factor,
387                     .clip_plane = clip_plane,
388                 });
389 }
390
391 static void gizmo_dial_draw_select(const bContext *C, wmGizmo *gz, int select_id)
392 {
393         float clip_plane_buf[4];
394         const int draw_options = RNA_enum_get(gz->ptr, "draw_options");
395         float *clip_plane = (draw_options & ED_GIZMO_DIAL_DRAW_FLAG_CLIP) ? clip_plane_buf : NULL;
396
397         if (clip_plane) {
398                 ARegion *ar = CTX_wm_region(C);
399                 RegionView3D *rv3d = ar->regiondata;
400
401                 copy_v3_v3(clip_plane, rv3d->viewinv[2]);
402                 clip_plane[3] = -dot_v3v3(rv3d->viewinv[2], gz->matrix_basis[3]);
403                 clip_plane[3] += DIAL_CLIP_BIAS;
404         }
405
406         GPU_select_load_id(select_id);
407         dial_draw_intern(C, gz, true, false, clip_plane);
408
409         if (clip_plane) {
410                 glDisable(GL_CLIP_DISTANCE0);
411         }
412 }
413
414 static void gizmo_dial_draw(const bContext *C, wmGizmo *gz)
415 {
416         const bool is_modal = gz->state & WM_GIZMO_STATE_MODAL;
417         const bool is_highlight = (gz->state & WM_GIZMO_STATE_HIGHLIGHT) != 0;
418         float clip_plane_buf[4];
419         const int draw_options = RNA_enum_get(gz->ptr, "draw_options");
420         float *clip_plane = (!is_modal && (draw_options & ED_GIZMO_DIAL_DRAW_FLAG_CLIP)) ? clip_plane_buf : NULL;
421
422         if (clip_plane) {
423                 ARegion *ar = CTX_wm_region(C);
424                 RegionView3D *rv3d = ar->regiondata;
425
426                 copy_v3_v3(clip_plane, rv3d->viewinv[2]);
427                 clip_plane[3] = -dot_v3v3(rv3d->viewinv[2], gz->matrix_basis[3]);
428                 clip_plane[3] += DIAL_CLIP_BIAS;
429         }
430
431         GPU_blend(true);
432         dial_draw_intern(C, gz, false, is_highlight, clip_plane);
433         GPU_blend(false);
434 }
435
436 static int gizmo_dial_modal(
437         bContext *C, wmGizmo *gz, const wmEvent *event,
438         eWM_GizmoFlagTweak tweak_flag)
439 {
440         DialInteraction *inter = gz->interaction_data;
441         if ((event->type != MOUSEMOVE) && (inter->prev.tweak_flag == tweak_flag)) {
442                 return OPERATOR_RUNNING_MODAL;
443         }
444         /* Coordinate at which the arc drawing will be started. */
445         const float co_outer[4] = {0.0f, DIAL_WIDTH, 0.0f};
446         float angle_ofs, angle_delta, angle_increment = 0.0f;
447
448         dial_ghostarc_get_angles(
449                 gz, event, CTX_wm_region(C), gz->matrix_basis, co_outer, &angle_ofs, &angle_delta);
450
451         if (tweak_flag & WM_GIZMO_TWEAK_SNAP) {
452                 angle_increment = RNA_float_get(gz->ptr, "incremental_angle");
453                 angle_delta = (float)roundf((double)angle_delta / angle_increment) * angle_increment;
454         }
455         if (tweak_flag & WM_GIZMO_TWEAK_PRECISE) {
456                 angle_increment *= 0.2f;
457                 angle_delta *= 0.2f;
458         }
459         if (angle_delta != 0.0f) {
460                 inter->has_drag = true;
461         }
462
463         inter->angle_increment = angle_increment;
464         inter->output.angle_delta = angle_delta;
465         inter->output.angle_ofs = angle_ofs;
466
467         /* Set the property for the operator and call its modal function. */
468         wmGizmoProperty *gz_prop = WM_gizmo_target_property_find(gz, "offset");
469         if (WM_gizmo_target_property_is_valid(gz_prop)) {
470                 WM_gizmo_target_property_float_set(C, gz, gz_prop, inter->init.prop_angle + angle_delta);
471         }
472
473         inter->prev.tweak_flag = tweak_flag;
474
475         return OPERATOR_RUNNING_MODAL;
476 }
477
478 static void gizmo_dial_exit(bContext *C, wmGizmo *gz, const bool cancel)
479 {
480         DialInteraction *inter = gz->interaction_data;
481         bool use_reset_value = false;
482         float reset_value = 0.0f;
483         if (cancel) {
484                 /* Set the property for the operator and call its modal function. */
485                 wmGizmoProperty *gz_prop = WM_gizmo_target_property_find(gz, "offset");
486                 if (WM_gizmo_target_property_is_valid(gz_prop)) {
487                         use_reset_value = true;
488                         reset_value = inter->init.prop_angle;
489                 }
490         }
491         else {
492                 if (inter->has_drag == false) {
493                         PropertyRNA *prop = RNA_struct_find_property(gz->ptr, "click_value");
494                         if (RNA_property_is_set(gz->ptr, prop)) {
495                                 use_reset_value = true;
496                                 reset_value = RNA_property_float_get(gz->ptr, prop);
497                         }
498                 }
499         }
500
501         if (use_reset_value) {
502                 wmGizmoProperty *gz_prop = WM_gizmo_target_property_find(gz, "offset");
503                 if (WM_gizmo_target_property_is_valid(gz_prop)) {
504                         WM_gizmo_target_property_float_set(C, gz, gz_prop, reset_value);
505                 }
506         }
507
508 }
509
510
511 static void gizmo_dial_setup(wmGizmo *gz)
512 {
513         const float dir_default[3] = {0.0f, 0.0f, 1.0f};
514
515         /* defaults */
516         copy_v3_v3(gz->matrix_basis[2], dir_default);
517 }
518
519 static int gizmo_dial_invoke(
520         bContext *UNUSED(C), wmGizmo *gz, const wmEvent *event)
521 {
522         DialInteraction *inter = MEM_callocN(sizeof(DialInteraction), __func__);
523
524         inter->init.mval[0] = event->mval[0];
525         inter->init.mval[1] = event->mval[1];
526
527         wmGizmoProperty *gz_prop = WM_gizmo_target_property_find(gz, "offset");
528         if (WM_gizmo_target_property_is_valid(gz_prop)) {
529                 inter->init.prop_angle = WM_gizmo_target_property_float_get(gz, gz_prop);
530         }
531
532         gz->interaction_data = inter;
533
534         return OPERATOR_RUNNING_MODAL;
535 }
536
537 /* -------------------------------------------------------------------- */
538 /** \name Dial Gizmo API
539  *
540  * \{ */
541
542 void ED_gizmotypes_dial_3d_draw_util(
543         const float matrix_basis[4][4],
544         const float matrix_final[4][4],
545         const float line_width,
546         const float color[4],
547         struct Dial3dParams *params)
548 {
549         GPU_matrix_push();
550         GPU_matrix_mul(matrix_final);
551
552         GPU_polygon_smooth(false);
553
554         if ((params->draw_options & ED_GIZMO_DIAL_DRAW_FLAG_ANGLE_VALUE) != 0) {
555                 /* Draw rotation indicator arc first. */
556                 dial_ghostarc_draw_with_helplines(
557                         params->angle_ofs, params->angle_delta,
558                         params->arc_inner_factor, color, params->draw_options);
559
560                 if ((params->draw_options & ED_GIZMO_DIAL_DRAW_FLAG_ANGLE_MIRROR) != 0) {
561                         dial_ghostarc_draw_with_helplines(
562                                 params->angle_ofs + M_PI, params->angle_delta,
563                                 params->arc_inner_factor, color, params->draw_options);
564                 }
565         }
566
567         if (params->angle_increment) {
568                 dial_ghostarc_draw_incremental_angle(params->angle_increment, params->angle_ofs);
569         }
570
571         /* Draw actual dial gizmo. */
572         dial_geom_draw(
573                 color, line_width, false, matrix_basis, params->clip_plane,
574                 params->arc_partial_angle, params->arc_inner_factor, params->draw_options);
575
576         GPU_matrix_pop();
577 }
578
579 static void GIZMO_GT_dial_3d(wmGizmoType *gzt)
580 {
581         /* identifiers */
582         gzt->idname = "GIZMO_GT_dial_3d";
583
584         /* api callbacks */
585         gzt->draw = gizmo_dial_draw;
586         gzt->draw_select = gizmo_dial_draw_select;
587         gzt->setup = gizmo_dial_setup;
588         gzt->invoke = gizmo_dial_invoke;
589         gzt->modal = gizmo_dial_modal;
590         gzt->exit = gizmo_dial_exit;
591
592         gzt->struct_size = sizeof(wmGizmo);
593
594         /* rna */
595         static EnumPropertyItem rna_enum_draw_options[] = {
596                 {ED_GIZMO_DIAL_DRAW_FLAG_CLIP, "CLIP", 0, "Clipped", ""},
597                 {ED_GIZMO_DIAL_DRAW_FLAG_FILL, "FILL", 0, "Filled", ""},
598                 {ED_GIZMO_DIAL_DRAW_FLAG_ANGLE_MIRROR, "ANGLE_MIRROR", 0, "Angle Mirror", ""},
599                 {ED_GIZMO_DIAL_DRAW_FLAG_ANGLE_START_Y, "ANGLE_START_Y", 0, "Angle Start Y", ""},
600                 {ED_GIZMO_DIAL_DRAW_FLAG_ANGLE_VALUE, "ANGLE_VALUE", 0, "Show Angle Value", ""},
601                 {0, NULL, 0, NULL, NULL}
602         };
603         RNA_def_enum_flag(gzt->srna, "draw_options", rna_enum_draw_options, 0, "Draw Options", "");
604         RNA_def_boolean(gzt->srna, "wrap_angle", true, "Wrap Angle", "");
605         RNA_def_float_factor(gzt->srna, "arc_inner_factor", 0.0f, 0.0f, 1.0f, "Arc Inner Factor", "", 0.0f, 1.0f);
606         RNA_def_float_factor(gzt->srna, "arc_partial_angle", 0.0f, 0.0f, M_PI * 2, "Show Partial Dial", "", 0.0f, M_PI * 2);
607         RNA_def_float_factor(
608                 gzt->srna, "incremental_angle", SNAP_INCREMENTAL_ANGLE, 0.0f,
609                 M_PI * 2, "Incremental Angle", "Angle to snap in steps", 0.0f, M_PI * 2);
610         RNA_def_float(
611                 gzt->srna, "click_value", 0.0f, -FLT_MAX, FLT_MAX,
612                 "Click Value", "Value to use for a single click action",
613                 -FLT_MAX, FLT_MAX);
614
615         WM_gizmotype_target_property_def(gzt, "offset", PROP_FLOAT, 1);
616 }
617
618 void ED_gizmotypes_dial_3d(void)
619 {
620         WM_gizmotype_append(GIZMO_GT_dial_3d);
621 }
622
623 /** \} */