From 9d96ea82d9cf7dc9af8b8cdb48a97500ef51482a Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 15 Jan 2011 20:37:20 +0000 Subject: bugfix [#25642] Export to X3D TextureImage url field is empty export multiple image paths. --- io_scene_x3d/export_x3d.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'io_scene_x3d') 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("\n" % self.cleanStr(name)) else: image.tag = True self.write_indented("" % 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): -- cgit v1.2.3