st = Statement("inherit", material.technique)
for s, t in textures.items():
- if t.default_filter:
- st.sub.append(Statement("texture", s, image_name(t.image)))
+ if t.default_filter and t.image.filepath:
+ st.sub.append(Statement("texture", s, os.path.basename(t.image.filepath)))
else:
st.sub.append(tech_res.create_reference_statement("texture", s, resources[t.name+".tex2d"]))
if material.override_material:
ss = Statement("texunit", 0)
if self.single_file:
ss.sub.append(tech_res.create_embed_statement("texture2d", tex_res))
- elif not diffuse_tex.default_filter:
- ss.sub.append(tech_res.create_reference_statement("texture", tex_res))
+ elif diffuse_tex.default_filter and diffuse_tex.image.filepath:
+ ss.sub.append(Statement("texture", os.path.basename(diffuse_tex.image.filepath)))
else:
- ss.sub.append(Statement("texture", image_name(diffuse_tex.image)))
+ ss.sub.append(tech_res.create_reference_statement("texture", tex_res))
st.sub.append(ss)
tech_res.statements.append(st)
+import os
+
class TextureExporter:
def __init__(self):
self.inline_data = True
else:
tex_res.statements.append(Statement("min_filter", Token('NEAREST')))
- if not self.inline_data:
+ if not self.inline_data and texture.image.filepath:
from .util import image_name
- tex_res.statements.append(Statement("external_image", image_name(texture.image)))
+ tex_res.statements.append(Statement("external_image", os.path.basename(texture.image.filepath)))
else:
texdata = ""
colorspace = texture.image.colorspace_settings.name