[Bf-blender-cvs] [9273b91eefd] blender2.8: Transform: show arrows for 'custom' ratio input

Campbell Barton noreply at git.blender.org
Wed Oct 17 08:19:15 CEST 2018


Commit: 9273b91eefdd0f58679470735e84d95fd59ea44c
Author: Campbell Barton
Date:   Wed Oct 17 17:12:57 2018 +1100
Branches: blender2.8
https://developer.blender.org/rB9273b91eefdd0f58679470735e84d95fd59ea44c

Transform: show arrows for 'custom' ratio input

Arrows are now shown for vertex/edge slide.

===================================================================

M	source/blender/editors/transform/transform.c
M	source/blender/editors/transform/transform.h
M	source/blender/editors/transform/transform_input.c

===================================================================

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);



More information about the Bf-blender-cvs mailing list