py api: bpy.path.abspath(), option to return relative to a path other then the curren...
authorCampbell Barton <ideasman42@gmail.com>
Sat, 15 Jan 2011 20:35:31 +0000 (20:35 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Sat, 15 Jan 2011 20:35:31 +0000 (20:35 +0000)
release/scripts/modules/bpy/path.py

index 044052883c643d7048a534ea3cfc12c6776c2238..e131be648cebf0f2c927d2434b9de75cf34e1b7a 100644 (file)
@@ -27,12 +27,15 @@ import bpy as _bpy
 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