diff options
author | Campbell Barton <ideasman42@gmail.com> | 2011-01-15 23:37:20 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2011-01-15 23:37:20 +0300 |
commit | 9d96ea82d9cf7dc9af8b8cdb48a97500ef51482a (patch) | |
tree | c1ce232a3630c4adf7888279f906e9dd756b43d7 | |
parent | fa68b830205780cb7fb6a4994195bce61323ae50 (diff) |
bugfix [#25642] Export to X3D TextureImage url field is empty
export multiple image paths.
-rw-r--r-- | io_scene_x3d/export_x3d.py | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/io_scene_x3d/export_x3d.py b/io_scene_x3d/export_x3d.py index c420b0cd..03b5ec26 100644 --- a/io_scene_x3d/export_x3d.py +++ b/io_scene_x3d/export_x3d.py @@ -578,14 +578,26 @@ class x3d_class: def writeImageTexture(self, image): name = image.name - filepath = os.path.basename(image.filepath) + if image.tag: self.write_indented("<ImageTexture USE=\"%s\" />\n" % self.cleanStr(name)) else: image.tag = True self.write_indented("<ImageTexture DEF=\"%s\" " % self.cleanStr(name), 1) - self.file.write("url=\"%s\" />" % filepath) + filepath = image.filepath + filepath_full = bpy.path.abspath(filepath) + # collect image paths, can load multiple + # [relative, absolute, name-only] + images = [] + + if bpy.path.is_subdir(filepath_full, self.filepath): + images.append(os.path.relpath(filepath_full, self.filepath)) + + images.append(filepath_full) + images.append(os.path.basename(filepath_full)) + + self.file.write("url='%s' />" % " ".join(["\"%s\"" % f for f in images])) self.write_indented("\n", -1) def writeBackground(self, world, alltextures): |