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.
This commit is contained in:
Clément Foucault 2018-11-05 12:53:26 +01:00
parent 205d1876ff
commit 2ae88c4d78
2 changed files with 5 additions and 4 deletions

View File

@ -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);

View File

@ -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");