Also report library blocks.
Those are needed for recursive tracing of dependencies.
This commit is contained in:
parent
0d7bbb34f0
commit
7541922b74
@ -8,7 +8,6 @@ from . import result, block_walkers
|
|||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
codes_to_skip = {
|
codes_to_skip = {
|
||||||
b'LI', # Library blocks we handle after the blend file itself.
|
|
||||||
b'ID', b'WM', b'SN', # These blocks never have external assets.
|
b'ID', b'WM', b'SN', # These blocks never have external assets.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -69,6 +69,16 @@ def _from_block_im(block: blendfile.BlendFileBlock) -> typing.Iterator[result.Bl
|
|||||||
yield result.BlockUsage(block, pathname, is_sequence, path_full_field=field)
|
yield result.BlockUsage(block, pathname, is_sequence, path_full_field=field)
|
||||||
|
|
||||||
|
|
||||||
|
def _from_block_li(block: blendfile.BlendFileBlock) -> typing.Iterator[result.BlockUsage]:
|
||||||
|
"""Library data blocks."""
|
||||||
|
path, field = block.get(b'name', return_field=True)
|
||||||
|
yield result.BlockUsage(block, path, path_full_field=field)
|
||||||
|
|
||||||
|
# The 'filepath' also points to the blend file. However, this is set to the
|
||||||
|
# absolute path of the file by Blender (see BKE_library_filepath_set). This
|
||||||
|
# is thus not a property we have to report or rewrite.
|
||||||
|
|
||||||
|
|
||||||
def _from_block_me(block: blendfile.BlendFileBlock) -> typing.Iterator[result.BlockUsage]:
|
def _from_block_me(block: blendfile.BlendFileBlock) -> typing.Iterator[result.BlockUsage]:
|
||||||
"""Mesh data blocks."""
|
"""Mesh data blocks."""
|
||||||
block_external = block.get_pointer((b'ldata', b'external'), None)
|
block_external = block.get_pointer((b'ldata', b'external'), None)
|
||||||
|
|||||||
Binary file not shown.
@ -76,9 +76,11 @@ class DepsTest(AbstractTracerTest):
|
|||||||
if exp.basename_field is not None:
|
if exp.basename_field is not None:
|
||||||
self.assertEqual(exp.basename_field, dep.path_base_field.name.name_full.decode())
|
self.assertEqual(exp.basename_field, dep.path_base_field.name.name_full.decode())
|
||||||
|
|
||||||
del expects[dep.block_name] # should be seen only once
|
# Each expectation should be seen only once.
|
||||||
|
del expects[dep.block_name]
|
||||||
|
|
||||||
# All expected uses should have been seen.
|
# All expected uses should have been seen.
|
||||||
self.assertEqual({}, expects)
|
self.assertEqual({}, expects, 'Expected results were not seen.')
|
||||||
|
|
||||||
def test_no_deps(self):
|
def test_no_deps(self):
|
||||||
self.assert_deps('basic_file.blend', {})
|
self.assert_deps('basic_file.blend', {})
|
||||||
@ -154,3 +156,8 @@ class DepsTest(AbstractTracerTest):
|
|||||||
b'VFHack-Bold': Expect('VFont', 'name[1024]', None, None,
|
b'VFHack-Bold': Expect('VFont', 'name[1024]', None, None,
|
||||||
b'/usr/share/fonts/truetype/hack/Hack-Bold.ttf', False),
|
b'/usr/share/fonts/truetype/hack/Hack-Bold.ttf', False),
|
||||||
})
|
})
|
||||||
|
|
||||||
|
def test_block_li(self):
|
||||||
|
self.assert_deps('linked_cube.blend', {
|
||||||
|
b'LILib': Expect('Library', 'name[1024]', None, None, b'//basic_file.blend', False),
|
||||||
|
})
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user