[Bf-blender-cvs] [2ae88c4d789] blender2.8: UI: Make the grid alpha themable

Clément Foucault noreply at git.blender.org
Mon Nov 5 16:31:22 CET 2018


Commit: 2ae88c4d78945e05d27bca608468d34b51927b7d
Author: Clément Foucault
Date:   Mon Nov 5 12:53:26 2018 +0100
Branches: blender2.8
https://developer.blender.org/rB2ae88c4d78945e05d27bca608468d34b51927b7d

UI: Make the grid alpha themable

Now that the 3d grid is infinite, antialiased, not occluded, and overlaid
on top of rendered view, being able to decrease its opacity to reduce
visual strain is a must.

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

M	source/blender/draw/modes/shaders/object_grid_frag.glsl
M	source/blender/makesrna/intern/rna_userdef.c

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

diff --git a/source/blender/draw/modes/shaders/object_grid_frag.glsl b/source/blender/draw/modes/shaders/object_grid_frag.glsl
index 928db048a46..3ccb10ca4ab 100644
--- a/source/blender/draw/modes/shaders/object_grid_frag.glsl
+++ b/source/blender/draw/modes/shaders/object_grid_frag.glsl
@@ -172,9 +172,10 @@ void main()
 		float gridB = get_grid(grid_pos, grid_fwidth, scaleB);
 		float gridC = get_grid(grid_pos, grid_fwidth, scaleC);
 
-		FragColor = vec4(colorGrid.rgb, gridA * blend);
-		FragColor = mix(FragColor, vec4(mix(colorGrid.rgb, colorGridEmphasise.rgb, blend), 1.0), gridB);
-		FragColor = mix(FragColor, vec4(colorGridEmphasise.rgb, 1.0), gridC);
+		FragColor = colorGrid;
+		FragColor.a *= gridA * blend;
+		FragColor = mix(FragColor, mix(colorGrid, colorGridEmphasise, blend), gridB);
+		FragColor = mix(FragColor, colorGridEmphasise, gridC);
 	}
 	else {
 		FragColor = vec4(colorGrid.rgb, 0.0);
diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c
index a42a1edb91e..1ea5c164449 100644
--- a/source/blender/makesrna/intern/rna_userdef.c
+++ b/source/blender/makesrna/intern/rna_userdef.c
@@ -1733,7 +1733,7 @@ static void rna_def_userdef_theme_space_view3d(BlenderRNA *brna)
 	/* General Viewport options */
 
 	prop = RNA_def_property(srna, "grid", PROP_FLOAT, PROP_COLOR_GAMMA);
-	RNA_def_property_array(prop, 3);
+	RNA_def_property_array(prop, 4);
 	RNA_def_property_ui_text(prop, "Grid", "");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");



More information about the Bf-blender-cvs mailing list