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.
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.
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.
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.
Not sure when/how that happens, but it happened on a lighting file of the
Spring project, when linking in a nested collection of which parts where
also linked in from other blend files.
Windows fails with an OSError when `somepath.resolve()` is called and
`somepath` contains a glob pattern. As a workaround, we now `resolve()`
the parent directory, and put the filename at its end. This only works
when the glob pattern is in the filename, which is the case for BAT-
generated globs.
When a path starts with b'//' it will not be converted to a PurePath, as
the handling of such filenames is platform dependent (Windows handles those
weirdly, like appending a slash to any path).
Currently pointcaches on disk for cloth sims were not traced. This patch allows the tracing of pointcaches for cloth sims.
Reviewers: sybren, fsiddi
Reviewed By: sybren
Differential Revision: https://developer.blender.org/D3910
For this to work well I also had to remove the sorting of blocks in
trace.deps(). The sorting caused the first `yield` to be executed only
after each blend file was opened, which means that the consuming for-loop
takes a long time to hit its first iteration. As a result, it would respond
slowly to abort requests. By not sorting the first `yield` is much sooner,
resolving this issue.
Both the dependency Tracer class and the Packer class now support a
callback object, where the latter is a subclass of the former.
For file transfers running in a separate thread, there is a thread-safe
wrapper for progress callbacks. This wrapper can be called from any thread,
and calls the wrapped callback object from the main thread. This way the
callback implementation itself doesn't have to worry about threading
issues.
This does introduce some not-so-nice things, like having to annotate each
`__init__` function with `-> None`. However, the benefits of having static
type checking in a complex bit of software like BAT outweigh the downsides.