[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [34339] trunk/blender/release/scripts/ modules/bpy/path.py: py api: bpy.path.abspath(), option to return relative to a path other then the current blend file.

Campbell Barton ideasman42 at gmail.com
Sat Jan 15 21:35:32 CET 2011


Revision: 34339
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=34339
Author:   campbellbarton
Date:     2011-01-15 20:35:31 +0000 (Sat, 15 Jan 2011)
Log Message:
-----------
py api: bpy.path.abspath(), option to return relative to a path other then the current blend file.

Modified Paths:
--------------
    trunk/blender/release/scripts/modules/bpy/path.py

Modified: trunk/blender/release/scripts/modules/bpy/path.py
===================================================================
--- trunk/blender/release/scripts/modules/bpy/path.py	2011-01-15 19:36:01 UTC (rev 34338)
+++ trunk/blender/release/scripts/modules/bpy/path.py	2011-01-15 20:35:31 UTC (rev 34339)
@@ -27,12 +27,15 @@
 import os as _os
 
 
-def abspath(path):
+def abspath(path, start=None):
     """
     Returns the absolute path relative to the current blend file using the "//" prefix.
+
+    :arg start: Relative to this path, when not set the current filename is used.
+    :type start: string
     """
     if path.startswith("//"):
-        return _os.path.join(_os.path.dirname(_bpy.data.filepath), path[2:])
+        return _os.path.join(_os.path.dirname(_bpy.data.filepath if start is None else start), path[2:])
 
     return path
 




More information about the Bf-blender-cvs mailing list