ZipPacker now captures the full BAT_DEBUG log stream into an in-memory
buffer for the lifetime of the pack and writes it as bat-debug.log inside
the produced zip, so archives are self-describing for post-mortem
debugging (which assets were found, where they were rewritten to, which
files were missing, etc.).
The capture forces the blender_asset_tracer logger to DEBUG only on a
dedicated handler, so terminal verbosity is unchanged. The log is flushed
into the closed zip via append mode in close(), which also covers
post-transfer messages and KeyboardInterrupt / FileTransferError paths.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Cross-validation audit by Codex + Opus identified 14 issues:
CRITICAL:
- Fix _find_subdir_ci() prefix match accepting wrong folders (e.g.
Publish_old). Now uses exact case-insensitive match.
HIGH:
- Add pack-sequence CLI subcommand with unambiguous arg parsing.
Deprecate --sequence on pack (nargs='+' consumed the target).
- Fix Windows UNC/drive path normalization in bpathlib.make_absolute()
- Fix ZIP failure losing traceback + progress bar stuck on error
- Fix os.path.commonpath crash on cross-drive paths (new
derive_common_project helper)
- Fix progress bar saturating at 40% during trace (log scale)
MEDIUM:
- Add per-shot error isolation in sequence scan (collect all errors)
- Add memory warning for >50 files in sequence pack
- Improve pack-info.txt with dedup stats
- Wrap single Path in list for old operators (type consistency)
LOW/INFO:
- Document VERSION_RE pattern
- Add TASK_CHOICE_ITEMS empty guard
28 new tests in tests/test_sequence_pack.py, 0 regressions.
Co-Authored-By: Mario Hawat <mario@autourdeminuit.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Add --sequence CLI flag to pack multiple blend files together with
shared dependency deduplication
- Add BAT_OT_sequence_pack Blender operator: scan a sequence folder for
latest published blend files, review with checkboxes, pack to ZIP
- Add studio template system (Autour de Minuit, La Cabane Productions)
with configurable folder conventions and task type selection
- Add BlenderProgressCallback for cursor progress indicator during pack
- Add ZIP write start/finish logging
- Deduplicate blend file paths in CLI when positional and --sequence overlap
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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.
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.
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.
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.
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
Add a 'strict pointer mode' to the `BlendFile` class, which is enabled
by default. This allows users of the `BlendFile` class to decide whether
a bad pointer (i.e. one that points to a non-existing datablock) returns
`None` or raises a `SegmentationFault` exception.
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.
This may also fix a Windows compatibility issue related to path
normalisation. Untested as it's hard to reproduce, but at least it
shouldn't hurt either.
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.
The Shaman server is a file storage system that identifies files by
SHA256sum and file length. BAT can send packs there by only uploading
changed/new files. The BAT pack is reproduced at the Shaman server's
checkout directory by creating symlinks to the files in its file
storage.
Retrying sending files:
When we can defer uploading a file (that is, when we have other files to
upload as well, and we could send the current file at a later moment) we
send an `X-Shaman-Can-Defer-Upload: true` header in the file upload
request. In that case, when someone else is already uploading that file,
a `208 Already Reported` response is sent and the connection is closed.
Python's Requests library unfortunately won't give us that response if
we're still streaming the request, and raise a ConnectionError exception
instead. This exception can mean two things:
- If the `X-Shaman-Can-Defer-Upload: true` header was sent: someone else
is currently uploading that file, so defer it.
- If that header was not sent: that file is already completely uploaded
and does not need to be uploaded again.
Instead of retrying each failed file, after a few failures we now just
resend the definition file to get a new list of files to upload, then
send those. This should considerably reduce the number of HTTP calls
when multiple clients are uploading the same set of files.
The target path is just read as string from the CLI now, to allow more
complex targets (such as URLs) that don't directly map to a path.
The Packer subclass now handles the conversion from that string to a
`pathlib.PurePath`, and specific subclasses & transfer classes can convert
those to a `pathlib.Path` to perform actual filesystem operations when
necessary.
This makes BAT skip assets that are referred to with an absolute path.
It is assumed that the receiver of the BAT pack can access those assets
at the same path.
For regular file transfers (so to a directory, not to a ZIP file or S3
storage), use multi-threaded transfer when compressing. Compressing is
CPU-bound, so using multiple threads speeds things up considerably
(packing a Spring lighting file went from 6min30 single-threaded to
2min13 multi-threaded on my machine).