From 70254c0c5e656ed5d0282d946b8e85b5ed85efb9 Mon Sep 17 00:00:00 2001 From: Campbell Barton <ideasman42@gmail.com> Date: Wed, 20 Jul 2011 08:10:59 +0000 Subject: [PATCH] fix [#28028] 3ds export fails due to relative paths in windows --- io_export_directx_x.py | 2 +- io_scene_3ds/export_3ds.py | 2 +- io_scene_fbx/export_fbx.py | 4 ++-- io_scene_map/export_map.py | 4 ++-- io_scene_x3d/export_x3d.py | 4 ++-- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/io_export_directx_x.py b/io_export_directx_x.py index 7b36afa9e..eaa4cbe2a 100644 --- a/io_export_directx_x.py +++ b/io_export_directx_x.py @@ -199,7 +199,7 @@ def GetMaterialTexture(Material): #Create a list of Textures that have type "IMAGE" ImageTextures = [Material.texture_slots[TextureSlot].texture for TextureSlot in Material.texture_slots.keys() if Material.texture_slots[TextureSlot].texture.type == "IMAGE"] #Refine a new list with only image textures that have a file source - ImageFiles = [os.path.basename(Texture.image.filepath[2:]) for Texture in ImageTextures if Texture.image.source == "FILE"] + ImageFiles = [bpy.path.basename(Texture.image.filepath) for Texture in ImageTextures if getattr(Texture.image, "source", "") == "FILE"] if ImageFiles: return ImageFiles[0] return None diff --git a/io_scene_3ds/export_3ds.py b/io_scene_3ds/export_3ds.py index 8264c18d5..d25672ef5 100644 --- a/io_scene_3ds/export_3ds.py +++ b/io_scene_3ds/export_3ds.py @@ -448,7 +448,7 @@ def make_material_texture_chunk(id, images): def add_image(img): import os - filename = os.path.basename(image.filepath) + filename = bpy.path.basename(image.filepath) mat_sub_file = _3ds_chunk(MATMAPFILE) mat_sub_file.add_variable("mapfile", _3ds_string(sane_name(filename))) mat_sub.add_subchunk(mat_sub_file) diff --git a/io_scene_fbx/export_fbx.py b/io_scene_fbx/export_fbx.py index 7f0246e7f..8e34d45de 100644 --- a/io_scene_fbx/export_fbx.py +++ b/io_scene_fbx/export_fbx.py @@ -1090,7 +1090,7 @@ def save_single(operator, scene, filepath="", Property: "Height", "int", "",0''') if tex: fname_rel = bpy_extras.io_utils.path_reference(tex.filepath, base_src, base_dst, path_mode, "", copy_set) - fname_strip = os.path.basename(fname_rel) + fname_strip = bpy.path.basename(fname_rel) else: fname_strip = fname_rel = "" @@ -1149,7 +1149,7 @@ def save_single(operator, scene, filepath="", if tex: fname_rel = bpy_extras.io_utils.path_reference(tex.filepath, base_src, base_dst, path_mode, "", copy_set) - fname_strip = os.path.basename(fname_rel) + fname_strip = bpy.path.basename(bpy.path.abspath(fname_rel)) else: fname_strip = fname_rel = "" diff --git a/io_scene_map/export_map.py b/io_scene_map/export_map.py index 0ed01c8da..8feb2cc83 100644 --- a/io_scene_map/export_map.py +++ b/io_scene_map/export_map.py @@ -75,7 +75,7 @@ def write_cube2brush(file, faces): image = uf.image if uf else None if image: - file.write(os.path.splitext(os.path.basename(image.filepath))[0]) + file.write(os.path.splitext(bpy.path.basename(image.filepath))[0]) else: file.write(PREF_NULL_TEX) @@ -112,7 +112,7 @@ def write_face2brush(file, face): image = uf.image if uf else None if image: - image_text = os.path.splitext(os.path.basename(image.filepath))[0] + image_text = os.path.splitext(bpy.path.basename(image.filepath))[0] # reuse face vertices _v = face.id_data.vertices # XXX25 diff --git a/io_scene_x3d/export_x3d.py b/io_scene_x3d/export_x3d.py index 823b8ff46..a9e87587a 100644 --- a/io_scene_x3d/export_x3d.py +++ b/io_scene_x3d/export_x3d.py @@ -1084,7 +1084,7 @@ def export(file, filepath = image.filepath filepath_full = bpy.path.abspath(filepath) filepath_ref = bpy_extras.io_utils.path_reference(filepath_full, base_src, base_dst, path_mode, "textures", copy_set) - filepath_base = os.path.basename(filepath_ref) + filepath_base = os.path.basename(filepath_full) images = [ filepath_base, @@ -1150,7 +1150,7 @@ def export(file, if tex.type == 'IMAGE' and tex.image: namemat = tex.name pic = tex.image - basename = os.path.basename(bpy.path.abspath(pic.filepath)) + basename = bpy.path.basename(pic.filepath) if namemat == 'back': fw(ident_step + 'backUrl="%s"\n' % basename) -- GitLab