diff options
author | Gaia Clary <gaia.clary@machinimatrix.org> | 2019-02-23 20:15:21 +0300 |
---|---|---|
committer | Gaia Clary <gaia.clary@machinimatrix.org> | 2019-02-23 20:17:46 +0300 |
commit | 5d822f4508755f90091ea474519bd6001ee8b3a6 (patch) | |
tree | b6bb53e8b0ef4db764b2abd2506ede094d562b1b /source | |
parent | 0207d20cd4d400381db3788499bbcc5eb946463a (diff) |
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.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/collada/EffectExporter.cpp | 14 | ||||
-rw-r--r-- | source/blender/collada/collada_utils.cpp | 6 |
2 files changed, 10 insertions, 10 deletions
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) { |