43 Commits

Author SHA1 Message Date
Sybren A. Stüvel
32e993fbb5 Update CHANGELOG.md 2022-07-14 10:40:36 +02:00
Sybren A. Stüvel
2aaf0896ba Support Python 3.10 2022-03-25 12:13:19 +01:00
Sybren A. Stüvel
cd6732a407 Bump required Python to 3.7 for MyPy 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
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
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
843c34c3c0 Support UDIM images 2022-02-18 16:12:41 +01:00
Sybren A. Stüvel
e5c7e38b44 Avoid doubly-compressing zstandard files 2022-02-03 17:54:03 +01:00
Sybren A. Stüvel
086c795306 Mark 1.9 as released today 2021-11-19 13:58:55 +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
42800f6c84 Update CHANGELOG.md 2021-11-09 11:16:52 +01:00
Sybren A. Stüvel
3acf467162 Mark v1.7 as released 2021-11-05 16:29:32 +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
2cedf2b424 Bumped version to 1.6 2021-07-27 17:06:13 +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
Paul Golter
4305f32c48 Bumped version to 1.5.1 2021-07-22 16:03:43 +02:00
Paul Golter
d520f6bb33 Bumped version to 1.5 2021-07-22 12:36:15 +02:00
Sybren A. Stüvel
97b1a4d922 Drop support for Python 3.5 and 3.6, add support for 3.8 and 3.9
Python 3.5 is EOL already, and Blender never used version 3.6 (it went
straight to 3.7), hence 3.6 was never tested explicitly.

Python 3.7 or newer is required from now on.
2021-07-22 12:03:27 +02:00
Sybren A. Stüvel
70a56d45b9 Document rollback of Python version bump in CHANGELOG.md 2021-07-22 11:40:10 +02:00
Sybren A. Stüvel
b36effa6ec Bumped version to 1.4 2021-07-22 11:26:03 +02:00
Sybren A. Stüvel
e792f31ced Add Strict Pointer Mode to CHANGELOG.md 2021-07-22 10:54:56 +02:00
Sybren A. Stüvel
99389e8ece Bumped version to 1.3.1 2021-02-04 12:01:53 +01:00
Sybren A. Stüvel
dd257bad6f Remove assertion that library blend files always exist
Remove an assertion that would cause BAT to raise and exception and halt
when a library blend file is missing. This assertion was fine for aiding
the coding of the library, but now gets in the way of tracing dependencies
of partially checked-out projects.
2021-02-04 11:15:27 +01:00
Sybren A. Stüvel
0a5a50ccf0 Bumped version to 1.3 2021-02-02 13:42:09 +01:00
Sybren A. Stüvel
23dea91572 Add support for indirectly linked Geometry Nodes node trees 2021-02-02 13:41:39 +01:00
Sybren A. Stüvel
e4bf2e8e35 Improved path handling
This commit fixes a bunch of issues at the same time, as they are all
related to path handling:

- `pathlib.Path.resolve()` or `.absolute()` are replaced by
  `bpathlib.make_absolute()`. The latter does NOT follow symlinks and does
  NOT network mounts from a drive letter to UNC notation. This also has
  advantages on non-Windows sytems, as it allows BAT-packing a directory
  structure with symlinked files (such as a Shaman checkout).
- Better handling of drive letters, and of paths that cross drive
  boundaries.
- Better testing of Windows-specific cases when running the tests on
  Windows, and of POSIX-specific cases on other platforms.

Thanks to @wisaac for starting this patch in D6676.

Thanks to @jbakker for pointing out the drive letter issue. This fixes
T70655.
2020-03-17 17:15:19 +01:00
Sybren A. Stüvel
b3bbee25f5 Marked version 1.2 as released 2019-10-10 10:34:54 +02:00
Sybren A. Stüvel
cb83192e1e Mention T-number in changelog 2019-09-27 12:19:31 +02:00
Sybren A. Stüvel
e7cd6ab70d Fix external smoke caches not being packed 2019-09-27 12:19:22 +02:00
Sybren A. Stüvel
5988f3599a Fix T69976: BAT does not work with FluidSimModifier in Blender 2.81
The `point_cache` pointer was removed from Blender in
{rBd663ec48c06a083de74e90dd9c605e98b28baa37}, and was unused before that
commit.
2019-09-26 12:26:42 +02:00
Sybren A. Stüvel
af63f9c3c8 Allow setting Shaman JWT token in SHAMAN_JWT_TOKEN environment variable
I also removed the unused `shaman/auth.py` file.
2019-09-24 11:49:48 +02:00
Sybren A. Stüvel
113b0c9bb8 Fix T65904: External files with same path on different drives are packed once
External files with the same path on different drives are packed as a
single file. In this commit the drive letter is taken into account when
determining the path inside `_outside_project`, so that they are distinct.
2019-06-26 14:37:29 +02:00
Sybren A. Stüvel
3ae8b512df Updated changelog 2019-06-12 11:49:18 +02:00
Sybren A. Stüvel
b48978f067 Moved from Pipenv to Poetry
All the Blender Institute Python webprojects are moving to Poetry; it works
better than Pipenv in various regards.
2019-06-07 12:49:59 +02:00
Sybren A. Stüvel
a864ccdf70 Updated changelog 2019-06-05 14:14:00 +02:00
Sybren A. Stüvel
be9798cb1c Marked version 1.1 as released 2019-03-25 17:46:38 +01:00
Sybren A. Stüvel
4f05b2d481 Updated URL to Shaman
The Shaman server as standalone component is no more, it's been integrated
into Flamenco Manager.
2019-03-25 17:46:28 +01:00
Sybren A. Stüvel
4964745dee Support Alembic files from linked library
We already supported Alembic files in the top-level blend file, but now we
also support finding Alembic files in linked-in libraries.
2019-03-20 13:57:44 +01:00
Sybren A. Stüvel
8c822c5b76 Updated changelog 2019-03-01 14:32:50 +01:00
Sybren A. Stüvel
c8337f5098 Bumped version to 1.0
This is the same version as 0.99, just released as 1.0 to note the
maturity of the code (it's been used successfully for months at the Blender
Animation Studio).
2019-03-01 14:03:55 +01:00
Sybren A. Stüvel
da9f04240e Added CHANGELOG and updated README 2018-03-16 12:31:50 +01:00