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:
authorDalai Felinto <dfelinto@gmail.com>2018-05-03 13:57:34 +0300
committerDalai Felinto <dfelinto@gmail.com>2018-05-03 14:05:38 +0300
commit9c78d9ba9f169005527ba77d1f758fd1d3ebeb42 (patch)
tree5bb9a8f6c92a4f644398ad4129bf3b0c9c0c5e69
parentecb143fe5d8b1713af26a1da808849324af0b5bd (diff)
Fix pose transformation helper lines
This was broken since 33bb8b785a9 (triple-buffer changes). This also helps help lines as a whole.
-rw-r--r--source/blender/editors/transform/transform.c29
1 files changed, 24 insertions, 5 deletions
diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c
index 28c2ea3b824..4b415ffde9e 100644
--- a/source/blender/editors/transform/transform.c
+++ b/source/blender/editors/transform/transform.c
@@ -1717,10 +1717,29 @@ static void drawHelpline(bContext *UNUSED(C), int x, int y, void *customdata)
if (t->helpline != HLP_NONE) {
float cent[2];
- float mval[3] = { x, y, 0.0f };
+ float mval[3] = {
+ x,
+ y,
+ 0.0f,
+ };
+ float tmval[2] = {
+ (float)t->mval[0],
+ (float)t->mval[1],
+ };
projectFloatViewEx(t, t->center_global, cent, V3D_PROJ_TEST_CLIP_ZERO);
+ /* Offset the values for the area region. */
+ const float offset[2] = {
+ t->ar->winrct.xmin,
+ t->ar->winrct.ymin,
+ };
+
+ for (int i = 0; i < 2; i++) {
+ cent[i] += offset[i];
+ tmval[i] += offset[i];
+ }
+
gpuPushMatrix();
/* Dashed lines first. */
@@ -1745,7 +1764,7 @@ static void drawHelpline(bContext *UNUSED(C), int x, int y, void *customdata)
immBegin(GWN_PRIM_LINES, 2);
immVertex2fv(POS_INDEX, cent);
- immVertex2f(POS_INDEX, (float)t->mval[0], (float)t->mval[1]);
+ immVertex2f(POS_INDEX, tmval[0], tmval[1]);
immEnd();
immUnbindProgram();
@@ -1762,7 +1781,7 @@ static void drawHelpline(bContext *UNUSED(C), int x, int y, void *customdata)
immUniformThemeColor(TH_VIEW_OVERLAY);
gpuTranslate3fv(mval);
- gpuRotateAxis(-RAD2DEGF(atan2f(cent[0] - t->mval[0], cent[1] - t->mval[1])), 'Z');
+ gpuRotateAxis(-RAD2DEGF(atan2f(cent[0] - tmval[0], cent[1] - tmval[1])), 'Z');
glLineWidth(3.0f);
drawArrow(UP, 5, 10, 5);
@@ -1787,7 +1806,7 @@ static void drawHelpline(bContext *UNUSED(C), int x, int y, void *customdata)
break;
case HLP_ANGLE:
{
- float dx = t->mval[0] - cent[0], dy = t->mval[1] - cent[1];
+ float dx = tmval[0] - cent[0], dy = tmval[1] - cent[1];
float angle = atan2f(dy, dx);
float dist = hypotf(dx, dy);
float delta_angle = min_ff(15.0f / dist, (float)M_PI / 4.0f);
@@ -1795,7 +1814,7 @@ static void drawHelpline(bContext *UNUSED(C), int x, int y, void *customdata)
immUniformThemeColor(TH_VIEW_OVERLAY);
- gpuTranslate3f(cent[0] - t->mval[0] + mval[0], cent[1] - t->mval[1] + mval[1], 0);
+ gpuTranslate3f(cent[0] - tmval[0] + mval[0], cent[1] - tmval[1] + mval[1], 0);
glLineWidth(3.0f);
drawArc(dist, angle - delta_angle, angle - spacing_angle, 10);