Commit Graph
264 Commits
Author SHA1 Message Date
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 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 2023-12-14 11:54:30 +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 c4ff3fdb54 Bumped version to 1.16 2023-11-02 15:46:01 +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 ce19808f5c Bumped version to 1.15 2022-12-16 15:00:43 +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!
2022-12-02 13:11:37 +01: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 2022-07-14 10:40:39 +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 63c4745e9f Cleanup: reformat with Black 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 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 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 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 7e61163364 Bumped version to 1.9 2021-11-19 13:59:02 +01:00
Sybren A. Stüvel 7dead42c43 Add bat version command to print BAT version
`bat --help` also prints the version, but it's nice to have an explicit
command for this that only prints the version and nothing else.
2021-11-19 13:57:48 +01:00
Sybren A. Stüvel 744609b2f0 Bumped version to 1.8 2021-11-09 11:17:02 +01:00
Ethan Simon 608a7bdac9 Compatibility with packing read-only source files
File permissions are no longer copied when packing. This means that
read-only source files can still be packed without errors, even when
they have to be rewritten (due to changed paths).

Reviewed by: sybren

Differential Revision: https://developer.blender.org/D13128
2021-11-09 11:15:20 +01:00
Sybren A. Stüvel 2843cce6fd Bumped version to 1.7 2021-11-05 16:30:17 +01:00
Sybren A. Stüvel 8a06bf5903 Add optional support for ZStandard compression
BAT now can take advantage of the `zstandard` module to handle Blender
3.0+ compressed blend files.

If the module is not installed, the blend files cannot be opened but
GZip-compressed and uncompressed files can still be handled.
2021-10-05 18:24:44 +02:00
Sybren A. Stüvel 3d8c608da3 Bumped version to 1.7b0 2021-07-27 17:09:16 +02:00
Sybren A. Stüvel 2cedf2b424 Bumped version to 1.6 2021-07-27 17:06:13 +02:00
Sybren A. Stüvel 4a1840f51c Remove code that's both bad and unnecessary
The library link will be picked up anyway, and not all datablocks have
a "lib" property.
2021-07-27 16:59:28 +02:00
Sybren A. Stüvel 24c0206e89 Support datablocks used as default values in nodes
Follow pointers of input sockets of nodes that can reference ID datablocks.
2021-07-27 16:42:25 +02:00
Sybren A. Stüvel 0bd18594f6 Support linked collections used as input in a Geometry Nodes modifier
Add support for linked collections that are used as input in a Geometry
Nodes modifier. This requires iterating over the geometry nodes modifier
settings, which consists of ID properties. If such an ID property is of
type `IDP_ID`, its pointer is followed and the pointed-to datablock +
its library are visited.

This following of pointers happens in the 'expand' phase, which was only
done for linked library blend files. Since this commit, the old
behaviour of simply looping over all non-`DATA` datablocks of the
to-be-packed blend file is not enough, and datablock expansion is done
for all local datablocks as well.
2021-07-27 16:42:25 +02:00
Sybren A. Stüvel 932283be65 Warn when expander yields blocks that are known to be ignored
This is just a debugging tool, if this warning occurs it's an indication
of a bug in BAT.
2021-07-27 16:42:25 +02:00
Sybren A. Stüvel 74ae76cd73 Bumped version to 1.6b1 2021-07-27 16:42:25 +02:00
Paul Golter 4305f32c48 Bumped version to 1.5.1 2021-07-22 16:03:43 +02:00
Paul Golter db26a0aaf1 Add log warning if SegmentationFault caused by dereferencing invalid pointer is silenced when strict_pointer_mode is turned off. 2021-07-22 15:58:44 +02:00
Paul Golter cd42417c37 Bumped version to 1.6b0 2021-07-22 12:38:33 +02:00
Paul Golter d520f6bb33 Bumped version to 1.5 2021-07-22 12:36:15 +02:00
Sybren A. Stüvel 4e51b82e4c Bumped version to 1.5b0 2021-07-22 12:03:27 +02:00
Sybren A. Stüvel 113db18211 Bumped version to 1.4.1 2021-07-22 11:40:15 +02:00