Implemented simple 'bat pack' CLI command
No path rewriting yet, just simply copying the dependencies. They are copied to the target directory + the path relative to the current working directory. For example: bat pack scenes/05-barber/05_02_C-agent_focused/05_02_C.lighting.blend /tmp/packer will write to /tmp/packer/scenes/05-barber/05_02_C-agent_focused/05_02_C.lighting.blend and will copy ./path/to/file → /tmp/packer/path/to/file
This commit is contained in:
@@ -35,7 +35,7 @@ class _BlockIterator:
|
||||
limit_to: typing.Set[blendfile.BlendFileBlock] = frozenset(),
|
||||
) -> typing.Iterator[blendfile.BlendFileBlock]:
|
||||
"""Expand blocks with dependencies from other libraries."""
|
||||
bpath = bfile.filepath
|
||||
bpath = bfile.filepath.absolute().resolve()
|
||||
root_dir = bpathlib.BlendPath(bpath.parent)
|
||||
|
||||
# Mapping from library path to data blocks to expand.
|
||||
@@ -79,6 +79,12 @@ class _BlockIterator:
|
||||
# and iterate over the blocks referred there.
|
||||
for lib_bpath, idblocks in blocks_per_lib.items():
|
||||
lib_path = lib_bpath.to_path()
|
||||
try:
|
||||
lib_path = lib_path.resolve()
|
||||
except FileNotFoundError:
|
||||
log.warning('Library %s does not exist', lib_path)
|
||||
continue
|
||||
|
||||
log.debug('Expanding %d blocks in %s', len(idblocks), lib_path)
|
||||
|
||||
with blendfile.BlendFile(lib_path) as libfile:
|
||||
|
||||
Reference in New Issue
Block a user