From ee04b41a97f701aebad167102814d8d04ce7c936 Mon Sep 17 00:00:00 2001 From: Josh Heidenreich Date: Tue, 2 Jun 2015 21:15:37 +0930 Subject: 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. --- tools/export/blender25/io_scene_dae/export_dae.py | 24 ++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) (limited to 'tools') 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,'') else: - self.writel(S_FX,6,''+numarr(material.diffuse_color,material.emit)+' ') # not totally right but good enough + self.writel(S_FX,6,''+numarr_alpha(material.diffuse_color,material.emit)+' ') # not totally right but good enough self.writel(S_FX,5,'') self.writel(S_FX,5,'') - self.writel(S_FX,6,''+numarr(self.scene.world.ambient_color,material.ambient)+' ') + self.writel(S_FX,6,''+numarr_alpha(self.scene.world.ambient_color,material.ambient)+' ') self.writel(S_FX,5,'') self.writel(S_FX,5,'') if (diffuse_tex!=None): self.writel(S_FX,6,'') else: - self.writel(S_FX,6,''+numarr(material.diffuse_color,material.diffuse_intensity)+'') + self.writel(S_FX,6,''+numarr_alpha(material.diffuse_color,material.diffuse_intensity)+'') self.writel(S_FX,5,'') self.writel(S_FX,5,'') if (specular_tex!=None): self.writel(S_FX,6,'') else: - self.writel(S_FX,6,''+numarr(material.specular_color,material.specular_intensity)+'') + self.writel(S_FX,6,''+numarr_alpha(material.specular_color,material.specular_intensity)+'') self.writel(S_FX,5,'') self.writel(S_FX,5,'') @@ -317,7 +326,7 @@ class DaeExporter: self.writel(S_FX,5,'') self.writel(S_FX,5,'') - self.writel(S_FX,6,''+strarr(material.mirror_color)+'') + self.writel(S_FX,6,''+numarr_alpha(material.mirror_color)+'') self.writel(S_FX,5,'') if (material.use_transparency): @@ -325,10 +334,11 @@ class DaeExporter: self.writel(S_FX,6,''+str(material.alpha)+'') self.writel(S_FX,5,'') - + self.writel(S_FX,5,'') + self.writel(S_FX,6,''+str(material.specular_ior)+'') + self.writel(S_FX,5,'') self.writel(S_FX,4,'') - self.writel(S_FX,4,''+str(material.specular_ior)+'') self.writel(S_FX,4,'') self.writel(S_FX,5,'') -- cgit v1.2.3