[Bf-blender-cvs] [5d822f45087] master: fix T61122 : Added support for Materials with Nodes disabled.
Gaia Clary
noreply at git.blender.org
Sat Feb 23 18:18:08 CET 2019
Commit: 5d822f4508755f90091ea474519bd6001ee8b3a6
Author: Gaia Clary
Date: Sat Feb 23 18:15:21 2019 +0100
Branches: master
https://developer.blender.org/rB5d822f4508755f90091ea474519bd6001ee8b3a6
fix T61122 : Added support for Materials with Nodes disabled.
- The Collada exporter did not take care of
material transparency when nodes are turned off.
- recent change to use ma->alpha_threshold seems to have
been wrong. transparency is now taken from ma->a when
nodes are turned off.
===================================================================
M source/blender/collada/EffectExporter.cpp
M source/blender/collada/collada_utils.cpp
===================================================================
diff --git a/source/blender/collada/EffectExporter.cpp b/source/blender/collada/EffectExporter.cpp
index b6f8ba9ba1f..b2bf09665ca 100644
--- a/source/blender/collada/EffectExporter.cpp
+++ b/source/blender/collada/EffectExporter.cpp
@@ -98,14 +98,14 @@ void EffectsExporter::set_shader_type(COLLADASW::EffectProfile &ep, Material *ma
void EffectsExporter::set_transparency(COLLADASW::EffectProfile &ep, Material *ma)
{
- if (ma->alpha_threshold == 1.0f) {
- return; // have no transparency
+ COLLADASW::ColorOrTexture cot = bc_get_base_color(ma);
+ float transparency = cot.getColor().getAlpha();
+ if (transparency < 1) {
+ // Tod: because we are in A_ONE mode transparency is calculated like this:
+ COLLADASW::ColorOrTexture cot = getcol(1.0f, 1.0f, 1.0f, transparency);
+ ep.setTransparent(cot);
+ ep.setOpaque(COLLADASW::EffectProfile::A_ONE);
}
-
- // Tod: because we are in A_ONE mode transparency is calculated like this:
- COLLADASW::ColorOrTexture cot = getcol(1.0f, 1.0f, 1.0f, ma->alpha_threshold);
- ep.setTransparent(cot);
- ep.setOpaque(COLLADASW::EffectProfile::A_ONE);
}
void EffectsExporter::set_diffuse_color(COLLADASW::EffectProfile &ep, Material *ma)
{
diff --git a/source/blender/collada/collada_utils.cpp b/source/blender/collada/collada_utils.cpp
index d47ab111487..66c8f94b6c8 100644
--- a/source/blender/collada/collada_utils.cpp
+++ b/source/blender/collada/collada_utils.cpp
@@ -1354,18 +1354,18 @@ bc_node_add_link(ntree, nmap["main"], 0, nmap["out"], 0);
COLLADASW::ColorOrTexture bc_get_base_color(Material *ma)
{
bNode *master_shader = bc_get_master_shader(ma);
- if (master_shader) {
+ if (ma->use_nodes && master_shader) {
return bc_get_base_color(master_shader);
}
else {
- return bc_get_cot(ma->r, ma->g, ma->b, ma->alpha_threshold);
+ return bc_get_cot(ma->r, ma->g, ma->b, ma->a);
}
}
COLLADASW::ColorOrTexture bc_get_specular_color(Material *ma, bool use_fallback)
{
bNode *master_shader = bc_get_master_shader(ma);
- if (master_shader) {
+ if (ma->use_nodes && master_shader) {
return bc_get_specular_color(master_shader);
}
else if (use_fallback) {
More information about the Bf-blender-cvs
mailing list