388 Commits

Author SHA1 Message Date
Andrej730
c69612b264 BlendFileBlock.get to support accessing different items in the file-block (#92898)
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
2025-11-24 14:53:15 +01:00
Andrej730
b1c4f5e116 setup.cfg - set enabled pytest_cov explicitly (#92896)
To support running tests if `PYTEST_DISABLE_PLUGIN_AUTOLOAD` is set
(to avoid conflicts with other plugins that might be available on the
system).

Reviewed-on: https://projects.blender.org/blender/blender-asset-tracer/pulls/92896
2025-11-24 14:40:35 +01:00
Andrej730
5690c8e7cb Add py.typed marker file (#92895)
PEP 561 added a requirement for packages that do have typing
information, to include empty py.typed file:
https://peps.python.org/pep-0561/#packaging-type-information

Example warnings from pyright/pylance:
```python
# Stub file not found for "blender_asset_tracer" Pylance: reportMissingTypeStubs
from blender_asset_tracer import blendfile
```

Reviewed-on: https://projects.blender.org/blender/blender-asset-tracer/pulls/92895
2025-11-24 14:38:15 +01:00
Jonas Dichelle
50578ac62a Add Support for Geometry Node Cache (#92890)
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
2025-11-24 13:06:38 +01:00
Andrej730
94486a3218 Add additional annotations to avoid typing issues (#92897)
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>
2025-08-25 11:51:25 +02:00
Andrej730
95165a0330 README - code example to use Python syntax highlighting (#92894)
Added explicit code block  for Python syntax highlighting.

Reviewed-on: https://projects.blender.org/blender/blender-asset-tracer/pulls/92894
2025-08-25 11:51:25 +02:00
Sybren A. Stüvel
8a17495566 Bump version to 1.20 and mark it as released today 2025-08-25 11:51:25 +02:00
Sybren A. Stüvel
08b37a35f8 Update CHANGELOG.md 2025-07-11 15:45:24 +02:00
Sybren A. Stüvel
6c42d06f05 Add a __main__.py file
Add a `__main__.py` file, so that BAT can be run with
`python3 -m blender_asset_tracer`. This makes it easier to start BAt in
a debugger.
2025-07-11 15:42:39 +02:00
Sybren A. Stüvel
16c208bc8e Support compositor node trees in Blender 5.0
Since Blender 5.0 these use a different DNA field. BAT now supports
this too, and supports linked node trees as well.

See blender/blender@bd61e69be5
2025-07-11 15:42:07 +02:00
Sybren A. Stüvel
4c429e9212 Read blendfile sub-version
Add support for reading the blend file's sub-version.
2025-07-11 15:30:58 +02:00
Sybren A. Stüvel
2489e4cbbc Upgrade Twine 4.0 → 5.0
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.
v1.19
2025-06-16 12:38:13 +02:00
Sybren A. Stüvel
9223a4d7b9 Bumped version to 1.19 2025-06-16 12:29:45 +02:00
Sybren A. Stüvel
896c4a3ca4 README: update development environment setup instructions 2025-06-16 11:59:51 +02:00
Sybren A. Stüvel
85cf257d2c Upgrade Sphinx to the version bundled with Ubuntu 24.04 LTS
The old version of Sphinx depended on the `pathtools` library, which had
issues installing on my macbook.
2025-06-16 11:52:52 +02:00
Sybren A. Stüvel
03fa3f2d18 Drop support for Python 3.8
It is EOL and no longer supported by the Python foundation.

Also it is getting in the way of upgrading Sphinx.
2025-06-16 11:51:09 +02:00
Sybren A. Stüvel
b1d49627b1 Add Python 3.12 and 3.13 to the Tox environments 2025-06-16 11:41:00 +02:00
Sybren A. Stüvel
876dddb964 CHANGELOG: update log for 1.19 and mark it as released today 2025-06-16 11:26:00 +02:00
Sybren A. Stüvel
12ce4bfc6d pyproject.toml: modernize use of deprecated tool.poetry.dev-dependencies
Use `[tool.poetry.group.dev.dependencies]` instead of the deprecated
`[tool.poetry.dev-dependencies]` section.
2025-06-16 11:24:13 +02:00
Jacques Lucke
f1ee7980b2 Support .blend files saved with large bhead
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
2025-06-13 12:25:51 +02:00
Sybren A. Stüvel
eb69ca5632 Add EndianIO.parse_pointer function
This is to parse in-memory pointer data bytes into an actual pointer value.
2025-01-24 15:34:46 +01:00
Sybren A. Stüvel
f2e28edc05 Implement reader & writer for int8_t type 2024-09-02 18:20:51 +02:00
Sybren A. Stüvel
e3d3d988b7 Re-lock package dependencies
Re-ran `poetry lock` to regenerate the `poetry.lock` file.
2024-09-02 18:20:51 +02:00
Sybren A. Stüvel
073bc8140a Update CHANGELOG 2024-09-02 18:20:51 +02:00
jonasdichelle
16a092ddf1 Add Support for Dynamic Paint Modifier
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>
2024-09-02 18:19:07 +02:00
Bastien Montagne
fe0b3e8f5e Add a simple, direct way to use BAT, without requiring to setup a venv etc.
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.
2024-08-13 18:01:38 +02:00
Sybren A. Stüvel
42dd5ec1b6 Bumped version to 1.18 v1.18 2024-01-11 16:43:11 +01:00
Sybren A. Stüvel
77778f1895 Mark v1.18 as released today 2024-01-11 16:39:27 +01:00
Olivier Charvin
44d1d2ff90 Fix IES lights asset tracing
Fix an issue where BAT failed with a `KeyError` (because it couldn't
find the `filepath` property) when handling IES light files.

Also add example files & unit tests.

Reviewed-on: https://projects.blender.org/blender/blender-asset-tracer/pulls/92886
2024-01-11 16:34:28 +01:00
Sybren A. Stüvel
15f00e6c92 Add support for reading uchar aka uint8_t 2024-01-08 17:08:13 +01:00
Olivier Charvin
ced4af98a3 Add support for OpenVDB
Add support for tracing `VO` data-blocks, for OpenVDB volumes.
2024-01-02 16:32:04 +01:00
Sybren A. Stüvel
937ecfdece Update CHANGELOG 2023-12-18 17:59:37 +01:00
Sybren A. Stüvel
98892151ed Bumped version to 1.18-dev0 2023-12-18 17:58:30 +01:00
Olivier Charvin
2099827554 blocks2assets: debug filepath on reading unsupported blocks (#92885)
When logging that there is no reader implemented for a certain
data-block type, include the filepath of the blend file that contains
that data-block.

Reviewed-on: https://projects.blender.org/blender/blender-asset-tracer/pulls/92885
2023-12-18 17:57:42 +01:00
Sybren A. Stüvel
47e7c00845 Bumped version to 1.17 v1.17 2023-12-14 11:54:30 +01:00
Sybren A. Stüvel
1abb8e5650 Mark 1.17 as released today 2023-12-14 11:54:21 +01:00
Sybren A. Stüvel
61dc5b8a23 Fix issue packing lamps with non-IES 'storage'
Lamp/light nodes might have a `storage` property that might point to an
IES texture node (which has the expected `filepath`), but not always.
The latter now no longer crashes BAT.

This fixes https://projects.blender.org/blender/blender-asset-tracer/pulls/92883
2023-12-14 11:36:55 +01:00
Sybren A. Stüvel
81ea8296da Bump version to 1.17-dev0 2023-12-14 11:36:34 +01:00
Sybren A. Stüvel
2a9bdc5206 Mark 1.16 as released today v1.16 2023-11-02 15:47:35 +01:00
Sybren A. Stüvel
c4ff3fdb54 Bumped version to 1.16 2023-11-02 15:46:01 +01:00
Sybren A. Stüvel
29c0ba14b1 CHANGELOG: add Python version changes
Document drop of support for 3.7.

Also I forgot to mention that v1.15 added support for Python 3.11.
2023-11-02 15:07:17 +01:00
Sybren A. Stüvel
e2b2e6fb68 Drop support for Python 3.7
Python 3.7 is EOL, no longer supported.
2023-11-02 15:05:31 +01:00
Sybren A. Stüvel
36c258985e Cleanup: formatting change of pyproject.toml
No functional changes.
2023-11-02 15:05:16 +01:00
Sybren A. Stüvel
ef5b83feda CHANGELOG: update for new tracing behaviour of directory assets 2023-11-02 15:01:05 +01:00
Sybren A. Stüvel
606377180c Pack: always pack files, explode directories to a list of files
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.
2023-11-02 14:53:52 +01:00
Sybren A. Stüvel
f9bc6f2d08 Cleanup: fix mypy errors
This mostly handles a mypy change where implicit optionals (i.e. things
like `size: int = None`) are no longer allowed.

No functional changes.
2023-11-02 14:46:38 +01:00
Sybren A. Stüvel
b3fb7845c3 Cleanup: Reformat with black
No functional changes.
2023-11-02 14:40:27 +01:00
Olivier Charvin
74b3df5f99 Add support for IES lights
Add support for tracing `.ies` files referenced by lights.

Reviewed-on: https://projects.blender.org/blender/blender-asset-tracer/pulls/92883
2023-10-16 12:14:07 +02:00
Sybren A. Stüvel
055457ab67 Add BlendFileBlock.raw_data() and .as_string() functions
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).
2023-05-16 16:01:38 +02:00
Sybren A. Stüvel
d2b353d1bf README: fix copy-paste error v1.15 2022-12-16 15:26:26 +01:00