[Bf-blender-cvs] [7e2dd7d] wiggly-widgets: Highlighting for manipulator widget.

Antony Riakiotakis noreply at git.blender.org
Wed Oct 1 17:44:52 CEST 2014


Commit: 7e2dd7d3e1841b3f5525ad85a6b1b3b63614f55d
Author: Antony Riakiotakis
Date:   Wed Oct 1 17:43:33 2014 +0200
Branches: wiggly-widgets
https://developer.blender.org/rB7e2dd7d3e1841b3f5525ad85a6b1b3b63614f55d

Highlighting for manipulator widget.

This should use an "active" system, similar to buttons to detect if last
widget has changed and act accordingly. Currently, when the active
widget changes, there is no change in highlights.

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

M	source/blender/editors/include/ED_transform.h
M	source/blender/editors/space_view3d/space_view3d.c
M	source/blender/editors/transform/transform_manipulator.c
M	source/blender/windowmanager/WM_api.h
M	source/blender/windowmanager/WM_types.h
M	source/blender/windowmanager/intern/wm_widgets.c

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

diff --git a/source/blender/editors/include/ED_transform.h b/source/blender/editors/include/ED_transform.h
index 4718353..6ad3ed4 100644
--- a/source/blender/editors/include/ED_transform.h
+++ b/source/blender/editors/include/ED_transform.h
@@ -154,8 +154,8 @@ void Transform_Properties(struct wmOperatorType *ot, int flags);
 
 int BIF_manipulator_handler(struct bContext *C, const struct wmEvent *event, struct wmWidget *widget, int active);
 void BIF_manipulator_render_3d_intersect(const struct bContext *C, struct wmWidget *widget, int selectionbase);
-void BIF_draw_manipulator(const struct bContext *C, struct wmWidget *customdata);
-bool BIF_manipulator_poll(const struct bContext *C, struct wmWidget *customdata);
+void BIF_draw_manipulator(const struct bContext *C, struct wmWidget *widget);
+bool BIF_manipulator_poll(const struct bContext *C, struct wmWidget *widget);
 
 /* Snapping */
 
diff --git a/source/blender/editors/space_view3d/space_view3d.c b/source/blender/editors/space_view3d/space_view3d.c
index 045cea2..2f3ae93 100644
--- a/source/blender/editors/space_view3d/space_view3d.c
+++ b/source/blender/editors/space_view3d/space_view3d.c
@@ -429,12 +429,14 @@ static void view3d_init(wmWindowManager *UNUSED(wm), ScrArea *UNUSED(sa))
 	
 	if (!manipulator_widget) {
 		struct wmWidgetMap *wmap = WM_widgetmap_find("View3D", SPACE_VIEW3D, RGN_TYPE_WINDOW, true);
+		int *realtimeflags = MEM_mallocN(sizeof(int), "manipulator_display_flags");
+		*realtimeflags = 0;
 		
 		manipulator_widget = WM_widget_new(BIF_manipulator_poll, 
 										   BIF_draw_manipulator, 
 										   BIF_manipulator_render_3d_intersect, 
 										   NULL, 
-										   BIF_manipulator_handler, NULL, true, true);
+										   BIF_manipulator_handler, realtimeflags, true);
 		
 		WM_widget_register(wmap, manipulator_widget);
 	}
diff --git a/source/blender/editors/transform/transform_manipulator.c b/source/blender/editors/transform/transform_manipulator.c
index a4b6eba..25e8c19 100644
--- a/source/blender/editors/transform/transform_manipulator.c
+++ b/source/blender/editors/transform/transform_manipulator.c
@@ -66,6 +66,7 @@
 #include "ED_curve.h"
 #include "ED_particle.h"
 #include "ED_view3d.h"
+#include "ED_screen.h"
 
 #include "UI_resources.h"
 
@@ -817,9 +818,10 @@ static char axisBlendAngle(float idot)
  * moving: in transform theme color
  * else the red/green/blue
  */
