Browse Source

Changed handling of material ambient color in Blender exporter.

This should be closer to what's expected on three.js side.
alteredq 13 years ago
parent
commit
814634ffc7

+ 6 - 14
utils/exporters/blender/2.63/scripts/addons/io_mesh_threejs/export_threejs.py

@@ -1127,13 +1127,9 @@ def extract_materials(mesh, scene, option_colors, option_copy_textures, filepath
                                          m.specular_intensity * m.specular_color[1],
                                          m.specular_intensity * m.specular_color[2]]
 
-            world_ambient_color = [0, 0, 0]
-            if world:
-                world_ambient_color = world.ambient_color
-
-            material['colorAmbient'] = [m.ambient * world_ambient_color[0],
-                                        m.ambient * world_ambient_color[1],
-                                        m.ambient * world_ambient_color[2]]
+            material['colorAmbient'] = [m.ambient * m.diffuse_color[0],
+                                        m.ambient * m.diffuse_color[1],
+                                        m.ambient * m.diffuse_color[2]]
 
             material['transparency'] = m.alpha
 
@@ -1806,13 +1802,9 @@ def extract_material_data(m, option_colors):
                                  m.specular_intensity * m.specular_color[1],
                                  m.specular_intensity * m.specular_color[2]]
 
-    world_ambient_color = [0, 0, 0]
-    if world:
-        world_ambient_color = world.ambient_color
-
-    material['colorAmbient'] = [m.ambient * world_ambient_color[0],
-                                m.ambient * world_ambient_color[1],
-                                m.ambient * world_ambient_color[2]]
+    material['colorAmbient'] = [m.ambient * m.diffuse_color[0],
+                                m.ambient * m.diffuse_color[1],
+                                m.ambient * m.diffuse_color[2]]
 
     material['transparency'] = m.alpha