From 088f35787f60950efd1da8455bc392529fefa37e Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 22 Dec 2010 10:44:31 +0000 Subject: bugfix [#25252] X3D Export does not specify ImageTexture to go with provided TextureCoordinate data x3d material support is primitive but at least export first image texture found, similar to how texface is treated at the moment. --- release/scripts/op/io_scene_x3d/export_x3d.py | 28 ++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) (limited to 'release') diff --git a/release/scripts/op/io_scene_x3d/export_x3d.py b/release/scripts/op/io_scene_x3d/export_x3d.py index 49d3b0f5eec..eac327e85d1 100644 --- a/release/scripts/op/io_scene_x3d/export_x3d.py +++ b/release/scripts/op/io_scene_x3d/export_x3d.py @@ -388,7 +388,6 @@ class x3d_class: # (meshName, loc[0], loc[1], loc[2], sca[0], sca[1], sca[2], rot[0], rot[1], rot[2], quat.angle*DEG2RAD) ) self.writeIndented("\n",1) - hasImageTexture = False is_smooth = False # XXX, lame, only exports first material. @@ -406,24 +405,31 @@ class x3d_class: print("Warning: mesh named %s has multiple materials" % meshName) print("Warning: only one material per object handled") + image = None + if mat_first is None or mat_first.use_face_texture: #-- textures - image = None if mesh.uv_textures.active: for face in mesh.uv_textures.active.data: if face.use_image: image = face.image if image: - self.writeImageTexture(image) break - - # XXX, incorrect, uses last image - if image: - hasImageTexture = True - - if self.tilenode == 1: - self.writeIndented("\n" % (image.xrep, image.yrep)) - self.tilenode = 0 + elif mat_first: + for mtex in mat_first.texture_slots: + tex = mtex.texture + if tex and tex.type == 'IMAGE': + image = tex.image + if image: + break + + # XXX, incorrect, uses first image + if image: + self.writeImageTexture(image) + + if self.tilenode == 1: + self.writeIndented("\n" % (image.xrep, image.yrep)) + self.tilenode = 0 self.writeIndented("\n", -1) -- cgit v1.2.3