-static void manipulator_setcolor(View3D *v3d, char axis, int colcode, unsigned char alpha)
+static void manipulator_setcolor(View3D *v3d, char axis, int colcode, unsigned char alpha, bool highlight)
 {
 	unsigned char col[4] = {0};
+	int offset = (highlight) ? 80 : 0;
 	col[3] = alpha;
 
 	if (colcode == MAN_GHOST) {
@@ -844,13 +846,13 @@ static void manipulator_setcolor(View3D *v3d, char axis, int colcode, unsigned c
 				}
 				break;
 			case 'X':
-				UI_GetThemeColor3ubv(TH_AXIS_X, col);
+				UI_GetThemeColorShade3ubv(TH_AXIS_X, offset, col);
 				break;
 			case 'Y':
-				UI_GetThemeColor3ubv(TH_AXIS_Y, col);
+				UI_GetThemeColorShade3ubv(TH_AXIS_Y, offset, col);
 				break;
 			case 'Z':
-				UI_GetThemeColor3ubv(TH_AXIS_Z, col);
+				UI_GetThemeColorShade3ubv(TH_AXIS_Z, offset, col);
 				break;
 			default:
 				BLI_assert(0);
@@ -878,7 +880,7 @@ static void manipulator_axis_order(RegionView3D *rv3d, int r_axis_order[3])
 /* viewmatrix should have been set OK, also no shademode! */
 static void draw_manipulator_axes_single(View3D *v3d, RegionView3D *rv3d, int colcode,
                                          int flagx, int flagy, int flagz, int axis,
-                                         const int selectionbase)
+                                         const int selectionbase, int highlight)
 {
 	switch (axis) {
 		case 0:
@@ -889,7 +891,7 @@ static void draw_manipulator_axes_single(View3D *v3d, RegionView3D *rv3d, int co
 					else if (flagx & MAN_TRANS_X) GPU_select_load_id(selectionbase + MAN_SEL_TRANS_X);
 				}
 				else {
-					manipulator_setcolor(v3d, 'X', colcode, axisBlendAngle(rv3d->tw_idot[0]));
+					manipulator_setcolor(v3d, 'X', colcode, axisBlendAngle(rv3d->tw_idot[0]), (highlight & MAN_TRANS_X) != 0);
 				}
 				glBegin(GL_LINES);
 				glVertex3f(0.2f, 0.0f, 0.0f);
@@ -904,7 +906,7 @@ static void draw_manipulator_axes_single(View3D *v3d, RegionView3D *rv3d, int co
 					else if (flagy & MAN_TRANS_Y) GPU_select_load_id(selectionbase + MAN_SEL_TRANS_Y);
 				}
 				else {
-					manipulator_setcolor(v3d, 'Y', colcode, axisBlendAngle(rv3d->tw_idot[1]));
+					manipulator_setcolor(v3d, 'Y', colcode, axisBlendAngle(rv3d->tw_idot[1]), (highlight & MAN_TRANS_Y) != 0);
 				}
 				glBegin(GL_LINES);
 				glVertex3f(0.0f, 0.2f, 0.0f);
@@ -919,7 +921,7 @@ static void draw_manipulator_axes_single(View3D *v3d, RegionView3D *rv3d, int co
 					else if (flagz & MAN_TRANS_Z) GPU_select_load_id(selectionbase + MAN_SEL_TRANS_Z);
 				}
 				else {
-					manipulator_setcolor(v3d, 'Z', colcode, axisBlendAngle(rv3d->tw_idot[2]));
+					manipulator_setcolor(v3d, 'Z', colcode, axisBlendAngle(rv3d->tw_idot[2]), (highlight & MAN_TRANS_Y) != 0);
 				}
 				glBegin(GL_LINES);
 				glVertex3f(0.0f, 0.0f, 0.2f);
@@ -931,11 +933,11 @@ static void draw_manipulator_axes_single(View3D *v3d, RegionView3D *rv3d, int co
 }
 static void draw_manipulator_axes(View3D *v3d, RegionView3D *rv3d, int colcode,
                                   int flagx, int flagy, int flagz,
-                                  const int axis_order[3], const int selectionbase)
+                                  const int axis_order[3], const int selectionbase, int highlight)
 {
 	int i;
 	for (i = 0; i < 3; i++) {
-		draw_manipulator_axes_single(v3d, rv3d, colcode, flagx, flagy, flagz, axis_order[i], selectionbase);
+		draw_manipulator_axes_single(v3d, rv3d, colcode, flagx, flagy, flagz, axis_order[i], selectionbase, highlight);
 	}
 }
 
@@ -959,7 +961,7 @@ static void postOrtho(const bool ortho)
 }
 
 static void draw_manipulator_rotate(
-        View3D *v3d, RegionView3D *rv3d, const int drawflags, const int combo,
+        View3D *v3d, RegionView3D *rv3d, const int drawflags, int highlight, const int combo,
         const bool is_moving, const int selectionbase)
 {
 	double plane[4];
@@ -1055,7 +1057,7 @@ static void draw_manipulator_rotate(
 				/* axis */
 				if ((drawflags & MAN_ROT_X) || (is_moving && (drawflags & MAN_ROT_Z))) {
 					preOrthoFront(ortho, rv3d->twmat, 2);
-					manipulator_setcolor(v3d, 'X', colcode, 255);
+					manipulator_setcolor(v3d, 'X', colcode, 255, (highlight & MAN_ROT_X) != 0);
 					glBegin(GL_LINES);
 					glVertex3f(0.2f, 0.0f, 0.0f);
 					glVertex3f(1.0f, 0.0f, 0.0f);
@@ -1064,7 +1066,7 @@ static void draw_manipulator_rotate(
 				}
 				if ((drawflags & MAN_ROT_Y) || (is_moving && (drawflags & MAN_ROT_X))) {
 					preOrthoFront(ortho, rv3d->twmat, 0);
-					manipulator_setcolor(v3d, 'Y', colcode, 255);
+					manipulator_setcolor(v3d, 'Y', colcode, 255, (highlight & MAN_ROT_Y) != 0);
 					glBegin(GL_LINES);
 					glVertex3f(0.0f, 0.2f, 0.0f);
 					glVertex3f(0.0f, 1.0f, 0.0f);
@@ -1073,7 +1075,7 @@ static void draw_manipulator_rotate(
 				}
 				if ((drawflags & MAN_ROT_Z) || (is_moving && (drawflags & MAN_ROT_Y))) {
 					preOrthoFront(ortho, rv3d->twmat, 1);
-					manipulator_setcolor(v3d, 'Z', colcode, 255);
+					manipulator_setcolor(v3d, 'Z', colcode, 255, (highlight & MAN_ROT_Y) != 0);
 					glBegin(GL_LINES);
 					glVertex3f(0.0f, 0.0f, 0.2f);
 					glVertex3f(0.0f, 0.0f, 1.0f);
@@ -1090,7 +1092,7 @@ static void draw_manipulator_rotate(
 		if (drawflags & MAN_ROT_Z) {
 			preOrthoFront(ortho, matt, 2);
 			if (selectionbase != -1) GPU_select_load_id(selectionbase + MAN_SEL_ROT_Z);
-			else manipulator_setcolor(v3d, 'Z', colcode, 255);
+			else manipulator_setcolor(v3d, 'Z', colcode, 255, (highlight & MAN_ROT_Z) != 0);
 			drawcircball(GL_LINE_LOOP, unitmat[3], 1.0, unitmat);
 			postOrtho(ortho);
 		}
@@ -1098,7 +1100,7 @@ static void draw_manipulator_rotate(
 		if (drawflags & MAN_ROT_X) {
 			preOrthoFront(ortho, matt, 0);
 			if (selectionbase != -1) GPU_select_load_id(selectionbase + MAN_SEL_ROT_X);
-			else manipulator_setcolor(v3d, 'X', colcode, 255);
+			else manipulator_setcolor(v3d, 'X', colcode, 255, (highlight & MAN_ROT_X) != 0);
 			glRotatef(90.0, 0.0, 1.0, 0.0);
 			drawcircball(GL_LINE_LOOP, unitmat[3], 1.0, unitmat);
 			glRotatef(-90.0, 0.0, 1.0, 0.0);
@@ -1108,7 +1110,7 @@ static void draw_manipulator_rotate(
 		if (drawflags & MAN_ROT_Y) {
 			preOrthoFront(ortho, matt, 1);
 			if (selectionbase != -1) GPU_select_load_id(selectionbase + MAN_SEL_ROT_Y);
-			else manipulator_setcolor(v3d, 'Y', colcode, 255);
+			else manipulator_setcolor(v3d, 'Y', colcode, 255, (highlight & MAN_ROT_Y) != 0);
 			glRotatef(-90.0, 1.0, 0.0, 0.0);
 			drawcircball(GL_LINE_LOOP, unitmat[3], 1.0, unitmat);
 			glRotatef(90.0, 1.0, 0.0, 0.0);
@@ -1125,7 +1127,7 @@ static void draw_manipulator_rotate(
 		if (drawflags & MAN_ROT_Z) {
 			preOrthoFront(ortho, rv3d->twmat, 2);
 			if (selectionbase != -1) GPU_select_load_id(selectionbase + MAN_SEL_ROT_Z);
-			else manipulator_setcolor(v3d, 'Z', colcode, 255);
+			else manipulator_setcolor(v3d, 'Z', colcode, 255, (highlight & MAN_ROT_Z) != 0);
 			partial_doughnut(cusize / 4.0f, 1.0f, 0, 48, 8, 48);
 			postOrtho(ortho);
 		}
@@ -1133,7 +1135,7 @@ static void draw_manipulator_rotate(
 		if (drawflags & MAN_ROT_X) {
 			preOrthoFront(ortho, rv3d->twmat, 0);
 			if (selectionbase != -1) GPU_select_load_id(selectionbase + MAN_SEL_ROT_X);
-			else manipulator_setcolor(v3d, 'X', colcode, 255);
+			else manipulator_setcolor(v3d, 'X', colcode, 255, (highlight & MAN_ROT_X) != 0);
 			glRotatef(90.0, 0.0, 1.0, 0.0);
 			partial_doughnut(cusize / 4.0f, 1.0f, 0, 48, 8, 48);
 			glRotatef(-90.0, 0.0, 1.0, 0.0);
@@ -1143,7 +1145,7 @@ static void draw_manipulator_rotate(
 		if (drawflags & MAN_ROT_Y) {
 			preOrthoFront(ortho, rv3d->twmat, 1);
 			if (selectionbase != -1) GPU_select_load_id(selectionbase + MAN_SEL_ROT_Y);
-			else manipulator_setcolor(v3d, 'Y', colcode, 255);
+			else manipulator_setcolor(v3d, 'Y', colcode, 255, (highlight & MAN_ROT_Y) != 0);
 			glRotatef(-90.0, 1.0, 0.0, 0.0);
 			partial_doughnut(cusize / 4.0f, 1.0f, 0, 4

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list