Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2019-12-13 11:33:49 +0300
committerCampbell Barton <ideasman42@gmail.com>2019-12-13 14:43:48 +0300
commit82755f5137061bbd1b41096946881052a5dae802 (patch)
tree81bef3c7e5b6c55383c38f7d32301ceaff041a73 /source/blender/editors/gizmo_library
parentec62413f803ee506633f0e52d1e52b0980c0ed0d (diff)
Gizmo: add gizmos for UV transform translate/rotate/scale
Diffstat (limited to 'source/blender/editors/gizmo_library')
-rw-r--r--source/blender/editors/gizmo_library/gizmo_types/arrow2d_gizmo.c32
1 files changed, 27 insertions, 5 deletions
diff --git a/source/blender/editors/gizmo_library/gizmo_types/arrow2d_gizmo.c b/source/blender/editors/gizmo_library/gizmo_types/arrow2d_gizmo.c
index 24571f67fdb..1c8c46a2bad 100644
--- a/source/blender/editors/gizmo_library/gizmo_types/arrow2d_gizmo.c
+++ b/source/blender/editors/gizmo_library/gizmo_types/arrow2d_gizmo.c
@@ -52,6 +52,7 @@
static void arrow2d_draw_geom(wmGizmo *gz, const float matrix[4][4], const float color[4])
{
+ const int draw_style = RNA_enum_get(gz->ptr, "draw_style");
const float size = 0.11f;
const float size_breadth = size / 2.0f;
const float size_length = size * 1.7f;
@@ -74,11 +75,21 @@ static void arrow2d_draw_geom(wmGizmo *gz, const float matrix[4][4], const float
immVertex2f(pos, 0.0f, arrow_length);
immEnd();
- immBegin(GPU_PRIM_TRIS, 3);
- immVertex2f(pos, size_breadth, arrow_length);
- immVertex2f(pos, -size_breadth, arrow_length);
- immVertex2f(pos, 0.0f, arrow_length + size_length);
- immEnd();
+ if (draw_style == ED_GIZMO_ARROW_STYLE_BOX) {
+ immBegin(GPU_PRIM_TRI_FAN, 4);
+ immVertex2f(pos, -size / 2, arrow_length);
+ immVertex2f(pos, size / 2, arrow_length);
+ immVertex2f(pos, size / 2, arrow_length + size);
+ immVertex2f(pos, -size / 2, arrow_length + size);
+ immEnd();
+ }
+ else {
+ immBegin(GPU_PRIM_TRIS, 3);
+ immVertex2f(pos, size_breadth, arrow_length);
+ immVertex2f(pos, -size_breadth, arrow_length);
+ immVertex2f(pos, 0.0f, arrow_length + size_length);
+ immEnd();
+ }
immUnbindProgram();
@@ -197,6 +208,11 @@ static void GIZMO_GT_arrow_2d(wmGizmoType *gzt)
gzt->struct_size = sizeof(wmGizmo);
/* rna */
+ static EnumPropertyItem rna_enum_draw_style_items[] = {
+ {ED_GIZMO_ARROW_STYLE_NORMAL, "NORMAL", 0, "Normal", ""},
+ {ED_GIZMO_ARROW_STYLE_BOX, "BOX", 0, "Box", ""},
+ {0, NULL, 0, NULL, NULL},
+ };
RNA_def_float(gzt->srna, "length", 1.0f, 0.0f, FLT_MAX, "Arrow Line Length", "", 0.0f, FLT_MAX);
RNA_def_float_rotation(gzt->srna,
"angle",
@@ -208,6 +224,12 @@ static void GIZMO_GT_arrow_2d(wmGizmoType *gzt)
"",
DEG2RADF(-360.0f),
DEG2RADF(360.0f));
+ RNA_def_enum(gzt->srna,
+ "draw_style",
+ rna_enum_draw_style_items,
+ ED_GIZMO_ARROW_STYLE_NORMAL,
+ "Draw Style",
+ "");
}
void ED_gizmotypes_arrow_2d(void)