diff options
author | Campbell Barton <ideasman42@gmail.com> | 2011-01-15 23:35:31 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2011-01-15 23:35:31 +0300 |
commit | 743182106fcbc759ee443502b28211e503682c56 (patch) | |
tree | 149b01c6c64332ab2d53caa9e0282e0aba83b2da /release/scripts/modules/bpy/path.py | |
parent | fd7b6519fdf7c0a8b1f67fabd75ab210041fc56d (diff) |
py api: bpy.path.abspath(), option to return relative to a path other then the current blend file.
Diffstat (limited to 'release/scripts/modules/bpy/path.py')
-rw-r--r-- | release/scripts/modules/bpy/path.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/release/scripts/modules/bpy/path.py b/release/scripts/modules/bpy/path.py index 044052883c6..e131be648ce 100644 --- a/release/scripts/modules/bpy/path.py +++ b/release/scripts/modules/bpy/path.py @@ -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 |