From b67c3a0db9173ac400b1d0593a72f2aa23c66bab Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 25 Mar 2019 15:40:23 +1100 Subject: Gizmo: add option to move & dial gizmos to select as filled Draw as an outline while using solid selection. --- .../blender/editors/gizmo_library/gizmo_types/dial3d_gizmo.c | 12 +++++++++--- .../blender/editors/gizmo_library/gizmo_types/move3d_gizmo.c | 7 ++++++- source/blender/editors/include/ED_gizmo_library.h | 11 +++++++---- source/blender/editors/transform/transform_gizmo_3d.c | 2 +- 4 files changed, 23 insertions(+), 9 deletions(-) (limited to 'source/blender') diff --git a/source/blender/editors/gizmo_library/gizmo_types/dial3d_gizmo.c b/source/blender/editors/gizmo_library/gizmo_types/dial3d_gizmo.c index b5be45bb63f..9072ced0bd1 100644 --- a/source/blender/editors/gizmo_library/gizmo_types/dial3d_gizmo.c +++ b/source/blender/editors/gizmo_library/gizmo_types/dial3d_gizmo.c @@ -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", ""}, diff --git a/source/blender/editors/gizmo_library/gizmo_types/move3d_gizmo.c b/source/blender/editors/gizmo_library/gizmo_types/move3d_gizmo.c index 0fe5a4e7d80..3870ce984b5 100644 --- a/source/blender/editors/gizmo_library/gizmo_types/move3d_gizmo.c +++ b/source/blender/editors/gizmo_library/gizmo_types/move3d_gizmo.c @@ -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}, }; diff --git a/source/blender/editors/include/ED_gizmo_library.h b/source/blender/editors/include/ED_gizmo_library.h index 53b65292b6a..48effda37ef 100644 --- a/source/blender/editors/include/ED_gizmo_library.h +++ b/source/blender/editors/include/ED_gizmo_library.h @@ -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__ */ diff --git a/source/blender/editors/transform/transform_gizmo_3d.c b/source/blender/editors/transform/transform_gizmo_3d.c index 435590cbecb..c826aacb3be 100644 --- a/source/blender/editors/transform/transform_gizmo_3d.c +++ b/source/blender/editors/transform/transform_gizmo_3d.c @@ -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], -- cgit v1.2.3