blocks2assets: debug filepath on reading unsupported blocks (#92885)

When logging that there is no reader implemented for a certain
data-block type, include the filepath of the blend file that contains
that data-block.

Reviewed-on: https://projects.blender.org/blender/blender-asset-tracer/pulls/92885
This commit is contained in:
Olivier Charvin 2023-12-18 17:57:42 +01:00 committed by Sybren A. Stüvel
parent 47e7c00845
commit 2099827554

View File

@ -44,8 +44,19 @@ def iter_assets(block: blendfile.BlendFileBlock) -> typing.Iterator[result.Block
try: try:
block_reader = _funcs_for_code[block.code] block_reader = _funcs_for_code[block.code]
except KeyError: except KeyError:
if block.code not in _warned_about_types: if block.code in _warned_about_types:
log.debug("No reader implemented for block type %r", block.code.decode()) return
blocktype = block.code.decode()
filepath = block.get(b"filepath", "", as_str=True)
if filepath:
log.debug(
"No reader implemented for block type %r (filepath=%r)",
blocktype,
filepath,
)
else:
log.debug("No reader implemented for block type %r", blocktype)
_warned_about_types.add(block.code) _warned_about_types.add(block.code)
return return