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:
authorCampbell Barton <ideasman42@gmail.com>2010-12-22 03:30:22 +0300
committerCampbell Barton <ideasman42@gmail.com>2010-12-22 03:30:22 +0300
commit97d8e8bf42c54452d8d19caf0c0b2444d2cb8649 (patch)
treeacbf4b047fd4e34bb32ee25a23ba98989181b3dc /release
parent803bf8326d99fe7540410dc2e16c5907d83c1e46 (diff)
bugfix [#25332] X3D export fails to export complete file
Diffstat (limited to 'release')
-rw-r--r--release/scripts/op/io_scene_x3d/export_x3d.py20
1 files changed, 12 insertions, 8 deletions
diff --git a/release/scripts/op/io_scene_x3d/export_x3d.py b/release/scripts/op/io_scene_x3d/export_x3d.py
index 04a752195fb..49d3b0f5eec 100644
--- a/release/scripts/op/io_scene_x3d/export_x3d.py
+++ b/release/scripts/op/io_scene_x3d/export_x3d.py
@@ -388,22 +388,25 @@ 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)
- maters=mesh.materials
hasImageTexture = False
is_smooth = False
- if len(maters) > 0 or mesh.uv_textures.active:
- # if len(maters) > 0 or mesh.faceUV:
+ # XXX, lame, only exports first material.
+ mat_first = None
+ for mat_first in mesh.materials:
+ if mat_first:
+ break
+
+ if mat_first or mesh.uv_textures.active:
self.writeIndented("<Appearance>\n", 1)
# right now this script can only handle a single material per mesh.
- if len(maters) >= 1 and maters[0].use_face_texture == False:
- mat = maters[0]
- self.writeMaterial(mat, self.cleanStr(mat.name,''), world)
- if len(maters) > 1:
+ if mat_first and mat_first.use_face_texture == False:
+ self.writeMaterial(mat_first, self.cleanStr(mat_first.name, ""), world)
+ if len(mesh.materials) > 1:
print("Warning: mesh named %s has multiple materials" % meshName)
print("Warning: only one material per object handled")
- if not len(maters) or maters[0].use_face_texture:
+ if mat_first is None or mat_first.use_face_texture:
#-- textures
image = None
if mesh.uv_textures.active:
@@ -414,6 +417,7 @@ class x3d_class:
self.writeImageTexture(image)
break
+ # XXX, incorrect, uses last image
if image:
hasImageTexture = True