ED_gizmotypes_dial_3d_draw_util: use a struct to hide most parameters.
authormano-wii <germano.costa@ig.com.br>
Wed, 3 Oct 2018 22:59:35 +0000 (19:59 -0300)
committermano-wii <germano.costa@ig.com.br>
Wed, 3 Oct 2018 22:59:35 +0000 (19:59 -0300)
source/blender/editors/gizmo_library/gizmo_types/dial3d_gizmo.c
source/blender/editors/include/ED_gizmo_library.h
source/blender/editors/transform/transform_gizmo_3d.c

index 3d9f5f1df6fed0f8e411486f81034343a70a233f..7dc0a24add92fc04eef5362e7e39ab097e6f8a63 100644 (file)
@@ -374,9 +374,16 @@ static void dial_draw_intern(
        }
 
        ED_gizmotypes_dial_3d_draw_util(
-               gz->matrix_basis, matrix_final, gz->line_width, color, clip_plane,
-               arc_partial_angle, arc_inner_factor, draw_options, angle_ofs,
-               angle_delta, angle_increment);
+               gz->matrix_basis, matrix_final, gz->line_width, color,
+               &(struct Dial3dParams){
+                   .draw_options = draw_options,
+                   .angle_ofs = angle_ofs,
+                   .angle_delta = angle_delta,
+                   .angle_increment = angle_increment,
+                   .arc_partial_angle = arc_partial_angle,
+                   .arc_inner_factor = arc_inner_factor,
+                   .clip_plane = clip_plane,
+               });
 }
 
 static void gizmo_dial_draw_select(const bContext *C, wmGizmo *gz, int select_id)
@@ -535,40 +542,34 @@ void ED_gizmotypes_dial_3d_draw_util(
         const float matrix_final[4][4],
         const float line_width,
         const float color[4],
-        const float clip_plane[4],
-        const float arc_partial_angle,
-        const float arc_inner_factor,
-        const int draw_options,
-        const float angle_ofs,
-        const float angle_delta,
-        const float angle_increment)
+        struct Dial3dParams *params)
 {
        GPU_matrix_push();
        GPU_matrix_mul(matrix_final);
 
        GPU_polygon_smooth(false);
 
-       if ((draw_options & ED_GIZMO_DIAL_DRAW_FLAG_ANGLE_VALUE) != 0) {
+       if ((params->draw_options & ED_GIZMO_DIAL_DRAW_FLAG_ANGLE_VALUE) != 0) {
                /* Draw rotation indicator arc first. */
                dial_ghostarc_draw_with_helplines(
-                       angle_ofs, angle_delta,
-                       arc_inner_factor, color, draw_options);
+                       params->angle_ofs, params->angle_delta,
+                       params->arc_inner_factor, color, params->draw_options);
 
-               if ((draw_options & ED_GIZMO_DIAL_DRAW_FLAG_ANGLE_MIRROR) != 0) {
+               if ((params->draw_options & ED_GIZMO_DIAL_DRAW_FLAG_ANGLE_MIRROR) != 0) {
                        dial_ghostarc_draw_with_helplines(
-                               angle_ofs + M_PI, angle_delta,
-                               arc_inner_factor, color, draw_options);
+                               params->angle_ofs + M_PI, params->angle_delta,
+                               params->arc_inner_factor, color, params->draw_options);
                }
        }
 
-       if (angle_increment) {
-               dial_ghostarc_draw_incremental_angle(angle_increment);
+       if (params->angle_increment) {
+               dial_ghostarc_draw_incremental_angle(params->angle_increment);
        }
 
        /* Draw actual dial gizmo. */
        dial_geom_draw(
-               color, line_width, false, matrix_basis, clip_plane,
-               arc_partial_angle, arc_inner_factor, draw_options);
+               color, line_width, false, matrix_basis, params->clip_plane,
+               params->arc_partial_angle, params->arc_inner_factor, params->draw_options);
 
        GPU_matrix_pop();
 }
index a580436ccf893528d855d14d00f766a4fa805e1d..cdeaf648fbce03c6c19a407ca9d5ec600d2899c8 100644 (file)
@@ -235,17 +235,20 @@ enum {
 /* -------------------------------------------------------------------- */
 /* Gizmo Drawing Functions */
 
+struct Dial3dParams {
+       int draw_options;
+       float angle_ofs;
+       float angle_delta;
+       float angle_increment;
+       float arc_partial_angle;
+       float arc_inner_factor;
+       float *clip_plane;
+};
 void ED_gizmotypes_dial_3d_draw_util(
         const float matrix_basis[4][4],
         const float matrix_final[4][4],
         const float line_width,
         const float color[4],
-        const float clip_plane[4],
-        const float arc_partial_angle,
-        const float arc_inner_factor,
-        const int draw_options,
-        const float angle_ofs,
-        const float angle_delta,
-        const float angle_increment);
+        struct Dial3dParams *params);
 
 #endif  /* __ED_GIZMO_LIBRARY_H__ */
index 568fe499a75c1b1873e3bf9ce7945f5396ec202f..097e902105ba5e6afaf1a1e296a1a9c79e7aacc7 100644 (file)
@@ -1299,9 +1299,12 @@ void drawDial3d(const TransInfo *t)
                GPU_line_smooth(true);
 
                ED_gizmotypes_dial_3d_draw_util(
-                       mat_basis, mat_final, line_with, color, NULL, 0.0f, 0.0f,
-                       ED_GIZMO_DIAL_DRAW_FLAG_ANGLE_VALUE,
-                       0.0f, t->values[0], increment);
+                       mat_basis, mat_final, line_with, color,
+                       &(struct Dial3dParams){
+                           .draw_options = ED_GIZMO_DIAL_DRAW_FLAG_ANGLE_VALUE,
+                           .angle_delta = t->values[0],
+                           .angle_increment = increment,
+                       });
 
                GPU_line_smooth(false);