[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [1537] trunk/py/scripts/addons/ io_scene_x3d/export_x3d.py: bugfix [#25903] Export to X3D should provide relative path with forward slash for subdirectories in url of ImageTexture
Campbell Barton
ideasman42 at gmail.com
Fri Feb 4 06:22:31 CET 2011
Revision: 1537
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-extensions&revision=1537
Author: campbellbarton
Date: 2011-02-04 05:22:30 +0000 (Fri, 04 Feb 2011)
Log Message:
-----------
bugfix [#25903] Export to X3D should provide relative path with forward slash for subdirectories in url of ImageTexture
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-02-02 06:02:36 UTC (rev 1536)
+++ trunk/py/scripts/addons/io_scene_x3d/export_x3d.py 2011-02-04 05:22:30 UTC (rev 1537)
@@ -591,18 +591,19 @@
self.write_indented("<ImageTexture DEF=\"%s\" " % self.cleanStr(name), 1)
filepath = image.filepath
+ relpath = os.path.dirname(self.filepath) # could cache
filepath_full = bpy.path.abspath(filepath)
# collect image paths, can load multiple
- # [relative, absolute, name-only]
+ # [relative, name-only, absolute]
images = []
- if bpy.path.is_subdir(filepath_full, self.filepath):
- images.append(os.path.relpath(filepath_full, self.filepath))
+ if bpy.path.is_subdir(filepath_full, relpath):
+ images.append(os.path.relpath(filepath_full, relpath))
+ images.append(os.path.basename(filepath_full))
images.append(filepath_full)
- images.append(os.path.basename(filepath_full))
- self.file.write("url='%s' />" % " ".join(["\"%s\"" % f for f in images]))
+ self.file.write("url='%s' />" % " ".join(["\"%s\"" % f.replace("\\", "/") for f in images]))
self.write_indented("\n", -1)
def writeBackground(self, world, alltextures):
More information about the Bf-extensions-cvs
mailing list