Skip to content
Snippets Groups Projects
Commit 9d96ea82 authored by Campbell Barton's avatar Campbell Barton
Browse files

bugfix [#25642] Export to X3D TextureImage url field is empty

export multiple image paths.
parent fa68b830
No related branches found
No related tags found
No related merge requests found
...@@ -578,14 +578,26 @@ class x3d_class: ...@@ -578,14 +578,26 @@ class x3d_class:
def writeImageTexture(self, image): def writeImageTexture(self, image):
name = image.name name = image.name
filepath = os.path.basename(image.filepath)
if image.tag: if image.tag:
self.write_indented("<ImageTexture USE=\"%s\" />\n" % self.cleanStr(name)) self.write_indented("<ImageTexture USE=\"%s\" />\n" % self.cleanStr(name))
else: else:
image.tag = True image.tag = True
self.write_indented("<ImageTexture DEF=\"%s\" " % self.cleanStr(name), 1) 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) self.write_indented("\n", -1)
def writeBackground(self, world, alltextures): def writeBackground(self, world, alltextures):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment