[Bf-blender-cvs] [bffa57e6d83] blender2.8: Manipulator: Fix arrow2d drawing outside hotspot
Campbell Barton
noreply at git.blender.org
Tue Sep 5 16:37:43 CEST 2017
Commit: bffa57e6d83d157cb81a631a92cd20e7958a69a4
Author: Campbell Barton
Date: Wed Sep 6 00:40:20 2017 +1000
Branches: blender2.8
https://developer.blender.org/rBbffa57e6d83d157cb81a631a92cd20e7958a69a4
Manipulator: Fix arrow2d drawing outside hotspot
===================================================================
M source/blender/editors/manipulator_library/manipulator_types/arrow2d_manipulator.c
===================================================================
diff --git a/source/blender/editors/manipulator_library/manipulator_types/arrow2d_manipulator.c b/source/blender/editors/manipulator_library/manipulator_types/arrow2d_manipulator.c
index c789e6a13b0..44dd5698a48 100644
--- a/source/blender/editors/manipulator_library/manipulator_types/arrow2d_manipulator.c
+++ b/source/blender/editors/manipulator_library/manipulator_types/arrow2d_manipulator.c
@@ -63,8 +63,10 @@
static void arrow2d_draw_geom(wmManipulator *mpr, const float matrix[4][4], const float color[4])
{
const float size = 0.11f;
- const float size_h = size / 2.0f;
- const float arrow_length = RNA_float_get(mpr->ptr, "length");
+ const float size_breadth = size / 2.0f;
+ const float size_length = size * 1.7f;
+ /* Subtract the length so the arrow fits in the hotspot. */
+ const float arrow_length = RNA_float_get(mpr->ptr, "length") - size_length;
const float arrow_angle = RNA_float_get(mpr->ptr, "angle");
uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
@@ -83,9 +85,9 @@ static void arrow2d_draw_geom(wmManipulator *mpr, const float matrix[4][4], cons
immEnd();
immBegin(GWN_PRIM_TRIS, 3);
- immVertex2f(pos, size_h, arrow_length);
- immVertex2f(pos, -size_h, arrow_length);
- immVertex2f(pos, 0.0f, arrow_length + size * 1.7f);
+ immVertex2f(pos, size_breadth, arrow_length);
+ immVertex2f(pos, -size_breadth, arrow_length);
+ immVertex2f(pos, 0.0f, arrow_length + size_length);
immEnd();
immUnbindProgram();
More information about the Bf-blender-cvs
mailing list