Commit: 558f85473eb894588dde1240b2eca9d7d0ed1647
Author: Gaia Clary
Date:   Thu Jul 14 21:42:44 2016 +0200
Branches: master
https://developer.blender.org/rB558f85473eb894588dde1240b2eca9d7d0ed1647

fix T48857: Added support for transparency (used Patch D1949 from bwrsandman 
with some slight changes)

===================================================================

M       source/blender/collada/DocumentImporter.cpp

===================================================================

diff --git a/source/blender/collada/DocumentImporter.cpp 
b/source/blender/collada/DocumentImporter.cpp
index f06f299..b91039f 100644
--- a/source/blender/collada/DocumentImporter.cpp
+++ b/source/blender/collada/DocumentImporter.cpp
@@ -904,6 +904,7 @@ void 
DocumentImporter::write_profile_COMMON(COLLADAFW::EffectCommon *ef, Materia
                        i++;
                }
        }
+
        // EMISSION
        // color
        if (ef->getEmission().isColor()) {
@@ -919,8 +920,18 @@ void 
DocumentImporter::write_profile_COMMON(COLLADAFW::EffectCommon *ef, Materia
                        i++;
                }
        }
-       
-       if (ef->getOpacity().isTexture()) {
+
+       // TRANSPARENT
+       // color
+       if (ef->getOpacity().isColor()) {
+               float alpha = ef->getOpacity().getColor().getAlpha();
+               if (alpha < 1) {
+                       ma->alpha = alpha;
+                       ma->mode |= MA_ZTRANSP | MA_TRANSP;
+               }
+       }
+       // texture
+       else if (ef->getOpacity().isTexture()) {
                COLLADAFW::Texture ctex = ef->getOpacity().getTexture();
                mtex = create_texture(ef, ctex, ma, i, texindex_texarray_map);
                if (mtex != NULL) {
@@ -930,22 +941,7 @@ void 
DocumentImporter::write_profile_COMMON(COLLADAFW::EffectCommon *ef, Materia
                        ma->mode |= MA_ZTRANSP | MA_TRANSP;
                }
        }
-       // TRANSPARENT
-       // color
-#if 0
-       if (ef->getOpacity().isColor()) {
-               // XXX don't know what to do here
-       }
-       // texture
-       else if (ef->getOpacity().isTexture()) {
-               ctex = ef->getOpacity().getTexture();
-               if (mtex != NULL) mtex->mapto &= MAP_ALPHA;
-               else {
-                       mtex = create_texture(ef, ctex, ma, i, 
texindex_texarray_map);
-                       if (mtex != NULL) mtex->mapto = MAP_ALPHA;
-               }
-       }
-#endif
+
        material_texture_mapping_map[ma] = texindex_texarray_map;
 }

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to