[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [1963] trunk/py/scripts/addons/ io_scene_x3d/import_x3d.py: use standard os. path functions instead of our own.
Campbell Barton
ideasman42 at gmail.com
Tue May 24 18:46:55 CEST 2011
Revision: 1963
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-extensions&revision=1963
Author: campbellbarton
Date: 2011-05-24 16:46:55 +0000 (Tue, 24 May 2011)
Log Message:
-----------
use standard os.path functions instead of our own.
Modified Paths:
--------------
trunk/py/scripts/addons/io_scene_x3d/import_x3d.py
Modified: trunk/py/scripts/addons/io_scene_x3d/import_x3d.py
===================================================================
--- trunk/py/scripts/addons/io_scene_x3d/import_x3d.py 2011-05-24 06:13:05 UTC (rev 1962)
+++ trunk/py/scripts/addons/io_scene_x3d/import_x3d.py 2011-05-24 16:46:55 UTC (rev 1963)
@@ -21,19 +21,10 @@
DEBUG = False
# This should work without a blender at all
-from os.path import exists
+import os
-def baseName(path):
- return path.split('/')[-1].split('\\')[-1]
-
-
-def dirName(path):
- return path[:-len(baseName(path))]
-
-
def imageConvertCompat(path):
-
try:
import os
except:
@@ -51,7 +42,7 @@
# print('\n'+path+'\n'+path_to+'\n')
os.system('convert "%s" "%s"' % (path, path_to)) # for now just hope we have image magick
- if exists(path_to):
+ if os.path.exists(path_to):
return path_to
return path
@@ -957,14 +948,14 @@
urls.append(url)
urls.append(bpy.path.resolve_ncase(urls[-1]))
- urls.append(dirName(self.getFilename()) + url)
+ urls.append(os.path.join(os.path.dirname(self.getFilename()), url))
urls.append(bpy.path.resolve_ncase(urls[-1]))
- urls.append(dirName(self.getFilename()) + baseName(url))
+ urls.append(os.path.join(os.path.dirname(self.getFilename()), os.path.basename(url)))
urls.append(bpy.path.resolve_ncase(urls[-1]))
try:
- url = [url for url in urls if exists(url)][0]
+ url = [url for url in urls if os.path.exists(url)][0]
url_found = True
except:
url_found = False
@@ -2122,7 +2113,7 @@
if ima_url is None:
print("\twarning, image with no URL, this is odd")
else:
- bpyima = image_utils.image_load(ima_url, dirName(node.getFilename()), place_holder=False, recursive=False, convert_callback=imageConvertCompat)
+ bpyima = image_utils.image_load(ima_url, os.path.dirname(node.getFilename()), place_holder=False, recursive=False, convert_callback=imageConvertCompat)
if bpyima:
texture = bpy.data.textures.new("XXX", 'IMAGE')
texture.image = bpyima
More information about the Bf-extensions-cvs
mailing list