From 743182106fcbc759ee443502b28211e503682c56 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 15 Jan 2011 20:35:31 +0000 Subject: [PATCH] py api: bpy.path.abspath(), option to return relative to a path other then the current blend file. --- release/scripts/modules/bpy/path.py | 7 +++++-- 1 file 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