Commit: a78a17bad5433f78db8991bba4c25aa6fdaef0d4
Author: Gaia Clary
Date:   Wed Feb 4 19:06:55 2015 +0100
Branches: master
https://developer.blender.org/rBa78a17bad5433f78db8991bba4c25aa6fdaef0d4

Fix T43366 export/import materials inconsistent

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

M       source/blender/collada/EffectExporter.cpp

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

diff --git a/source/blender/collada/EffectExporter.cpp 
b/source/blender/collada/EffectExporter.cpp
index 1f0e00b..13dc1ed 100644
--- a/source/blender/collada/EffectExporter.cpp
+++ b/source/blender/collada/EffectExporter.cpp
@@ -133,7 +133,7 @@ void 
EffectsExporter::writeTextures(COLLADASW::EffectProfile &ep,
        if (!ima) return;
 
        // color
-       if (t->mapto & (MAP_COL | MAP_COLSPEC)) {
+       if (t->mapto & MAP_COL) {
                ep.setDiffuse(createTexture(ima, uvname, sampler), false, 
"diffuse");
        }
        // ambient
@@ -141,7 +141,7 @@ void 
EffectsExporter::writeTextures(COLLADASW::EffectProfile &ep,
                ep.setAmbient(createTexture(ima, uvname, sampler), false, 
"ambient");
        }
        // specular
-       if (t->mapto & MAP_SPEC) {
+       if (t->mapto & (MAP_SPEC | MAP_COLSPEC)) {
                ep.setSpecular(createTexture(ima, uvname, sampler), false, 
"specular");
        }
        // emission
@@ -263,7 +263,7 @@ void EffectsExporter::operator()(Material *ma, Object *ob)
        COLLADASW::Sampler samplers[MAX_MTEX];
        //COLLADASW::Surface surfaces[MAX_MTEX];
        //void *samp_surf[MAX_MTEX][2];
-       void *samp_surf[MAX_MTEX][1];
+       void *samp_surf[MAX_MTEX];
        
        // image to index to samp_surf map
        // samp_surf[index] stores 2 pointers, sampler and surface
@@ -302,7 +302,7 @@ void EffectsExporter::operator()(Material *ma, Object *ob)
                        //surfaces[a] = surface;
                        
                        // store pointers so they can be used later when we 
create <texture>s
-                       samp_surf[b][0] = &samplers[a];
+                       samp_surf[b] = &samplers[a];
                        //samp_surf[b][1] = &surfaces[a];
                        
                        im_samp_map[key] = b;
@@ -349,7 +349,7 @@ void EffectsExporter::operator()(Material *ma, Object *ob)
                                                                                
                                   key + 
COLLADASW::Sampler::SURFACE_SID_SUFFIX);
                                                                
sampler.setImageId(key);
                                                                samplers[a] = 
sampler;
-                                                               samp_surf[b][0] 
= &samplers[a];
+                                                               samp_surf[b] = 
&samplers[a];
                                                                
im_samp_map[key] = b;
                                                                b++;
                                                                a++;
@@ -380,7 +380,7 @@ void EffectsExporter::operator()(Material *ma, Object *ob)
                key = translate_id(key);
                int i = im_samp_map[key];
                std::string uvname = strlen(t->uvname) ? t->uvname : active_uv;
-               COLLADASW::Sampler *sampler = (COLLADASW::Sampler 
*)samp_surf[i][0];
+               COLLADASW::Sampler *sampler = (COLLADASW::Sampler 
*)samp_surf[i];
                writeTextures(ep, key, sampler, t, ima, uvname);
        }
 
@@ -392,7 +392,7 @@ void EffectsExporter::operator()(Material *ma, Object *ob)
                        std::string key(id_name(ima));
                        key = translate_id(key);
                        int i = im_samp_map[key];
-                       COLLADASW::Sampler *sampler = (COLLADASW::Sampler 
*)samp_surf[i][0];
+                       COLLADASW::Sampler *sampler = (COLLADASW::Sampler 
*)samp_surf[i];
                        ep.setDiffuse(createTexture(ima, active_uv, sampler), 
false, "diffuse");
                }
        }

_______________________________________________
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to