BAT Looks for Packed Linked Blend files on the file system. #74871

Open
opened 2020-03-18 10:01:35 +01:00 by Jeroen Bakker · 1 comment
Member

When using BAT with a blend file containing Packed Linked Blend files it fails to detect the packed files as packed and search them on the file system in stead.
Bigger studios use the Pack Blender Libraries operator to extract a short and send them to a render farm. It is a simpler version of BAT still I do think we could support this scenario.

This blend file is has a linked library inside. When using BAT to extract it gives me the next error
B.blend

INFO:render_polargrid.polargrid_upload:Starting BAT Pack operation
INFO:blender_asset_tracer.trace:opening: /home/jeroen/Downloads/B.polar
DEBUG:blender_asset_tracer.blendfile.open_cached:Opening non-cached /home/jeroen/Downloads/B.polar
DEBUG:blender_asset_tracer.blendfile:compressed blendfile detected: /home/jeroen/Downloads/B.polar
DEBUG:blender_asset_tracer.blendfile.header:reading blend-file-header /tmp/tmp_f8mw775
DEBUG:blender_asset_tracer.blendfile.BlendFile:building DNA catalog
DEBUG:blender_asset_tracer.blendfile.BlendFile:building #4486 names
DEBUG:blender_asset_tracer.blendfile.BlendFile:building #771 types
DEBUG:blender_asset_tracer.blendfile.BlendFile:building #771 type-lengths
DEBUG:blender_asset_tracer.blendfile:building #664 structures
INFO:render_polargrid.polargrid_upload:Inspecting B.polar
INFO:blender_asset_tracer.trace.file2blocks:inspecting: /home/jeroen/Downloads/B.polar
DEBUG:blender_asset_tracer.trace.file2blocks:Queueing all blocks from file /home/jeroen/Downloads/B.polar
DEBUG:blender_asset_tracer.trace.blocks2assets:No reader implemented for block type 'WS'
DEBUG:blender_asset_tracer.trace.blocks2assets:Tracing block <BlendFileBlock.Scene (SC), size=6400 at 0x7f09076efc08>
DEBUG:blender_asset_tracer.trace.blocks2assets:Tracing block <BlendFileBlock.Object (OB), size=1416 at 0x7f08dc4b4c08>
DEBUG:blender_asset_tracer.trace.blocks2assets:Tracing block <BlendFileBlock.Object (OB), size=1416 at 0x7f08dc4b5208>
DEBUG:blender_asset_tracer.trace.blocks2assets:Tracing block <BlendFileBlock.Object (OB), size=1416 at 0x7f08dc4b5808>
DEBUG:blender_asset_tracer.trace.blocks2assets:No reader implemented for block type 'CA'
DEBUG:blender_asset_tracer.trace.blocks2assets:No reader implemented for block type 'LA'
DEBUG:blender_asset_tracer.trace.blocks2assets:Tracing block <BlendFileBlock.Mesh (ME), size=1576 at 0x7f08dc0bfe08>
DEBUG:blender_asset_tracer.trace.blocks2assets:No reader implemented for block type 'MA'
DEBUG:blender_asset_tracer.trace.blocks2assets:Tracing block <BlendFileBlock.Image (IM), size=1504 at 0x7f08dc4b5e08>
DEBUG:blender_asset_tracer.trace.blocks2assets:No reader implemented for block type 'PL'
DEBUG:blender_asset_tracer.trace.blocks2assets:Tracing block <BlendFileBlock.Library (LI), size=2240 at 0x7f08dce6c808>
DEBUG:blender_asset_tracer.blendfile.BlendFile.abspath:Resolved //A.blend relative to /home/jeroen/Downloads/B.polar to /home/jeroen/Downloads/A.blend
INFO:blender_asset_tracer.trace.result:Resolving //A.blend rel to /home/jeroen/Downloads/B.polar -> /home/jeroen/Downloads/A.blend
WARNING:blender_asset_tracer.pack:Missing file: /home/jeroen/Downloads/A.blend
DEBUG:blender_asset_tracer.trace.file2blocks:Expanding 1 blocks in /home/jeroen/Downloads/A.blend
DEBUG:blender_asset_tracer.blendfile.open_cached:Opening non-cached /home/jeroen/Downloads/A.blend
ERROR:render_polargrid.async_loop.AsyncModalOperatorMixin:Exception while running task: [Errno 2] No such file or directory: '/home/jeroen/Downloads/A.blend'
DEBUG:render_polargrid.async_loop.AsyncModalOperatorMixin:Stopping async task
INFO:render_polargrid.async_loop.AsyncModalOperatorMixin:Signalling that we want to cancel anything that's running.
ERROR:render_polargrid.async_loop.AsyncModalOperatorMixin:Exception from asynchronous task
Traceback (most recent call last):
  File "/home/jeroen/.config/blender/2.83/scripts/addons/render_polargrid/wheels/blender_asset_tracer-1.2.1-py3-none-any.whl/blender_asset_tracer/blendfile/__init__.py", line 62, in open_cached
    bfile = _cached_bfiles[bfile_path]
