diff options
author | Campbell Barton <ideasman42@gmail.com> | 2010-12-22 13:44:31 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2010-12-22 13:44:31 +0300 |
commit | 088f35787f60950efd1da8455bc392529fefa37e (patch) | |
tree | 56b267b381c783a9afbce8a155c5e105899cf11b /release | |
parent | 9d756fb761ba24a884e9663b779b8807adcdb805 (diff) |
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.
Diffstat (limited to 'release')
-rw-r--r-- | release/scripts/op/io_scene_x3d/export_x3d.py | 28 |
1 files changed, 17 insertions, 11 deletions
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("<Shape>\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("<TextureTransform scale=\"%s %s\" />\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("<TextureTransform scale=\"%s %s\" />\n" % (image.xrep, image.yrep)) + self.tilenode = 0 self.writeIndented("</Appearance>\n", -1) |