forked from bartvdbraak/blender
py api: bpy.path.abspath(), option to return relative to a path other then the current blend file.
This commit is contained in:
parent
fd7b6519fd
commit
743182106f
@ -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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user