KeyError: PosixPath('/home/jeroen/Downloads/A.blend')

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/jeroen/.config/blender/2.83/scripts/addons/render_polargrid/async_loop.py", line 279, in _stop_async_task
    self.async_task.result()  # This re-raises any exception of the task.
  File "/home/jeroen/.config/blender/2.83/scripts/addons/render_polargrid/space_properties.py", line 175, in async_execute
    client=client)
  File "/home/jeroen/.config/blender/2.83/scripts/addons/render_polargrid/polargrid_upload.py", line 131, in copy
    await loop.run_in_executor(None, packer.strategise)
  File "/home/jeroen/blender-git/build_linux/bin/2.83/python/lib/python3.7/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/jeroen/.config/blender/2.83/scripts/addons/render_polargrid/wheels/blender_asset_tracer-1.2.1-py3-none-any.whl/blender_asset_tracer/pack/__init__.py", line 250, in strategise
    for usage in trace.deps(self.blendfile, self._progress_cb):
  File "/home/jeroen/.config/blender/2.83/scripts/addons/render_polargrid/wheels/blender_asset_tracer-1.2.1-py3-none-any.whl/blender_asset_tracer/trace/__init__.py", line 58, in deps
    for block in asset_holding_blocks(bi.iter_blocks(bfile)):
  File "/home/jeroen/.config/blender/2.83/scripts/addons/render_polargrid/wheels/blender_asset_tracer-1.2.1-py3-none-any.whl/blender_asset_tracer/trace/__init__.py", line 70, in asset_holding_blocks
    for block in blocks:
  File "/home/jeroen/.config/blender/2.83/scripts/addons/render_polargrid/wheels/blender_asset_tracer-1.2.1-py3-none-any.whl/blender_asset_tracer/trace/file2blocks.py", line 82, in iter_blocks
    yield from self._visit_linked_blocks(blocks_per_lib)
  File "/home/jeroen/.config/blender/2.83/scripts/addons/render_polargrid/wheels/blender_asset_tracer-1.2.1-py3-none-any.whl/blender_asset_tracer/trace/file2blocks.py", line 134, in _visit_linked_blocks
    libfile = blendfile.open_cached(lib_path)
  File "/home/jeroen/.config/blender/2.83/scripts/addons/render_polargrid/wheels/blender_asset_tracer-1.2.1-py3-none-any.whl/blender_asset_tracer/blendfile/__init__.py", line 65, in open_cached
    bfile = BlendFile(path, mode=mode)
  File "/home/jeroen/.config/blender/2.83/scripts/addons/render_polargrid/wheels/blender_asset_tracer-1.2.1-py3-none-any.whl/blender_asset_tracer/blendfile/__init__.py", line 119, in __init__
    self.fileobj = self._open_file(path, mode)
  File "/home/jeroen/.config/blender/2.83/scripts/addons/render_polargrid/wheels/blender_asset_tracer-1.2.1-py3-none-any.whl/blender_asset_tracer/blendfile/__init__.py", line 149, in _open_file
    fileobj = path.open(mode, buffering=FILE_BUFFER_SIZE)  # typing.IO[bytes]
  File "/home/jeroen/blender-git/build_linux/bin/2.83/python/lib/python3.7/pathlib.py", line 1193, in open
    opener=self._opener)
  File "/home/jeroen/blender-git/build_linux/bin/2.83/python/lib/python3.7/pathlib.py", line 1046, in _opener
    return self._accessor.open(self, flags, mode)
