diff options
author | Campbell Barton <ideasman42@gmail.com> | 2011-10-11 08:09:11 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2011-10-11 08:09:11 +0400 |
commit | fa5275cdfa136dd81a15cd2d37f8dadf77f7bcee (patch) | |
tree | 6cd4a69631fdcc6df942c1825f2cb191f883c2f6 /release/scripts/modules | |
parent | e8bcccae33cc9df93b7ab25a51326962fc9e8bf4 (diff) |
- bpy.path.abspath(), added optional library argument since any paths from linked datablocks are relative to this, not the blend files path, this saves kludgy path code wherever libraries may be used.
- Image "Edit Externally" operator can now edit relative library images.
also minor edits to navmesh.
Diffstat (limited to 'release/scripts/modules')
-rw-r--r-- | release/scripts/modules/bpy/path.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/release/scripts/modules/bpy/path.py b/release/scripts/modules/bpy/path.py index 284fef97795..c8a78d521d5 100644 --- a/release/scripts/modules/bpy/path.py +++ b/release/scripts/modules/bpy/path.py @@ -40,7 +40,7 @@ import bpy as _bpy import os as _os -def abspath(path, start=None): +def abspath(path, start=None, library=None): """ Returns the absolute path relative to the current blend file using the "//" prefix. @@ -48,8 +48,13 @@ def abspath(path, start=None): :arg start: Relative to this path, when not set the current filename is used. :type start: string + :arg library: The library this path is from. This is only included for + convenience, when the library is not None its path replaces *start*. + :type library: :class:`bpy.types.Library` """ if path.startswith("//"): + if library: + start = abspath(_os.path.dirname(library.filepath)) return _os.path.join(_os.path.dirname(_bpy.data.filepath) if start is None else start, path[2:], |