[Bf-blender-cvs] [22ac20a7050] blender2.8: WM: option not to draw arrow manipulator stem
Campbell Barton
noreply at git.blender.org
Thu Jun 14 09:27:11 CEST 2018
Commit: 22ac20a70505ed50eaedb72f7fa073f49bf5f002
Author: Campbell Barton
Date: Thu Jun 14 09:25:55 2018 +0200
Branches: blender2.8
https://developer.blender.org/rB22ac20a70505ed50eaedb72f7fa073f49bf5f002
WM: option not to draw arrow manipulator stem
===================================================================
M source/blender/editors/include/ED_manipulator_library.h
M source/blender/editors/manipulator_library/manipulator_types/arrow3d_manipulator.c
===================================================================
diff --git a/source/blender/editors/include/ED_manipulator_library.h b/source/blender/editors/include/ED_manipulator_library.h
index e8eeb0f1d7a..fca0f5c8806 100644
--- a/source/blender/editors/include/ED_manipulator_library.h
+++ b/source/blender/editors/include/ED_manipulator_library.h
@@ -73,6 +73,7 @@ enum {
ED_MANIPULATOR_ARROW_STYLE_CONE = 3,
};
+/* transform */
enum {
/* inverted offset during interaction - if set it also sets constrained below */
ED_MANIPULATOR_ARROW_XFORM_FLAG_INVERTED = (1 << 3),
@@ -80,6 +81,12 @@ enum {
ED_MANIPULATOR_ARROW_XFORM_FLAG_CONSTRAINED = (1 << 4),
};
+/* draw_options */
+enum {
+ /* Show arrow stem. */
+ ED_MANIPULATOR_ARROW_DRAW_FLAG_STEM = (1 << 0),
+};
+
void ED_manipulator_arrow3d_set_ui_range(struct wmManipulator *mpr, const float min, const float max);
void ED_manipulator_arrow3d_set_range_fac(struct wmManipulator *mpr, const float range_fac);
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);
More information about the Bf-blender-cvs
mailing list