diff options
author | Gaia Clary <gaia.clary@machinimatrix.org> | 2020-01-22 20:00:33 +0300 |
---|---|---|
committer | Gaia Clary <gaia.clary@machinimatrix.org> | 2020-01-22 20:04:08 +0300 |
commit | 8fc68a2e9cf1d983b3d249988ab05905bd24f06f (patch) | |
tree | ae7929ff0ea5aa08b1e71865a1cb576326878e00 | |
parent | 084f072aae73de39fecc35ac97d602b1db7d0d98 (diff) |
Fix T69090: Collada Exporter now exports the base color if Nodes are disabled
I also changed the Collada importer scuh that the diffuse Alpha is now set
for the generated PBSDF Shader AND for the base color.
Note: we can not export the base color AND the color
from the PBSDF Shaders at the same time. And when importing
we do not know if the color was originally coming from a base
material or from a shader. Setting them both in import seems
to give the most consistent results.
-rw-r--r-- | source/blender/collada/Materials.cpp | 1 | ||||
-rw-r--r-- | source/blender/collada/collada_utils.cpp | 4 |
2 files changed, 3 insertions, 2 deletions
diff --git a/source/blender/collada/Materials.cpp b/source/blender/collada/Materials.cpp index 3b2c68ef95e..06f54884668 100644 --- a/source/blender/collada/Materials.cpp +++ b/source/blender/collada/Materials.cpp @@ -202,6 +202,7 @@ void MaterialNode::set_alpha(COLLADAFW::EffectCommon::OpaqueMode mode, bNodeSocket *socket = nodeFindSocket(shader_node, SOCK_IN, "Alpha"); ((bNodeSocketValueFloat *)socket->default_value)->value = alpha; + material->a = alpha; } else if (cot.isTexture()) { int locy = -300 * (node_map.size() - 2); diff --git a/source/blender/collada/collada_utils.cpp b/source/blender/collada/collada_utils.cpp index 6116b04e122..d5011581204 100644 --- a/source/blender/collada/collada_utils.cpp +++ b/source/blender/collada/collada_utils.cpp @@ -1321,7 +1321,7 @@ void bc_add_default_shader(bContext *C, Material *ma) COLLADASW::ColorOrTexture bc_get_base_color(Material *ma) { - Color default_color = {0.8, 0.8, 0.8, 1.0}; + Color default_color = {ma->r, ma->g, ma->b, 1.0}; // for alpha see bc_get_alpha() bNode *shader = bc_get_master_shader(ma); if (ma->use_nodes && shader) { return bc_get_cot_from_shader(shader, "Base Color", default_color, false); @@ -1424,7 +1424,7 @@ COLLADASW::ColorOrTexture bc_get_cot_from_shader(bNode *shader, return bc_get_cot(col, with_alpha); } else { - return bc_get_cot(default_color, with_alpha); /* default black */ + return bc_get_cot(default_color, with_alpha); } } |