]> git.tdb.fi Git - libs/gl.git/commitdiff
Use bpy.path.basename instead of a custom function
authorMikko Rasa <tdb@tdb.fi>
Sun, 6 Mar 2022 10:32:49 +0000 (12:32 +0200)
committerMikko Rasa <tdb@tdb.fi>
Sun, 6 Mar 2022 10:32:49 +0000 (12:32 +0200)
blender/io_mspgl/export_material.py
blender/io_mspgl/export_texture.py
blender/io_mspgl/util.py

index 9ec0670a96d2190860f7af70e5f7447398c1fc02..4941a5851d1b34592e567f80c08cb33af0e919fd 100644 (file)
@@ -124,7 +124,6 @@ class MaterialExporter:
                from .datafile import Statement
                if prop.texture:
                        tex_res = resources[prop.texture.image.name+".tex"]
-                       from .util import basename
                        return mat_res.create_reference_statement(prop.tex_keyword, tex_res)
                elif not prop.keyword:
                        return
index eb6fa223cf1f8d0f31d903daa5d9ac9229effd7f..e03b1b0c9185f09d44fc1a96f0d9ce42678965de 100644 (file)
@@ -1,6 +1,7 @@
 import os
 import base64
 import codecs
+import bpy
 
 def pixels_to_rgba(pixels):
        return (int(p*255) for p in pixels)
@@ -41,8 +42,7 @@ class TextureExporter:
 
                invert_mask = sum(1<<i for i, c in enumerate(channels) if c[0]=='~')
 
-               from .util import basename
-               fn = basename(image.filepath)
+               fn = bpy.path.basename(image.filepath)
                if not invert_mask and fn:
                        if not tex_node.use_mipmap:
                                tex_res.statements.append(Statement("mipmap_levels", 1))
index 8ca41bd8e845657edf33463dd643e259c80afc3d..318b9ce996dd165a2da34aa7ce0f558bce8d35ee 100644 (file)
@@ -12,11 +12,6 @@ def get_colormap(srgb):
        else:
                return lambda x: x
 
-def basename(path):
-       if path.startswith("//"):
-               path = path[2:]
-       return os.path.basename(path)
-
 def make_unique(values):
        seen = set()
        result = []