[Bf-blender-cvs] [01850f0928c] blender2.8: Manipulator: 3D view navigation improvements

Campbell Barton noreply at git.blender.org
Tue Dec 19 05:27:15 CET 2017


Commit: 01850f0928c58bab4258c2db94057bb8101523fe
Author: Campbell Barton
Date:   Tue Dec 19 15:20:05 2017 +1100
Branches: blender2.8
https://developer.blender.org/rB01850f0928c58bab4258c2db94057bb8101523fe

Manipulator: 3D view navigation improvements

- Highlight's were too intense/distracting
  use more subtle alpha (consistent with the rest of our UI).
- Don't fill center cube (only draw edges).
- Draw widget while interacting since this is helpful in some cases.

Thanks to @jbakker for suggestions.

Also change axis hotspots so the nearest is always selected
for quicker axis picking (relies on dragging any axis to orbit).

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

M	source/blender/editors/space_view3d/view3d_manipulator_navigate.c
M	source/blender/editors/space_view3d/view3d_manipulator_navigate_type.c

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

diff --git a/source/blender/editors/space_view3d/view3d_manipulator_navigate.c b/source/blender/editors/space_view3d/view3d_manipulator_navigate.c
index b2a434174d9..5d9eaafdbec 100644
--- a/source/blender/editors/space_view3d/view3d_manipulator_navigate.c
+++ b/source/blender/editors/space_view3d/view3d_manipulator_navigate.c
@@ -127,9 +127,9 @@ static void WIDGETGROUP_navigate_setup(const bContext *UNUSED(C), wmManipulatorG
 		const struct NavigateManipulatorInfo *info = &g_navigate_params[i];
 		navgroup->mpr_array[i] = WM_manipulator_new(info->manipulator, mgroup, NULL);
 		wmManipulator *mpr = navgroup->mpr_array[i];
-		mpr->flag |= WM_MANIPULATOR_GRAB_CURSOR;
-		copy_v3_fl(mpr->color, 1.0f);
-		mpr->color[3] = 0.4f;
+		mpr->flag |= WM_MANIPULATOR_GRAB_CURSOR | WM_MANIPULATOR_DRAW_MODAL;
+		mpr->color[3] = 0.2f;
+		mpr->color_hi[3] = 0.4f;
 
 		/* may be overwritten later */
 		mpr->scale_basis = (MANIPULATOR_SIZE * MANIPULATOR_MINI_FAC) / 2;
@@ -223,7 +223,8 @@ void VIEW3D_WGT_navigate(wmManipulatorGroupType *wgt)
 	wgt->idname = "VIEW3D_WGT_navigate";
 
 	wgt->flag |= (WM_MANIPULATORGROUPTYPE_PERSISTENT |
-	              WM_MANIPULATORGROUPTYPE_SCALE);
+	              WM_MANIPULATORGROUPTYPE_SCALE |
+	              WM_MANIPULATORGROUPTYPE_DRAW_MODAL_ALL);
 
 	wgt->poll = WIDGETGROUP_navigate_poll;
 	wgt->setup = WIDGETGROUP_navigate_setup;
diff --git a/source/blender/editors/space_view3d/view3d_manipulator_navigate_type.c b/source/blender/editors/space_view3d/view3d_manipulator_navigate_type.c
index aac13339b6b..b859b3b24dd 100644
--- a/source/blender/editors/space_view3d/view3d_manipulator_navigate_type.c
+++ b/source/blender/editors/space_view3d/view3d_manipulator_navigate_type.c
@@ -98,6 +98,7 @@ static void axis_geom_draw(
 
 	const float scale_axis = 0.25f;
 	static const float axis_highlight[4] = {1, 1, 1, 1};
+	static const float axis_nop[4] = {1, 1, 1, 0};
 	static const float axis_black[4] = {0, 0, 0, 1};
 	static float axis_color[3][4];
 	gpuPushMatrix();
@@ -138,7 +139,8 @@ static void axis_geom_draw(
 				glEnable(GL_LINE_SMOOTH);
 				glEnable(GL_BLEND);
 				glLineWidth(1.0f);
-				immUniformColor4fv(axis_highlight);
+				/* Just draw depth values. */
+				immUniformColor4fv(axis_nop);
 				imm_draw_cube_fill_3d(pos_id, center, size);
 				immUniformColor4fv(axis_black);
 				madd_v3_v3fl(
@@ -224,7 +226,7 @@ static void axis3d_draw_intern(
 static void manipulator_axis_draw(const bContext *C, wmManipulator *mpr)
 {
 	const bool is_modal = mpr->state & WM_MANIPULATOR_STATE_MODAL;
-	const bool is_highlight = (mpr->state & WM_MANIPULATOR_STATE_HIGHLIGHT) != 0 && (mpr->highlight_part == 0);
+	const bool is_highlight = (mpr->state & WM_MANIPULATOR_STATE_HIGHLIGHT) != 0;
 
 	(void)is_modal;
 
@@ -241,13 +243,14 @@ static int manipulator_axis_test_select(
 	mul_v2_fl(point_local, 1.0f / mpr->scale_basis);
 
 	const float len_sq = len_squared_v2(point_local);
-	if (len_sq > SQUARE(1.0 + HANDLE_SIZE)) {
+	if (len_sq > 1.0) {
 		return -1;
 	}
 
 	int part_best = -1;
 	int part_index = 1;
-	float i_best_len_sq = SQUARE(HANDLE_SIZE);
+	/* Use 'SQUARE(HANDLE_SIZE)' if we want to be able to _not_ focus on one of the axis. */
+	float i_best_len_sq = FLT_MAX;
 	for (int i = 0; i < 3; i++) {
 		for (int is_pos = 0; is_pos < 2; is_pos++) {
 			float co[2] = {



More information about the Bf-blender-cvs mailing list