[Bf-blender-cvs] [016aca7] blender2.8: OpenGL: fade other objects during edit mode

Mike Erwin noreply at git.blender.org
Tue Nov 8 05:41:15 CET 2016


Commit: 016aca742724e9b138f6282224c0920a8704af88
Author: Mike Erwin
Date:   Mon Nov 7 20:32:27 2016 +0100
Branches: blender2.8
https://developer.blender.org/rB016aca742724e9b138f6282224c0920a8704af88

OpenGL: fade other objects during edit mode

Right now this only affects other objects in wireframe. The idea is to do something similar for other draw modes, and keep focus on the edit object.

As seen at #bcon16

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

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 c316057..bf48de3 100644
--- a/source/blender/editors/space_view3d/drawobject.c
+++ b/source/blender/editors/space_view3d/drawobject.c
@@ -4755,7 +4755,7 @@ static bool draw_mesh_object(Scene *scene, ARegion *ar, View3D *v3d, RegionView3
 	return retval;
 }
 
-static void make_color_variations(const unsigned char base_ubyte[4], float low[4], float med[4], float high[4])
+static void make_color_variations(const unsigned char base_ubyte[4], float low[4], float med[4], float high[4], const bool other_obedit)
 {
 	/* original idea: nice variations (lighter & darker shades) of base color
 	 * current implementation uses input color as high; med & low get closer to background color
@@ -4767,9 +4767,17 @@ static void make_color_variations(const unsigned char base_ubyte[4], float low[4
 	float base[4];
 	rgba_uchar_to_float(base, base_ubyte);
 
-	interp_v3_v3v3(low, bg, base, 0.333f);
-	interp_v3_v3v3(med, bg, base, 0.667f);
-	copy_v3_v3(high, base);
+	if (other_obedit) {
+		/* this object should fade away so user can focus on the object being edited */
+		interp_v3_v3v3(low, bg, base, 0.1f);
+		interp_v3_v3v3(med, bg, base, 0.2f);
+		interp_v3_v3v3(high, bg, base, 0.25f);
+	}
+	else {
+		interp_v3_v3v3(low, bg, base, 0.333f);
+		interp_v3_v3v3(med, bg, base, 0.667f);
+		copy_v3_v3(high, base);
+	}
 
 	/* use original alpha */
 	low[3] = base[3];
@@ -4778,7 +4786,7 @@ static void make_color_variations(const unsigned char base_ubyte[4], float low[4
 }
 
 static void draw_mesh_fancy_new(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D *rv3d, Base *base,
-                                const char dt, const unsigned char ob_wire_col[4], const short dflag)
+                                const char dt, const unsigned char ob_wire_col[4], const short dflag, const bool other_obedit)
 {
 	if (dflag & (DRAW_PICKING | DRAW_CONSTCOLOR)) {
 		/* too complicated! use existing methods */
@@ -4873,7 +4881,7 @@ static void draw_mesh_fancy_new(Scene *scene, ARegion *ar, View3D *v3d, RegionVi
 		float frontColor[4];
 		float backColor[4];
 		float outlineColor[4];
-		make_color_variations(ob_wire_col, backColor, frontColor, outlineColor);
+		make_color_variations(ob_wire_col, backColor, frontColor, outlineColor, other_obedit);
 
 		Batch_Uniform4fv(fancy_edges, "frontColor", frontColor);
 		Batch_Uniform4fv(fancy_edges, "backColor", backColor);
@@ -5180,7 +5188,9 @@ static bool draw_mesh_object_new(Scene *scene, ARegion *ar, View3D *v3d, RegionV
 				}
 			}
 
-			draw_mesh_fancy_new(scene, ar, v3d, rv3d, base, dt, ob_wire_col, dflag);
+			const bool other_obedit = obedit && (obedit != ob);
+
+			draw_mesh_fancy_new(scene, ar, v3d, rv3d, base, dt, ob_wire_col, dflag, other_obedit);
 
 			GPU_end_object_materials();




More information about the Bf-blender-cvs mailing list