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
path: root/source
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2018-10-17 09:12:57 +0300
committerCampbell Barton <ideasman42@gmail.com>2018-10-17 09:14:36 +0300
commit9273b91eefdd0f58679470735e84d95fd59ea44c (patch)
tree5f3dfcf443a702b71a6c6335a3c5dea9a42835ae /source
parent7ce387b1cd4581961ee4cc9db2e23b00cc9ad9d9 (diff)
Transform: show arrows for 'custom' ratio input
Arrows are now shown for vertex/edge slide.
Diffstat (limited to 'source')
-rw-r--r--source/blender/editors/transform/transform.c23
-rw-r--r--source/blender/editors/transform/transform.h3
-rw-r--r--source/blender/editors/transform/transform_input.c5
3 files changed, 28 insertions, 3 deletions
diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c
index 49de222144f..989e7e9c924 100644
--- a/source/blender/editors/transform/transform.c
+++ b/source/blender/editors/transform/transform.c
@@ -1926,6 +1926,29 @@ static void drawHelpline(bContext *C, int x, int y, void *customdata)
drawArrow(UP, 5, 10, 5);
drawArrow(DOWN, 5, 10, 5);
break;
+ case HLP_CARROW:
+ {
+ /* Draw arrow based on direction defined by custom-points. */
+ immUniformThemeColor(TH_VIEW_OVERLAY);
+
+ GPU_matrix_translate_3fv(mval);
+
+ GPU_line_width(3.0f);
+
+ const int *data = t->mouse.data;
+ const float dx = data[2] - data[0], dy = data[3] - data[1];
+ const float angle = -atan2f(dx, dy);
+
+ GPU_matrix_push();
+
+ GPU_matrix_rotate_axis(RAD2DEGF(angle), 'Z');
+
+ drawArrow(UP, 5, 10, 5);
+ drawArrow(DOWN, 5, 10, 5);
+
+ GPU_matrix_pop();
+ break;
+ }
case HLP_ANGLE:
{
float dx = tmval[0] - cent[0], dy = tmval[1] - cent[1];
diff --git a/source/blender/editors/transform/transform.h b/source/blender/editors/transform/transform.h
index 06ae7a87212..7d981f86e38 100644
--- a/source/blender/editors/transform/transform.h
+++ b/source/blender/editors/transform/transform.h
@@ -633,7 +633,8 @@ typedef struct TransInfo {
#define HLP_ANGLE 2
#define HLP_HARROW 3
#define HLP_VARROW 4
-#define HLP_TRACKBALL 5
+#define HLP_CARROW 5
+#define HLP_TRACKBALL 6
/* transinfo->con->mode */
#define CON_APPLY 1
diff --git a/source/blender/editors/transform/transform_input.c b/source/blender/editors/transform/transform_input.c
index 5b5c4902377..971b9f74c65 100644
--- a/source/blender/editors/transform/transform_input.c
+++ b/source/blender/editors/transform/transform_input.c
@@ -332,11 +332,11 @@ void initMouseInputMode(TransInfo *t, MouseInput *mi, MouseInputMode mode)
break;
case INPUT_CUSTOM_RATIO:
mi->apply = InputCustomRatio;
- t->helpline = HLP_NONE;
+ t->helpline = HLP_CARROW;
break;
case INPUT_CUSTOM_RATIO_FLIP:
mi->apply = InputCustomRatioFlip;
- t->helpline = HLP_NONE;
+ t->helpline = HLP_CARROW;
break;
case INPUT_NONE:
default:
@@ -360,6 +360,7 @@ void initMouseInputMode(TransInfo *t, MouseInput *mi, MouseInputMode mode)
case HLP_TRACKBALL:
case HLP_HARROW:
case HLP_VARROW:
+ case HLP_CARROW:
if (t->flag & T_MODAL) {
t->flag |= T_MODAL_CURSOR_SET;
WM_cursor_modal_set(win, CURSOR_NONE);