X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=blender%2Fio_mspgl%2Fexport_texture.py;h=2ffb5246cf448839c9a594e1accd1397c018da79;hb=c3ebbcb56c1ca9bb3022a7f49aab1da5e09150ba;hp=2a736b84032e0df7dc76dd008718c9a24233316c;hpb=d14b33347983d1d0cd608b29b5ee9b7a37d98c5b;p=libs%2Fgl.git diff --git a/blender/io_mspgl/export_texture.py b/blender/io_mspgl/export_texture.py index 2a736b84..2ffb5246 100644 --- a/blender/io_mspgl/export_texture.py +++ b/blender/io_mspgl/export_texture.py @@ -16,7 +16,8 @@ class TextureExporter: if usage=='GRAY' and colorspace=='sRGB': raise Exception("Grayscale textures with sRGB colorspace are not supported") - fn = os.path.basename(image.filepath) + from .util import basename + fn = basename(image.filepath) if not self.inline_data and fn: srgb = "_srgb" if colorspace=='sRGB' else "" tex_res.statements.append(Statement("external_image"+srgb, fn)) @@ -63,6 +64,14 @@ class SamplerExporter: else: samp_res.statements.append(Statement("filter", Token('NEAREST'))) + if tex_node.extension=="REPEAT": + samp_res.statements.append(Statement("wrap", Token('REPEAT'))) + elif tex_node.extension=="EXTEND": + samp_res.statements.append(Statement("wrap", Token('CLAMP_TO_EDGE'))) + elif tex_node.extension=="CLIP": + samp_res.statements.append(Statement("wrap", Token('CLAMP_TO_BORDER'))) + samp_res.statements.append(Statement("border_color", 0.0, 0.0, 0.0, 0.0)) + return samp_res def get_sampler_name(self, tex_node): @@ -74,5 +83,7 @@ class SamplerExporter: name_parts.append("mip") if use_interpolation and tex_node.max_anisotropy>1: name_parts.append("aniso{:g}x".format(tex_node.max_anisotropy)) + if tex_node.extension!="REPEAT": + name_parts.append("clip" if tex_node.extension=="CLIP" else "clamp") return "_".join(name_parts)+".samp"