[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [1410] trunk/py/scripts/addons/ io_scene_x3d/export_x3d.py: bugfix [#25642] Export to X3D TextureImage url field is empty

Campbell Barton ideasman42 at gmail.com
Sat Jan 15 21:37:21 CET 2011


Revision: 1410
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-extensions&revision=1410
Author:   campbellbarton
Date:     2011-01-15 20:37:20 +0000 (Sat, 15 Jan 2011)
Log Message:
-----------
bugfix [#25642] Export to X3D TextureImage url field is empty
export multiple image paths.

Modified Paths:
--------------
    trunk/py/scripts/addons/io_scene_x3d/export_x3d.py

Modified: trunk/py/scripts/addons/io_scene_x3d/export_x3d.py
===================================================================
--- trunk/py/scripts/addons/io_scene_x3d/export_x3d.py	2011-01-15 19:34:59 UTC (rev 1409)
+++ trunk/py/scripts/addons/io_scene_x3d/export_x3d.py	2011-01-15 20:37:20 UTC (rev 1410)
@@ -578,14 +578,26 @@
 
     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):



More information about the Bf-extensions-cvs mailing list