Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClément Foucault <foucault.clem@gmail.com>2019-01-29 22:33:51 +0300
committerClément Foucault <foucault.clem@gmail.com>2019-01-29 22:34:37 +0300
commit1a61c209a0ff7c7b10a3b9bd00cb125fd5e21de6 (patch)
tree7e2d3a9caeaaec06b940ba6a6bb674f4c38747a9
parent43150b02a0067a7bc5c1e39797815cd2d907be8f (diff)
Workbench: Make Material transparency part of the rgba color picker
It is only used for solid mode for now but could be used by eevee in the future.
-rw-r--r--release/scripts/startup/bl_ui/properties_material.py1
-rw-r--r--source/blender/blenloader/intern/versioning_280.c6
-rw-r--r--source/blender/draw/engines/workbench/workbench_deferred.c6
-rw-r--r--source/blender/makesdna/DNA_material_types.h3
-rw-r--r--source/blender/makesrna/intern/rna_material.c8
5 files changed, 11 insertions, 13 deletions
diff --git a/release/scripts/startup/bl_ui/properties_material.py b/release/scripts/startup/bl_ui/properties_material.py
index ae1cc12ba50..8d7e7ac266d 100644
--- a/release/scripts/startup/bl_ui/properties_material.py
+++ b/release/scripts/startup/bl_ui/properties_material.py
@@ -258,7 +258,6 @@ class MATERIAL_PT_viewport(MaterialButtonsPanel, Panel):
col.prop(mat, "diffuse_color", text="Color")
col.prop(mat, "metallic")
col.prop(mat, "roughness")
- col.prop(mat, "transparency")
def draw(self, context):
self.draw_shared(self, context.material)
diff --git a/source/blender/blenloader/intern/versioning_280.c b/source/blender/blenloader/intern/versioning_280.c
index c5c234580e6..e1e821d6897 100644
--- a/source/blender/blenloader/intern/versioning_280.c
+++ b/source/blender/blenloader/intern/versioning_280.c
@@ -2790,5 +2790,11 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
{
/* Versioning code until next subversion bump goes here. */
+
+ if (!DNA_struct_elem_find(fd->filesdna, "Material", "float", "a")) {
+ for (Material *mat = bmain->mat.first; mat; mat = mat->id.next) {
+ mat->a = 1.0f;
+ }
+ }
}
}
diff --git a/source/blender/draw/engines/workbench/workbench_deferred.c b/source/blender/draw/engines/workbench/workbench_deferred.c
index 4e0ec0259c2..538dca3b87f 100644
--- a/source/blender/draw/engines/workbench/workbench_deferred.c
+++ b/source/blender/draw/engines/workbench/workbench_deferred.c
@@ -943,6 +943,7 @@ void workbench_deferred_solid_cache_populate(WORKBENCH_Data *vedata, Object *ob)
if ((ob->col[3] < 1.0f) &&
(wpd->shading.color_type == V3D_SHADING_OBJECT_COLOR))
{
+ /* Hack */
wpd->shading.xray_alpha = ob->col[3];
material = workbench_forward_get_or_create_material_data(vedata, ob, NULL, NULL, wpd->shading.color_type, 0);
has_transp_mat = true;
@@ -978,10 +979,9 @@ void workbench_deferred_solid_cache_populate(WORKBENCH_Data *vedata, Object *ob)
for (int i = 0; i < materials_len; ++i) {
if (geoms != NULL && geoms[i] != NULL) {
Material *mat = give_current_material(ob, i + 1);
- if (mat != NULL && mat->transparency > 0.0) {
+ if (mat != NULL && mat->a < 1.0f) {
/* Hack */
- wpd->shading.xray_alpha = 1.0f - mat->transparency;
- CLAMP(wpd->shading.xray_alpha, 0.0, 1.0);
+ wpd->shading.xray_alpha = mat->a;
material = workbench_forward_get_or_create_material_data(vedata, ob, mat, NULL, V3D_SHADING_MATERIAL_COLOR, 0);
has_transp_mat = true;
}
diff --git a/source/blender/makesdna/DNA_material_types.h b/source/blender/makesdna/DNA_material_types.h
index 10c40cc28a6..769d4272d70 100644
--- a/source/blender/makesdna/DNA_material_types.h
+++ b/source/blender/makesdna/DNA_material_types.h
@@ -145,7 +145,7 @@ typedef struct Material {
short flag, pad1[7];
/* Colors from Blender Internal that we are still using. */
- float r, g, b;
+ float r, g, b, a;
float specr, specg, specb;
float alpha DNA_DEPRECATED;
float ray_mirror DNA_DEPRECATED;
@@ -154,7 +154,6 @@ typedef struct Material {
float gloss_mir DNA_DEPRECATED;
float roughness;
float metallic;
- float transparency;
float pad4;
/* Ror buttons and render. */
diff --git a/source/blender/makesrna/intern/rna_material.c b/source/blender/makesrna/intern/rna_material.c
index b32d3aa9d78..4a6ab3e8882 100644
--- a/source/blender/makesrna/intern/rna_material.c
+++ b/source/blender/makesrna/intern/rna_material.c
@@ -354,7 +354,7 @@ static void rna_def_material_display(StructRNA *srna)
prop = RNA_def_property(srna, "diffuse_color", PROP_FLOAT, PROP_COLOR);
RNA_def_property_float_sdna(prop, NULL, "r");
- RNA_def_property_array(prop, 3);
+ RNA_def_property_array(prop, 4);
RNA_def_property_ui_text(prop, "Diffuse Color", "Diffuse color of the material");
RNA_def_property_update(prop, 0, "rna_Material_draw_update");
@@ -384,12 +384,6 @@ static void rna_def_material_display(StructRNA *srna)
RNA_def_property_ui_text(prop, "Metallic", "Amount of mirror reflection for raytrace");
RNA_def_property_update(prop, 0, "rna_Material_update");
- prop = RNA_def_property(srna, "transparency", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_sdna(prop, NULL, "transparency");
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_text(prop, "Transparency", "Amount of transparency in solid mode");
- RNA_def_property_update(prop, 0, "rna_Material_draw_update");
-
/* Freestyle line color */
prop = RNA_def_property(srna, "line_color", PROP_FLOAT, PROP_COLOR);
RNA_def_property_float_sdna(prop, NULL, "line_col");