353 Commits

Author SHA1 Message Date
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
Sybren A. Stüvel
9641ea1b58 Adjust filenames for newer Poetry
Newer Poetry versions seem to write sources to
`blender_asset_tracer-1.15.tar.gz`, i.e. with underscores in the name,
just like the wheel file.
2022-12-16 15:25:19 +01:00
Sybren A. Stüvel
64d657ead2 Poetry: include a readme setting
This should include the contents of `README.md` in the package & show it
on the Python package index.
2022-12-16 15:22:27 +01:00
Sybren A. Stüvel
54456e0c35 Also test on Python 3.11 2022-12-16 15:14:09 +01:00
Sybren A. Stüvel
e6669887ce Update all dependencies to their latest versions 2022-12-16 15:08:59 +01:00
Sybren A. Stüvel
aba2b673f1 Change my email address
Change the email address to my work address.
2022-12-16 15:01:38 +01:00
Sybren A. Stüvel
ce19808f5c Bumped version to 1.15 2022-12-16 15:00:43 +01:00
Sybren A. Stüvel
8f933ef862 Mark 1.15 as released today 2022-12-16 15:00:31 +01:00
Sybren A. Stüvel
517e8eee23 Bumped version to 1.15-dev0 2022-12-16 14:49:56 +01:00
Sybren A. Stüvel
1e8c924990 Add support for fluid simulation caches
Add `eModifierType_Fluid` support, with non-pointcache caches. The entire
cache directory is considered a dependency to list/pack.
2022-12-16 14:49:36 +01:00
Sybren A. Stüvel
1541c52520 Version bump to 1.14
This was actually released in 2022-09-12, but I forgot to commit!
v1.14
2022-12-02 13:11:37 +01:00
Sybren A. Stüvel
79193a60cd CHANGELOG: mark 1.14 as released today 2022-09-12 15:28:04 +02:00
Sybren A. Stüvel
330b179a44 README: add new instructions on building & publishing
PyPi requires an API token nowadays, for uploading packages. The README
now includes instructions on how to set those up & use them.
2022-09-12 15:28:04 +02:00
Sybren A. Stüvel
3bcb9bab0e Publish packages with Twine
Twine is the preferred way to publish Python packages nowadays.
2022-09-12 15:27:51 +02:00
Sybren A. Stüvel
051cab877c Poetry: update dependencies 2022-09-12 15:06:08 +02:00
Sybren A. Stüvel
cc4043969e Change when the trace_blendfile() callback is called
Previously the `callback.trace_blendfile()` callback was called just before
tracing its dependencies would start, i.e. after opening it. This is now
changed to before opening it, because that can take a long time (to load
SDNA). this will make any UI (like the Flamenco add-on) report the right
filename when waiting for big files, instead of lingering on the
last-opened (potentially very small) blend file.
2022-09-12 15:06:08 +02:00
Sybren A. Stüvel
bef5fb88cd Bumped version to 1.13 v1.13 2022-07-14 10:40:39 +02:00
Sybren A. Stüvel
32e993fbb5 Update CHANGELOG.md 2022-07-14 10:40:36 +02:00
Sybren A. Stüvel
0e5d926e7a Better error message for an assertion
In some unexpected situations BAT would just show that the
`bfile_pp is not None` assertion failed. Now it also shows which file is
the one causing this issue, aiding in debugging the situation.
2022-07-14 10:06:20 +02:00
Sybren A. Stüvel
2aaf0896ba Support Python 3.10 v1.12 2022-03-25 12:13:19 +01:00
Sybren A. Stüvel
63c4745e9f Cleanup: reformat with Black 2022-03-25 12:07:06 +01:00
Sybren A. Stüvel
3daeb9f80a Bump versions of dependencies
Most importantly, update MyPy so it supports Python 3.10 (which is used
in Blender 3.1, the latest release at this moment).
2022-03-25 12:07:06 +01:00
Sybren A. Stüvel
cd6732a407 Bump required Python to 3.7 for MyPy 2022-03-25 12:07:06 +01:00
Sybren A. Stüvel
973bf741c7 Cleanup: add a comment to explain EndianIO::accepted_types
No functional changes.
2022-03-25 12:07:06 +01:00
William Harrell
6bfa4062d7 Support for int, float types in BlendFileBlock.set
---

