diff options
author | Campbell Barton <ideasman42@gmail.com> | 2018-06-14 10:25:55 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2018-06-14 10:25:55 +0300 |
commit | 22ac20a70505ed50eaedb72f7fa073f49bf5f002 (patch) | |
tree | 3831e40905a438f213c607e6a68cef7cfa0ed3eb /source/blender/editors/manipulator_library | |
parent | eeca206e762e8d71f88352ec279cff60872b0ade (diff) |
WM: option not to draw arrow manipulator stem
Diffstat (limited to 'source/blender/editors/manipulator_library')
-rw-r--r-- | source/blender/editors/manipulator_library/manipulator_types/arrow3d_manipulator.c | 29 |
1 files changed, 24 insertions, 5 deletions
diff --git a/source/blender/editors/manipulator_library/manipulator_types/arrow3d_manipulator.c b/source/blender/editors/manipulator_library/manipulator_types/arrow3d_manipulator.c index 9ab8b6a9f7c..8516b9d8244 100644 --- a/source/blender/editors/manipulator_library/manipulator_types/arrow3d_manipulator.c +++ b/source/blender/editors/manipulator_library/manipulator_types/arrow3d_manipulator.c @@ -92,6 +92,7 @@ static void arrow_draw_geom(const ArrowManipulator3D *arrow, const bool select, uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); bool unbind_shader = true; const int draw_style = RNA_enum_get(arrow->manipulator.ptr, "draw_style"); + const int draw_options = RNA_enum_get(arrow->manipulator.ptr, "draw_options"); immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); @@ -131,9 +132,13 @@ static void arrow_draw_geom(const ArrowManipulator3D *arrow, const bool select, {0.0f, 0.0f, arrow_length}, }; - glLineWidth(arrow->manipulator.line_width); - wm_manipulator_vec_draw(color, vec, ARRAY_SIZE(vec), pos, GWN_PRIM_LINE_STRIP); - + if (draw_options & ED_MANIPULATOR_ARROW_DRAW_FLAG_STEM) { + glLineWidth(arrow->manipulator.line_width); + wm_manipulator_vec_draw(color, vec, ARRAY_SIZE(vec), pos, GWN_PRIM_LINE_STRIP); + } + else { + immUniformColor4fv(color); + } /* *** draw arrow head *** */ @@ -455,14 +460,28 @@ static void MANIPULATOR_WT_arrow_3d(wmManipulatorType *wt) {ED_MANIPULATOR_ARROW_STYLE_CONE, "CONE", 0, "Cone", ""}, {0, NULL, 0, NULL, NULL} }; + static EnumPropertyItem rna_enum_draw_options_items[] = { + {ED_MANIPULATOR_ARROW_DRAW_FLAG_STEM, "STEM", 0, "Stem", ""}, + {0, NULL, 0, NULL, NULL} + }; static EnumPropertyItem rna_enum_transform_items[] = { {ED_MANIPULATOR_ARROW_XFORM_FLAG_INVERTED, "INVERT", 0, "Inverted", ""}, {ED_MANIPULATOR_ARROW_XFORM_FLAG_CONSTRAINED, "CONSTRAIN", 0, "Constrained", ""}, {0, NULL, 0, NULL, NULL} }; - RNA_def_enum(wt->srna, "draw_style", rna_enum_draw_style_items, ED_MANIPULATOR_ARROW_STYLE_NORMAL, "Draw Style", ""); - RNA_def_enum_flag(wt->srna, "transform", rna_enum_transform_items, 0, "Transform", ""); + RNA_def_enum( + wt->srna, "draw_style", rna_enum_draw_style_items, + ED_MANIPULATOR_ARROW_STYLE_NORMAL, + "Draw Style", ""); + RNA_def_enum_flag( + wt->srna, "draw_options", rna_enum_draw_options_items, + ED_MANIPULATOR_ARROW_DRAW_FLAG_STEM, + "Draw Options", ""); + RNA_def_enum_flag( + wt->srna, "transform", rna_enum_transform_items, + 0, + "Transform", ""); RNA_def_float(wt->srna, "length", 1.0f, 0.0f, FLT_MAX, "Arrow Line Length", "", 0.0f, FLT_MAX); RNA_def_float_vector(wt->srna, "aspect", 2, NULL, 0, FLT_MAX, "Aspect", "Cone/box style only", 0.0f, FLT_MAX); |