[Bf-blender-cvs] [a25d3d7] blender2.8: Viewport: Set outline color for mesh based on active/select state

Dalai Felinto noreply at git.blender.org
Wed Oct 26 16:00:27 CEST 2016


Commit: a25d3d7de27d5c2cd5028bf24df368faf7b5e419
Author: Dalai Felinto
Date:   Wed Oct 26 12:13:12 2016 +0000
Branches: blender2.8
https://developer.blender.org/rBa25d3d7de27d5c2cd5028bf24df368faf7b5e419

Viewport: Set outline color for mesh based on active/select state

(also, fix warning regarding const float being written)

You only see the color if you use the "modern" viewport option
(otherwise I believe Blender is drawing the old on top of the new outline).

That said, in the "modern" viewport we have unfreed mem. To be
investigated separately.

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

M	source/blender/editors/space_view3d/drawobject.c

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

diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c
index 459f17d..1ca7524 100644
--- a/source/blender/editors/space_view3d/drawobject.c
+++ b/source/blender/editors/space_view3d/drawobject.c
@@ -4257,7 +4257,7 @@ void draw_mesh_object_outline(View3D *v3d, Object *ob, DerivedMesh *dm) /* LEGAC
 	}
 }
 
-static void draw_mesh_object_outline_new(View3D *v3d, RegionView3D *rv3d, Object *ob, DerivedMesh *dm)
+static void draw_mesh_object_outline_new(View3D *v3d, RegionView3D *rv3d, Object *ob, DerivedMesh *dm, const bool is_active)
 {
 	if ((v3d->transp == false) &&  /* not when we draw the transparent pass */
 	    (ob->mode & OB_MODE_ALL_PAINT) == false) /* not when painting (its distracting) - campbell */
@@ -4265,9 +4265,8 @@ static void draw_mesh_object_outline_new(View3D *v3d, RegionView3D *rv3d, Object
 		glLineWidth(UI_GetThemeValuef(TH_OUTLINE_WIDTH) * 2.0f);
 		glDepthMask(GL_FALSE);
 
-		const float outline_color[4];
-		UI_GetThemeColor4fv(TH_SELECT, outline_color);
-		/* TODO: use TH_ACTIVE if this is the active object */
+		float outline_color[4];
+		UI_GetThemeColor4fv((is_active ? TH_ACTIVE : TH_SELECT), outline_color);
 
 #if 1
 		Batch *fancy_edges = MBC_get_fancy_edges(dm);
@@ -4836,7 +4835,7 @@ static void draw_mesh_fancy_new(Scene *scene, ARegion *ar, View3D *v3d, RegionVi
 		    !(G.f & G_PICKSEL || (draw_flags & DRAW_FACE_SELECT)) &&
 		    (draw_wire == OBDRAW_WIRE_OFF))
 		{
-			draw_mesh_object_outline_new(v3d, rv3d, ob, dm);
+			draw_mesh_object_outline_new(v3d, rv3d, ob, dm, (ob == OBACT));
 		}
 
 		if (draw_glsl_material(scene, ob, v3d, dt) && !(draw_flags & DRAW_MODIFIERS_PREVIEW)) {
@@ -4903,7 +4902,7 @@ static void draw_mesh_fancy_new(Scene *scene, ARegion *ar, View3D *v3d, RegionVi
 				    (draw_wire == OBDRAW_WIRE_OFF) &&
 				    (ob->sculpt == NULL))
 				{
-					draw_mesh_object_outline_new(v3d, rv3d, ob, dm);
+					draw_mesh_object_outline_new(v3d, rv3d, ob, dm, (ob == OBACT));
 				}
 
 				/* materials arent compatible with vertex colors */
@@ -4928,7 +4927,7 @@ static void draw_mesh_fancy_new(Scene *scene, ARegion *ar, View3D *v3d, RegionVi
 			    (ob->sculpt == NULL))
 			{
 				/* TODO: move this into a separate pass */
-				draw_mesh_object_outline_new(v3d, rv3d, ob, dm);
+				draw_mesh_object_outline_new(v3d, rv3d, ob, dm, (ob == OBACT));
 			}
 
 			glFrontFace((ob->transflag & OB_NEG_SCALE) ? GL_CW : GL_CCW);




More information about the Bf-blender-cvs mailing list