Gizmo: add option to move & dial gizmos to select as filled
authorCampbell Barton <ideasman42@gmail.com>
Mon, 25 Mar 2019 04:40:23 +0000 (15:40 +1100)
committerCampbell Barton <ideasman42@gmail.com>
Mon, 25 Mar 2019 04:40:43 +0000 (15:40 +1100)
Draw as an outline while using solid selection.

source/blender/editors/gizmo_library/gizmo_types/dial3d_gizmo.c
source/blender/editors/gizmo_library/gizmo_types/move3d_gizmo.c
source/blender/editors/include/ED_gizmo_library.h
source/blender/editors/transform/transform_gizmo_3d.c

index b5be45bb63f2903874f84ec3dde793cdccd48e50..9072ced0bd1c6e28d730847440a726fdd9299b4b 100644 (file)
@@ -106,7 +106,11 @@ static void dial_geom_draw(
        UNUSED_VARS(gz, axis_modal_mat, clip_plane);
        wm_gizmo_geometryinfo_draw(&wm_gizmo_geom_data_dial, select, color);
 #else
-       const bool filled = (draw_options & ED_GIZMO_DIAL_DRAW_FLAG_FILL) != 0;
+       const bool filled = (
+               (draw_options &
+                (select ?
+                 (ED_GIZMO_DIAL_DRAW_FLAG_FILL | ED_GIZMO_DIAL_DRAW_FLAG_FILL_SELECT) :
+                 ED_GIZMO_DIAL_DRAW_FLAG_FILL)));
 
        GPU_line_width(line_width);
 
@@ -368,7 +372,7 @@ static void dial_draw_intern(
        }
 
        ED_gizmotypes_dial_3d_draw_util(
-               gz->matrix_basis, matrix_final, gz->line_width, color,
+               gz->matrix_basis, matrix_final, gz->line_width, color, select,
                &(struct Dial3dParams){
                    .draw_options = draw_options,
                    .angle_ofs = angle_ofs,
@@ -536,6 +540,7 @@ void ED_gizmotypes_dial_3d_draw_util(
         const float matrix_final[4][4],
         const float line_width,
         const float color[4],
+        const bool select,
         struct Dial3dParams *params)
 {
        GPU_matrix_push();
@@ -562,7 +567,7 @@ void ED_gizmotypes_dial_3d_draw_util(
 
        /* Draw actual dial gizmo. */
        dial_geom_draw(
-               color, line_width, false, matrix_basis, params->clip_plane,
+               color, line_width, select, matrix_basis, params->clip_plane,
                params->arc_partial_angle, params->arc_inner_factor, params->draw_options);
 
        GPU_matrix_pop();
@@ -587,6 +592,7 @@ static void GIZMO_GT_dial_3d(wmGizmoType *gzt)
        static EnumPropertyItem rna_enum_draw_options[] = {
                {ED_GIZMO_DIAL_DRAW_FLAG_CLIP, "CLIP", 0, "Clipped", ""},
                {ED_GIZMO_DIAL_DRAW_FLAG_FILL, "FILL", 0, "Filled", ""},
+               {ED_GIZMO_DIAL_DRAW_FLAG_FILL_SELECT, "FILL_SELECT", 0, "Use fill for selection test", ""},
                {ED_GIZMO_DIAL_DRAW_FLAG_ANGLE_MIRROR, "ANGLE_MIRROR", 0, "Angle Mirror", ""},
                {ED_GIZMO_DIAL_DRAW_FLAG_ANGLE_START_Y, "ANGLE_START_Y", 0, "Angle Start Y", ""},
                {ED_GIZMO_DIAL_DRAW_FLAG_ANGLE_VALUE, "ANGLE_VALUE", 0, "Show Angle Value", ""},
index 0fe5a4e7d80996bf3e928e4dc0fd615d18727d30..3870ce984b5fab78ca2bd0aedb31399f96c4a075 100644 (file)
@@ -104,7 +104,11 @@ static void move_geom_draw(
        wm_gizmo_geometryinfo_draw(&wm_gizmo_geom_data_move3d, select);
 #else
        const int draw_style = RNA_enum_get(gz->ptr, "draw_style");
-       const bool filled = (draw_options & ED_GIZMO_MOVE_DRAW_FLAG_FILL) != 0;
+       const bool filled = (
+               (draw_options &
+                (select ?
+                 (ED_GIZMO_MOVE_DRAW_FLAG_FILL | ED_GIZMO_MOVE_DRAW_FLAG_FILL_SELECT) :
+                 ED_GIZMO_MOVE_DRAW_FLAG_FILL)));
 
        GPU_line_width(gz->line_width);
 
@@ -440,6 +444,7 @@ static void GIZMO_GT_move_3d(wmGizmoType *gzt)
        };
        static EnumPropertyItem rna_enum_draw_options[] = {
                {ED_GIZMO_MOVE_DRAW_FLAG_FILL, "FILL", 0, "Filled", ""},
+               {ED_GIZMO_MOVE_DRAW_FLAG_FILL_SELECT, "FILL_SELECT", 0, "Use fill for selection test", ""},
                {ED_GIZMO_MOVE_DRAW_FLAG_ALIGN_VIEW, "ALIGN_VIEW", 0, "Align View", ""},
                {0, NULL, 0, NULL, NULL},
        };
index 53b65292b6a751d98b5faa7f841f77d56fde1975..48effda37efc07b59ff7187312ff694cb2005d8e 100644 (file)
@@ -184,10 +184,11 @@ enum {
        ED_GIZMO_DIAL_DRAW_FLAG_NOP               = 0,
        ED_GIZMO_DIAL_DRAW_FLAG_CLIP              = (1 << 0),
        ED_GIZMO_DIAL_DRAW_FLAG_FILL              = (1 << 1),
-       ED_GIZMO_DIAL_DRAW_FLAG_ANGLE_MIRROR      = (1 << 2),
-       ED_GIZMO_DIAL_DRAW_FLAG_ANGLE_START_Y     = (1 << 3),
+       ED_GIZMO_DIAL_DRAW_FLAG_FILL_SELECT       = (1 << 2),
+       ED_GIZMO_DIAL_DRAW_FLAG_ANGLE_MIRROR      = (1 << 3),
+       ED_GIZMO_DIAL_DRAW_FLAG_ANGLE_START_Y     = (1 << 4),
        /* Always show the angle value as an arc in the dial. */
-       ED_GIZMO_DIAL_DRAW_FLAG_ANGLE_VALUE       = (1 << 4),
+       ED_GIZMO_DIAL_DRAW_FLAG_ANGLE_VALUE       = (1 << 5),
 };
 
 /* -------------------------------------------------------------------- */
@@ -198,7 +199,8 @@ enum {
        ED_GIZMO_MOVE_DRAW_FLAG_NOP               = 0,
        /* only for solid shapes */
        ED_GIZMO_MOVE_DRAW_FLAG_FILL              = (1 << 0),
-       ED_GIZMO_MOVE_DRAW_FLAG_ALIGN_VIEW        = (1 << 1),
+       ED_GIZMO_MOVE_DRAW_FLAG_FILL_SELECT       = (1 << 1),
+       ED_GIZMO_MOVE_DRAW_FLAG_ALIGN_VIEW        = (1 << 2),
 };
 
 enum {
@@ -245,6 +247,7 @@ void ED_gizmotypes_dial_3d_draw_util(
         const float matrix_final[4][4],
         const float line_width,
         const float color[4],
+        const bool select,
         struct Dial3dParams *params);
 
 #endif  /* __ED_GIZMO_LIBRARY_H__ */
index 435590cbecb5b282ab9d1498387d91adfaf67cb5..c826aacb3be173cb7a99f37391e92345803546ce 100644 (file)
@@ -1377,7 +1377,7 @@ void drawDial3d(const TransInfo *t)
                GPU_line_smooth(true);
 
                ED_gizmotypes_dial_3d_draw_util(
-                       mat_basis, mat_final, line_with, color,
+                       mat_basis, mat_final, line_with, color, false,
                        &(struct Dial3dParams){
                            .draw_options = ED_GIZMO_DIAL_DRAW_FLAG_ANGLE_VALUE,
                            .angle_delta = t->values[0],