The blendfile module within BAT supports reading data from structs, such
as the Count property on an array modifier. However, blendfile only
supports modifying structs with type "char". This patch adds support for
writing structs of more types in blendfile blocks. Now, writing is
supported for ushort, short, uint, int, float, and ulong types.

The use case that inspired this patch was an instance where a file had
several array modifiers that prevented the file from being opened in
Blender on machines without large amounts of RAM. A solution using the
blendfile module may look like:

```
from blender_asset_tracer import blendfile
from pathlib import Path

b = blendfile.open_cached(Path('flag.blend'), mode='rb+')

for block in b.blocks:
    if 'ArrayModifierData' in block.__str__():
        try:
            print('previous:', block.get(b'count'))
            block.set(b'count', 1)
            print('current:', block.get(b'count'))
        except KeyError:
            continue

b.close()
```

This would fail with the exception
`blender_asset_tracer.blendfile.exceptions.NoWriterImplemented: Setting
type Struct(b'int') is not supported for ArrayModifierData.count`. With
this patch, the above code succeeds and the count struct can be set to
a lower number that allows the file to be opened.

This solution implements missing functionality without adding any new
interfaces. A few details are:
* When deciding what type to write to the struct, the value is inferred
from what is given by the caller. If the caller gives a Python int, the
exact type is inferred from the DNA type ID. If they give a float, a
float is written. Otherwise, the existing logic is used to determine
whether to write a string or byte sequence.
* A \_write method was added to dna\_io.py that takes a Python struct
object and a value to write a byte sequence to the file object. This
method is used by public methods appropriately named to indicate what
type they will write.
* The check for whether the caller is trying to write an unsupported
type is left in place, but it has been changed to include types which
are now supported.
* Tests have been added that provide a mock file object, call the new
methods, and confirm that the correct bytes were written.

Reviewed By: sybren

Differential Revision: https://developer.blender.org/D14374
2022-03-25 12:07:06 +01:00
Sybren A. Stüvel
c29774a234 Bumped version to 1.12 2022-03-25 11:55:41 +01:00
Sybren A. Stüvel
8f86379ea6 Changelog: mark 1.12 as released today 2022-03-25 11:55:33 +01:00
Sybren A. Stüvel
d778849c89 Add note about not supporting Shaman API of Flamenco 3.x
Decided to *not* support the Shaman API of Flamenco 3.x in BAT. The
support for that protocol will be implemented in the Flamenco 3.x add-on
for Blender, and not in BAT itself.

A future version of BAT will remove the Shaman API support altogether.
2022-03-25 11:55:30 +01:00
Sybren A. Stüvel
fab2090080 Bump version to 1.12-dev0 2022-03-11 17:28:46 +01:00
Sybren A. Stüvel
cd3f9ce671 Avoid late (non-top-level) imports
Avoiding late imports helps to isolate Blender add-ons bundling BAT from
each other.

There was one late/lazy import to avoid a dependency cycle. This was
solved by simply copying that one tiny function.
2022-03-11 17:03:08 +01:00
Sybren A. Stüvel
4899766943 Bumped version to 1.11 v1.11 2022-02-18 16:12:41 +01:00
Sybren A. Stüvel
843c34c3c0 Support UDIM images 2022-02-18 16:12:41 +01:00
Sybren A. Stüvel
4ebd535b5f Add missing test blend file v1.10 2022-02-04 10:48:49 +01:00
Sybren A. Stüvel
301e73d64a Bumped version to 1.10 2022-02-03 17:54:07 +01:00
Sybren A. Stüvel
e5c7e38b44 Avoid doubly-compressing zstandard files 2022-02-03 17:54:03 +01:00
Sybren A. Stüvel
2bf155a5f9 Update pytest for Python 3.10 compatibility 2022-02-03 17:48:41 +01:00