Extend `Struct.field_set()` so that the `path` type can be a
`dna.FieldPath`, to mirror `Struct.field_get`'s `path` type, and allow
users to set file-block's subproperties. For example this allows
setting `object_block[(b'id', 'name')]`.
Also, along the way, added a test for getting subproperty value.
Reviewed-on: https://projects.blender.org/blender/blender-asset-tracer/pulls/92899
Add an `array_index` parameter to `block.get(property_name)` to get a
specific item from an array.
Example:
```python
verts = self.bf.block_from_addr[verts_ptr]
assert verts.get(b"co") == [-1.0, -1.0, -1.0] # index 0
assert verts.get(b"co", array_index=1) == [-1.0, -1.0, 1.0]
```
Reviewed-on: https://projects.blender.org/blender/blender-asset-tracer/pulls/92898
Add support for geometry node simulation cache files.
This also adds support for dealing with dynamic arrays in Blender's
DNA, because `modifier.bakes` is a pointer to such an array.
Co-authored-by: Sybren A. Stüvel <sybren@blender.org>
Reviewed-on: https://projects.blender.org/blender/blender-asset-tracer/pulls/92890
BlendFileBlock attributes:
Explicit annotation on BlendFileBlock are needed because otherwise
e.g. `block.add_old` type was imprecisely inferred from the
assignments as `int | Any`, where `Any` comes from `.unpack` returning
`tuple[Any, ...]`.
Ideally unpack should be somehow connected to the returned types, but
this solution should work for now just to avoid typing errors.
dna_io - add some missing annotations:
Some annotations were needed to ensure `block.code` will be inferred
as `bytes` and not `bytes | Unknown`.
Reviewed-on: https://projects.blender.org/blender/blender-asset-tracer/pulls/92897
Reviewed-by: Sybren A. Stüvel <sybren@blender.org>
There was an error running `twine check` (`KeyError: 'license'`) that was
fixed by upgrading to 5.0. This version was chosen as it's the one in
the current Ubuntu LTS release.
This is mostly the same as blender/blender!140195. The header parsing code has
been updated to be able to read old and new .blend file headers.
There is a new test file which is the same as the existing `basic_file.blend`,
but saved with the new header format. A new unit test has been added to check
that this file is read correctly as well.
Pull Request: https://projects.blender.org/blender/blender-asset-tracer/pulls/92893
Add support for the Dynamic Paint modifier point cache.
I added a walker to iterate through all surfaces on a canvas to get each surface's point cache.
Reviewed-on: https://projects.blender.org/blender/blender-asset-tracer/pulls/92889
Reviewed-by: Sybren A. Stüvel <sybren@blender.org>
Allows to use `python3 path/to/cli.py my args` just from source code,
without requiring to set up a whole venv for that. Much simpler when
only 'regular' debuging in code logic itself is needed.
When an asset is represented as directory in Blender (for example fluid
simulation caches), that directory is traced and each file is considered
an asset.
This makes it considerably easier for Shaman clients, as they need to
compute the SHA256 checksum of each file. The logic to transform a
directory path to a list of the contained files is now in BAT itself.
Add functions to interpret the data in a `BlendFileBlock` as either `bytes`
or `string`. This is used to obtain the contents of a `char*` (instead
of an embedded `char[N]` array).