Added block walker implementations + tests
This commit is contained in:
@@ -1,9 +1,10 @@
|
||||
from . import BlendFileBlock
|
||||
from .dna import FieldPath
|
||||
|
||||
|
||||
def listbase(block: BlendFileBlock) -> BlendFileBlock:
|
||||
def listbase(block: BlendFileBlock, next_path: FieldPath=b'next') -> BlendFileBlock:
|
||||
"""Generator, yields all blocks in the ListBase linked list."""
|
||||
while block:
|
||||
yield block
|
||||
next_ptr = block[b'next']
|
||||
next_ptr = block[next_path]
|
||||
block = block.bfile.find_block_from_address(next_ptr)
|
||||
|
||||
Reference in New Issue
Block a user