Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'release')
-rw-r--r--release/scripts/op/io_scene_x3d/export_x3d.py28
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)