Add 'strict pointer mode' to BlendFile
Add a 'strict pointer mode' to the `BlendFile` class, which is enabled by default. This allows users of the `BlendFile` class to decide whether a bad pointer (i.e. one that points to a non-existing datablock) returns `None` or raises a `SegmentationFault` exception.
This commit is contained in:
@@ -512,6 +512,14 @@ class Packer:
|
||||
|
||||
# Find the same block in the newly copied file.
|
||||
block = bfile.dereference_pointer(usage.block.addr_old)
|
||||
|
||||
# Pointers can point to a non-existing data block, in which case
|
||||
# either a SegmentationFault exception is thrown, or None is
|
||||
# returned, based on the strict pointer mode set on the
|
||||
# BlendFile class. Since this block was already meant to be
|
||||
# rewritten, it was found before.
|
||||
assert block is not None
|
||||
|
||||
if usage.path_full_field is None:
|
||||
dir_field = usage.path_dir_field
|
||||
assert dir_field is not None
|
||||
|
||||
Reference in New Issue
Block a user