Add support for indirectly linked Geometry Nodes node trees
This commit is contained in:
parent
e4bf2e8e35
commit
23dea91572
@ -9,6 +9,7 @@ changed functionality, fixed bugs).
|
||||
- When creating a BAT pack, mapped network drives are no longer changed from a drive letter to UNC notation. For example, when mapping a share `\\SERVER\Share` to drive letter `S:\`, BAT will now keep referencing `S:\` instead of rewriting paths to `\\SERVER\Share`.
|
||||
- Better handling of drive letters, and of paths that cross drive boundaries.
|
||||
- Better testing of Windows-specific cases when running the tests on Windows, and of POSIX-specific cases on other platforms.
|
||||
- Add support for Geometry Nodes modifier.
|
||||
|
||||
|
||||
## Version 1.2 (2019-10-09)
|
||||
|
||||
@ -60,3 +60,11 @@ def sequencer_strips(sequence_editor: BlendFileBlock) \
|
||||
|
||||
sbase = sequence_editor.get_pointer((b'seqbase', b'first'))
|
||||
yield from iter_seqbase(sbase)
|
||||
|
||||
|
||||
def modifiers(object_block: BlendFileBlock) -> typing.Iterator[BlendFileBlock]:
|
||||
"""Generator, yield the object's modifiers."""
|
||||
|
||||
# 'ob->modifiers[...]'
|
||||
mods = object_block.get_pointer((b'modifiers', b'first'))
|
||||
yield from listbase(mods, next_path=(b'modifier', b'next'))
|
||||
|
||||
@ -47,6 +47,7 @@ eModifierType_WeightVGProximity = 38
|
||||
eModifierType_Ocean = 39
|
||||
eModifierType_MeshCache = 46
|
||||
eModifierType_MeshSequenceCache = 52
|
||||
eModifierType_Nodes = 57
|
||||
|
||||
# DNA_particle_types.h
|
||||
PART_DRAW_OB = 7
|
||||
|
||||
@ -139,8 +139,7 @@ def object_block(block: blendfile.BlendFileBlock) -> typing.Iterator[result.Bloc
|
||||
ctx = modifier_walkers.ModifierContext(owner=block)
|
||||
|
||||
# 'ob->modifiers[...].filepath'
|
||||
mods = block.get_pointer((b'modifiers', b'first'))
|
||||
for mod_idx, block_mod in enumerate(iterators.listbase(mods, next_path=(b'modifier', b'next'))):
|
||||
for mod_idx, block_mod in enumerate(iterators.modifiers(block)):
|
||||
block_name = b'%s.modifiers[%d]' % (block.id_name, mod_idx)
|
||||
mod_type = block_mod[b'modifier', b'type']
|
||||
log.debug('Tracing modifier %s, type=%d', block_name.decode(), mod_type)
|
||||
|
||||
@ -224,6 +224,14 @@ def _expand_object(block: blendfile.BlendFileBlock):
|
||||
for psystem in iterators.listbase(psystems):
|
||||
yield psystem.get_pointer(b'part')
|
||||
|
||||
# Modifiers can also refer to other datablocks, which should also get expanded.
|
||||
for block_mod in iterators.modifiers(block):
|
||||
mod_type = block_mod[b'modifier', b'type']
|
||||
# Currently only node groups are supported. If the support should expand
|
||||
# to more types, something more intelligent than this should be made.
|
||||
if mod_type == cdefs.eModifierType_Nodes:
|
||||
yield block_mod.get_pointer(b'node_group')
|
||||
|
||||
|
||||
@dna_code('PA')
|
||||
def _expand_particle_settings(block: blendfile.BlendFileBlock):
|
||||
|
||||
BIN
tests/blendfiles/geometry-nodes/file_to_pack.blend
Normal file
BIN
tests/blendfiles/geometry-nodes/file_to_pack.blend
Normal file
Binary file not shown.
BIN
tests/blendfiles/geometry-nodes/node_lib.blend
Normal file
BIN
tests/blendfiles/geometry-nodes/node_lib.blend
Normal file
Binary file not shown.
BIN
tests/blendfiles/geometry-nodes/object_lib.blend
Normal file
BIN
tests/blendfiles/geometry-nodes/object_lib.blend
Normal file
Binary file not shown.
@ -255,6 +255,16 @@ class DepsTest(AbstractTracerTest):
|
||||
# b'//textures/Textures/Buildings/buildings_roof_04-color.png', False),
|
||||
})
|
||||
|
||||
def test_geometry_nodes(self):
|
||||
self.assert_deps('geometry-nodes/file_to_pack.blend', {
|
||||
b'LInode_lib.blend': Expect(
|
||||
type='Library', full_field='name[1024]', dirname_field=None,
|
||||
basename_field=None, asset_path=b'//node_lib.blend', is_sequence=False),
|
||||
b'LIobject_lib.blend': Expect(
|
||||
type='Library', full_field='name[1024]', dirname_field=None,
|
||||
basename_field=None, asset_path=b'//object_lib.blend', is_sequence=False),
|
||||
})
|
||||
|
||||
def test_usage_abspath(self):
|
||||
deps = [dep for dep in trace.deps(self.blendfiles / 'doubly_linked.blend')
|
||||
if dep.asset_path == b'//material_textures.blend']
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user