[Bf-blender-cvs] [da53eb3748b] blender2.8: Manipulator: tweak shape drawing

Campbell Barton noreply at git.blender.org
Sat Jan 20 09:32:16 CET 2018


Commit: da53eb3748b42a5d77e1074b767dbd64d79ccc4a
Author: Campbell Barton
Date:   Sat Jan 20 19:41:41 2018 +1100
Branches: blender2.8
https://developer.blender.org/rBda53eb3748b42a5d77e1074b767dbd64d79ccc4a

Manipulator: tweak shape drawing

Draw triangles over wire for a more subtle outline.

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

M	source/blender/editors/manipulator_library/manipulator_types/button2d_manipulator.c
M	source/blender/editors/space_view3d/view3d_manipulator_navigate.c

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

diff --git a/source/blender/editors/manipulator_library/manipulator_types/button2d_manipulator.c b/source/blender/editors/manipulator_library/manipulator_types/button2d_manipulator.c
index 2951ad84c0d..ce6992e7ad9 100644
--- a/source/blender/editors/manipulator_library/manipulator_types/button2d_manipulator.c
+++ b/source/blender/editors/manipulator_library/manipulator_types/button2d_manipulator.c
@@ -114,8 +114,8 @@ static void button2d_draw_intern(
 			/* We shouldn't need the +1, but a NULL char is set. */
 			char *polys = MEM_mallocN(polys_len + 1, __func__);
 			RNA_property_string_get(mpr->ptr, prop, polys);
-			button->shape_batch[0] = GPU_batch_tris_from_poly_2d_encoded((uchar *)polys, polys_len, NULL);
-			button->shape_batch[1] = GPU_batch_wire_from_poly_2d_encoded((uchar *)polys, polys_len, NULL);
+			button->shape_batch[0] = GPU_batch_wire_from_poly_2d_encoded((uchar *)polys, polys_len, NULL);
+			button->shape_batch[1] = GPU_batch_tris_from_poly_2d_encoded((uchar *)polys, polys_len, NULL);
 			MEM_freeN(polys);
 		}
 	}
@@ -137,17 +137,17 @@ static void button2d_draw_intern(
 			glEnable(GL_LINE_SMOOTH);
 			glLineWidth(1.0f);
 			for (uint i = 0; i < ARRAY_SIZE(button->shape_batch) && button->shape_batch[i]; i++) {
+				/* Invert line color for wire. */
+				color[0] = 1.0f - color[0];
+				color[1] = 1.0f - color[1];
+				color[2] = 1.0f - color[2];
+
 				GWN_batch_program_set_builtin(button->shape_batch[i], GPU_SHADER_2D_UNIFORM_COLOR);
 				GWN_batch_uniform_4f(button->shape_batch[i], "color", UNPACK4(color));
 				GWN_batch_draw(button->shape_batch[i]);
-				if (i == 0) {
-					/* Invert line color. */
-					color[0] = 1.0f - color[0];
-					color[1] = 1.0f - color[1];
-					color[2] = 1.0f - color[2];
-				}
 			}
 			glDisable(GL_POLYGON_SMOOTH);
+			glDisable(GL_LINE_SMOOTH);
 			gpuPopMatrix();
 		}
 		else if (button->icon != ICON_NONE) {
diff --git a/source/blender/editors/space_view3d/view3d_manipulator_navigate.c b/source/blender/editors/space_view3d/view3d_manipulator_navigate.c
index 3fc3300e2c1..0f7df8fe6aa 100644
--- a/source/blender/editors/space_view3d/view3d_manipulator_navigate.c
+++ b/source/blender/editors/space_view3d/view3d_manipulator_navigate.c
@@ -201,7 +201,6 @@ static void WIDGETGROUP_navigate_setup(const bContext *UNUSED(C), wmManipulatorG
 			        mpr->ptr, prop,
 			        (const char *)info->shape, info->shape_size);
 			/* don't fade icons so much */
-			copy_v3_fl(mpr->color, 0.0f);
 			mpr->color[3] = 0.5f;
 		}



More information about the Bf-blender-cvs mailing list