Add support for indirectly linked Geometry Nodes node trees
This commit is contained in:
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user