[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [2145] trunk/py/scripts/addons: fix [ #28028] 3ds export fails due to relative paths in windows
Campbell Barton
ideasman42 at gmail.com
Wed Jul 20 10:10:59 CEST 2011
Revision: 2145
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-extensions&revision=2145
Author: campbellbarton
Date: 2011-07-20 08:10:59 +0000 (Wed, 20 Jul 2011)
Log Message:
-----------
fix [#28028] 3ds export fails due to relative paths in windows
Modified Paths:
--------------
trunk/py/scripts/addons/io_export_directx_x.py
trunk/py/scripts/addons/io_scene_3ds/export_3ds.py
trunk/py/scripts/addons/io_scene_fbx/export_fbx.py
trunk/py/scripts/addons/io_scene_map/export_map.py
trunk/py/scripts/addons/io_scene_x3d/export_x3d.py
Modified: trunk/py/scripts/addons/io_export_directx_x.py
===================================================================
--- trunk/py/scripts/addons/io_export_directx_x.py 2011-07-20 07:36:50 UTC (rev 2144)
+++ trunk/py/scripts/addons/io_export_directx_x.py 2011-07-20 08:10:59 UTC (rev 2145)
@@ -199,7 +199,7 @@
#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
Modified: trunk/py/scripts/addons/io_scene_3ds/export_3ds.py
===================================================================
--- trunk/py/scripts/addons/io_scene_3ds/export_3ds.py 2011-07-20 07:36:50 UTC (rev 2144)
+++ trunk/py/scripts/addons/io_scene_3ds/export_3ds.py 2011-07-20 08:10:59 UTC (rev 2145)
@@ -448,7 +448,7 @@
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)
Modified: trunk/py/scripts/addons/io_scene_fbx/export_fbx.py
===================================================================
--- trunk/py/scripts/addons/io_scene_fbx/export_fbx.py 2011-07-20 07:36:50 UTC (rev 2144)
+++ trunk/py/scripts/addons/io_scene_fbx/export_fbx.py 2011-07-20 08:10:59 UTC (rev 2145)
@@ -1090,7 +1090,7 @@
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 @@
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 = ""
Modified: trunk/py/scripts/addons/io_scene_map/export_map.py
===================================================================
--- trunk/py/scripts/addons/io_scene_map/export_map.py 2011-07-20 07:36:50 UTC (rev 2144)
+++ trunk/py/scripts/addons/io_scene_map/export_map.py 2011-07-20 08:10:59 UTC (rev 2145)
@@ -75,7 +75,7 @@
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 @@
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
Modified: trunk/py/scripts/addons/io_scene_x3d/export_x3d.py
===================================================================
--- trunk/py/scripts/addons/io_scene_x3d/export_x3d.py 2011-07-20 07:36:50 UTC (rev 2144)
+++ trunk/py/scripts/addons/io_scene_x3d/export_x3d.py 2011-07-20 08:10:59 UTC (rev 2145)
@@ -1084,7 +1084,7 @@
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 @@
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)
More information about the Bf-extensions-cvs
mailing list