FileNotFoundError: [Errno 2] No such file or directory: '/home/jeroen/Downloads/A.blend'
DEBUG:render_polargrid.async_loop:all 2 tasks are done, fetching results and stopping after this kick.
DEBUG:render_polargrid.async_loop:   task #0: result=None
<Task finished coro=<PGRenderOperator.async_execute() done, defined at /home/jeroen/.config/blender/2.83/scripts/addons/render_polargrid/space_properties.py:134> exception=FileNotFoundError(2, 'No such file or directory')>: resulted in exception
Traceback (most recent call last):
  File "/home/jeroen/.config/blender/2.83/scripts/addons/render_polargrid/wheels/blender_asset_tracer-1.2.1-py3-none-any.whl/blender_asset_tracer/blendfile/__init__.py", line 62, in open_cached
    bfile = _cached_bfiles[bfile_path]
KeyError: PosixPath('/home/jeroen/Downloads/A.blend')

Steps to reproduce the issue

  1. Save default scene to A.blend
  2. Save file to B.blend
  3. Link cube from A.blend into B.blend
  4. Perform Pack Blender Libraries operation
  5. Save B.blend
  6. Use BAT on B.blend
When using BAT with a blend file containing Packed Linked Blend files it fails to detect the packed files as packed and search them on the file system in stead. Bigger studios use the `Pack Blender Libraries` operator to extract a short and send them to a render farm. It is a simpler version of BAT still I do think we could support this scenario. This blend file is has a linked library inside. When using BAT to extract it gives me the next error [B.blend](https://archive.blender.org/developer/F8413495/B.blend) ``` INFO:render_polargrid.polargrid_upload:Starting BAT Pack operation INFO:blender_asset_tracer.trace:opening: /home/jeroen/Downloads/B.polar DEBUG:blender_asset_tracer.blendfile.open_cached:Opening non-cached /home/jeroen/Downloads/B.polar DEBUG:blender_asset_tracer.blendfile:compressed blendfile detected: /home/jeroen/Downloads/B.polar DEBUG:blender_asset_tracer.blendfile.header:reading blend-file-header /tmp/tmp_f8mw775 DEBUG:blender_asset_tracer.blendfile.BlendFile:building DNA catalog DEBUG:blender_asset_tracer.blendfile.BlendFile:building #4486 names DEBUG:blender_asset_tracer.blendfile.BlendFile:building #771 types DEBUG:blender_asset_tracer.blendfile.BlendFile:building #771 type-lengths DEBUG:blender_asset_tracer.blendfile:building #664 structures INFO:render_polargrid.polargrid_upload:Inspecting B.polar INFO:blender_asset_tracer.trace.file2blocks:inspecting: /home/jeroen/Downloads/B.polar DEBUG:blender_asset_tracer.trace.file2blocks:Queueing all blocks from file /home/jeroen/Downloads/B.polar DEBUG:blender_asset_tracer.trace.blocks2assets:No reader implemented for block type 'WS' DEBUG:blender_asset_tracer.trace.blocks2assets:Tracing block <BlendFileBlock.Scene (SC), size=6400 at 0x7f09076efc08> DEBUG:blender_asset_tracer.trace.blocks2assets:Tracing block <BlendFileBlock.Object (OB), size=1416 at 0x7f08dc4b4c08> DEBUG:blender_asset_tracer.trace.blocks2assets:Tracing block <BlendFileBlock.Object (OB), size=1416 at 0x7f08dc4b5208> DEBUG:blender_asset_tracer.trace.blocks2assets:Tracing block <BlendFileBlock.Object (OB), size=1416 at 0x7f08dc4b5808> DEBUG:blender_asset_tracer.trace.blocks2assets:No reader implemented for block type 'CA' DEBUG:blender_asset_tracer.trace.blocks2assets:No reader implemented for block type 'LA' DEBUG:blender_asset_tracer.trace.blocks2assets:Tracing block <BlendFileBlock.Mesh (ME), size=1576 at 0x7f08dc0bfe08> DEBUG:blender_asset_tracer.trace.blocks2assets:No reader implemented for block type 'MA' DEBUG:blender_asset_tracer.trace.blocks2assets:Tracing block <BlendFileBlock.Image (IM), size=1504 at 0x7f08dc4b5e08> DEBUG:blender_asset_tracer.trace.blocks2assets:No reader implemented for block type 'PL' DEBUG:blender_asset_tracer.trace.blocks2assets:Tracing block <BlendFileBlock.Library (LI), size=2240 at 0x7f08dce6c808> DEBUG:blender_asset_tracer.blendfile.BlendFile.abspath:Resolved //A.blend relative to /home/jeroen/Downloads/B.polar to /home/jeroen/Downloads/A.blend INFO:blender_asset_tracer.trace.result:Resolving //A.blend rel to /home/jeroen/Downloads/B.polar -> /home/jeroen/Downloads/A.blend WARNING:blender_asset_tracer.pack:Missing file: /home/jeroen/Downloads/A.blend DEBUG:blender_asset_tracer.trace.file2blocks:Expanding 1 blocks in /home/jeroen/Downloads/A.blend DEBUG:blender_asset_tracer.blendfile.open_cached:Opening non-cached /home/jeroen/Downloads/A.blend ERROR:render_polargrid.async_loop.AsyncModalOperatorMixin:Exception while running task: [Errno 2] No such file or directory: '/home/jeroen/Downloads/A.blend' DEBUG:render_polargrid.async_loop.AsyncModalOperatorMixin:Stopping async task INFO:render_polargrid.async_loop.AsyncModalOperatorMixin:Signalling that we want to cancel anything that's running. ERROR:render_polargrid.async_loop.AsyncModalOperatorMixin:Exception from asynchronous task Traceback (most recent call last): File "/home/jeroen/.config/blender/2.83/scripts/addons/render_polargrid/wheels/blender_asset_tracer-1.2.1-py3-none-any.whl/blender_asset_tracer/blendfile/__init__.py", line 62, in open_cached bfile = _cached_bfiles[bfile_path] KeyError: PosixPath('/home/jeroen/Downloads/A.blend') During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/jeroen/.config/blender/2.83/scripts/addons/render_polargrid/async_loop.py", line 279, in _stop_async_task self.async_task.result() # This re-raises any exception of the task. File "/home/jeroen/.config/blender/2.83/scripts/addons/render_polargrid/space_properties.py", line 175, in async_execute client=client) File "/home/jeroen/.config/blender/2.83/scripts/addons/render_polargrid/polargrid_upload.py", line 131, in copy await loop.run_in_executor(None, packer.strategise) File "/home/jeroen/blender-git/build_linux/bin/2.83/python/lib/python3.7/concurrent/futures/thread.py", line 57, in run result = self.fn(*self.args, **self.kwargs) File "/home/jeroen/.config/blender/2.83/scripts/addons/render_polargrid/wheels/blender_asset_tracer-1.2.1-py3-none-any.whl/blender_asset_tracer/pack/__init__.py", line 250, in strategise for usage in trace.deps(self.blendfile, self._progress_cb): File "/home/jeroen/.config/blender/2.83/scripts/addons/render_polargrid/wheels/blender_asset_tracer-1.2.1-py3-none-any.whl/blender_asset_tracer/trace/__init__.py", line 58, in deps for block in asset_holding_blocks(bi.iter_blocks(bfile)): File "/home/jeroen/.config/blender/2.83/scripts/addons/render_polargrid/wheels/blender_asset_tracer-1.2.1-py3-none-any.whl/blender_asset_tracer/trace/__init__.py", line 70, in asset_holding_blocks for block in blocks: File "/home/jeroen/.config/blender/2.83/scripts/addons/render_polargrid/wheels/blender_asset_tracer-1.2.1-py3-none-any.whl/blender_asset_tracer/trace/file2blocks.py", line 82, in iter_blocks yield from self._visit_linked_blocks(blocks_per_lib) File "/home/jeroen/.config/blender/2.83/scripts/addons/render_polargrid/wheels/blender_asset_tracer-1.2.1-py3-none-any.whl/blender_asset_tracer/trace/file2blocks.py", line 134, in _visit_linked_blocks libfile = blendfile.open_cached(lib_path) File "/home/jeroen/.config/blender/2.83/scripts/addons/render_polargrid/wheels/blender_asset_tracer-1.2.1-py3-none-any.whl/blender_asset_tracer/blendfile/__init__.py", line 65, in open_cached bfile = BlendFile(path, mode=mode) File "/home/jeroen/.config/blender/2.83/scripts/addons/render_polargrid/wheels/blender_asset_tracer-1.2.1-py3-none-any.whl/blender_asset_tracer/blendfile/__init__.py", line 119, in __init__ self.fileobj = self._open_file(path, mode) File "/home/jeroen/.config/blender/2.83/scripts/addons/render_polargrid/wheels/blender_asset_tracer-1.2.1-py3-none-any.whl/blender_asset_tracer/blendfile/__init__.py", line 149, in _open_file fileobj = path.open(mode, buffering=FILE_BUFFER_SIZE) # typing.IO[bytes] File "/home/jeroen/blender-git/build_linux/bin/2.83/python/lib/python3.7/pathlib.py", line 1193, in open opener=self._opener) File "/home/jeroen/blender-git/build_linux/bin/2.83/python/lib/python3.7/pathlib.py", line 1046, in _opener return self._accessor.open(self, flags, mode) FileNotFoundError: [Errno 2] No such file or directory: '/home/jeroen/Downloads/A.blend' DEBUG:render_polargrid.async_loop:all 2 tasks are done, fetching results and stopping after this kick. DEBUG:render_polargrid.async_loop: task #0: result=None <Task finished coro=<PGRenderOperator.async_execute() done, defined at /home/jeroen/.config/blender/2.83/scripts/addons/render_polargrid/space_properties.py:134> exception=FileNotFoundError(2, 'No such file or directory')>: resulted in exception Traceback (most recent call last): File "/home/jeroen/.config/blender/2.83/scripts/addons/render_polargrid/wheels/blender_asset_tracer-1.2.1-py3-none-any.whl/blender_asset_tracer/blendfile/__init__.py", line 62, in open_cached bfile = _cached_bfiles[bfile_path] KeyError: PosixPath('/home/jeroen/Downloads/A.blend') ``` ## Steps to reproduce the issue 1. Save default scene to A.blend 2. Save file to B.blend 3. Link cube from A.blend into B.blend 4. Perform `Pack Blender Libraries` operation 5. Save B.blend 6. Use BAT on B.blend
Author
Member

Added subscriber: @Jeroen-Bakker

Added subscriber: @Jeroen-Bakker
Sign in to join this conversation.
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender-asset-tracer#74871
No description provided.