diff options
author | Josh Heidenreich <josh.sickmate@gmail.com> | 2015-06-02 21:15:37 +0930 |
---|---|---|
committer | Josh Heidenreich <josh.sickmate@gmail.com> | 2015-06-02 21:15:37 +0930 |
commit | ee04b41a97f701aebad167102814d8d04ce7c936 (patch) | |
tree | 39087428b46209f86e5bd2d6766d745dc165b842 /tools/export | |
parent | ab99671bb835a5fe24a092ec34afe1ad862ac254 (diff) |
Fix DAE exporter - files unreadable by Assimp
Colours came though as 3x component instead of 4x component.
Index of refraction was in the wrong place.
Diffstat (limited to 'tools/export')
-rw-r--r-- | tools/export/blender25/io_scene_dae/export_dae.py | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/tools/export/blender25/io_scene_dae/export_dae.py b/tools/export/blender25/io_scene_dae/export_dae.py index 492a737e23..9568ccb645 100644 --- a/tools/export/blender25/io_scene_dae/export_dae.py +++ b/tools/export/blender25/io_scene_dae/export_dae.py @@ -87,6 +87,15 @@ def numarr(a,mult=1.0): s+=" " return s +def numarr_alpha(a,mult=1.0): + s=" " + for x in a: + s+=" "+str(x*mult) + if len(a) == 3: + s+=" 1.0" + s+=" " + return s + def strarr(arr): s=" " for x in arr: @@ -291,25 +300,25 @@ class DaeExporter: if (emission_tex!=None): self.writel(S_FX,6,'<texture texture="'+emission_tex+'" texcoord="CHANNEL1"/>') else: - self.writel(S_FX,6,'<color>'+numarr(material.diffuse_color,material.emit)+' </color>') # not totally right but good enough + self.writel(S_FX,6,'<color>'+numarr_alpha(material.diffuse_color,material.emit)+' </color>') # not totally right but good enough self.writel(S_FX,5,'</emission>') self.writel(S_FX,5,'<ambient>') - self.writel(S_FX,6,'<color>'+numarr(self.scene.world.ambient_color,material.ambient)+' </color>') + self.writel(S_FX,6,'<color>'+numarr_alpha(self.scene.world.ambient_color,material.ambient)+' </color>') self.writel(S_FX,5,'</ambient>') self.writel(S_FX,5,'<diffuse>') if (diffuse_tex!=None): self.writel(S_FX,6,'<texture texture="'+diffuse_tex+'" texcoord="CHANNEL1"/>') else: - self.writel(S_FX,6,'<color>'+numarr(material.diffuse_color,material.diffuse_intensity)+'</color>') + self.writel(S_FX,6,'<color>'+numarr_alpha(material.diffuse_color,material.diffuse_intensity)+'</color>') self.writel(S_FX,5,'</diffuse>') self.writel(S_FX,5,'<specular>') if (specular_tex!=None): self.writel(S_FX,6,'<texture texture="'+specular_tex+'" texcoord="CHANNEL1"/>') else: - self.writel(S_FX,6,'<color>'+numarr(material.specular_color,material.specular_intensity)+'</color>') + self.writel(S_FX,6,'<color>'+numarr_alpha(material.specular_color,material.specular_intensity)+'</color>') self.writel(S_FX,5,'</specular>') self.writel(S_FX,5,'<shininess>') @@ -317,7 +326,7 @@ class DaeExporter: self.writel(S_FX,5,'</shininess>') self.writel(S_FX,5,'<reflective>') - self.writel(S_FX,6,'<color>'+strarr(material.mirror_color)+'</color>') + self.writel(S_FX,6,'<color>'+numarr_alpha(material.mirror_color)+'</color>') self.writel(S_FX,5,'</reflective>') if (material.use_transparency): @@ -325,10 +334,11 @@ class DaeExporter: self.writel(S_FX,6,'<float>'+str(material.alpha)+'</float>') self.writel(S_FX,5,'</transparency>') - + self.writel(S_FX,5,'<index_of_refraction>') + self.writel(S_FX,6,'<float>'+str(material.specular_ior)+'</float>') + self.writel(S_FX,5,'</index_of_refraction>') self.writel(S_FX,4,'</'+shtype+'>') - self.writel(S_FX,4,'<index_of_refraction>'+str(material.specular_ior)+'</index_of_refraction>') self.writel(S_FX,4,'<extra>') self.writel(S_FX,5,'<technique profile="FCOLLADA">') |