46 Commits

Author SHA1 Message Date
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
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
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
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
63c4745e9f Cleanup: reformat with Black 2022-03-25 12:07:06 +01:00
Sybren A. Stüvel
843c34c3c0 Support UDIM images 2022-02-18 16:12:41 +01: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
803c38dac1 Cleanup: reformat with Black 2021-07-22 10:14:43 +02: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
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
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
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
c718fb3a41 Support the Mesh Sequence Cache modifier (a.k.a. Alembic files) 2019-03-20 11:14:23 +01:00
Sybren A. Stüvel
6ac117cd37 Formatting 2019-03-20 11:12:47 +01:00
Sybren A. Stüvel
d5d9c7f52f Clarified comment 2019-02-12 12:48:02 +01:00
Sybren A. Stüvel
66681a69df Fixed crash where collection children are ID blocks instead of GR blocks
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.
2019-02-12 12:31:05 +01:00
Sybren A. Stüvel
daab1df826 Use a priority queue instead of repeatedly sorting a deque 2019-02-04 15:17:07 +01:00
Sybren A. Stüvel
20d7ea08cc Workaround for Windows failing on glob patterns in path.resolve()
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.
2019-01-02 15:14:50 +01:00
Sybren A. Stüvel
772a5a1b1c Replace → with ->
Apparently Windows still isn't using UTF-8 by default, and fails when
handling these log entries.
2019-01-02 15:14:50 +01:00
Sybren A. Stüvel
19216cb12e BlendPath.as_path() now refuses to convert blendfile-relative paths
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).
2019-01-02 15:14:50 +01:00
Sybren A. Stüvel
5635895d0c Attempt at making BAT work on Windows
All BlendPath instances will use forward slashes, and there should be
more use of PurePosixPath instead of Path.
2019-01-02 15:14:50 +01:00
Jeroen Bakker
7c80320b30 Support for cloth ptcaches stored on disk
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
2018-11-08 10:25:45 +01:00
Sybren A. Stüvel
d7b06f0644 Blender 2.8 compatibility of image datablock 2018-07-10 16:02:14 +02:00
Sybren A. Stüvel
38b3e2b55c Fixed a whole bunch of MyPy errors
New release of mypy picks up more.
2018-07-10 16:02:14 +02:00
Philipp Oeser
4e1c2d1bbb Fix T55542: BAT doesn't pack smoke cache 2018-07-06 11:01:44 +02:00
Sybren A. Stüvel
893c1f2231 Convert hexified ID name to upper case
Our test case accidentally has a numerical-only hex representation, which
doesn't show this issue.
2018-07-05 11:53:38 +02:00
Sybren A. Stüvel
aa8e2a8cdd Tracer fix for T55539
This only fixes the tracer; the problem with the packer still exists.
2018-07-03 15:05:15 +02:00
Sybren A. Stüvel
f7a18ba07d Support nested collections in Blender 2.8 2018-06-13 17:40:05 +02:00
Sybren A. Stüvel
5f966934df Blender 2.8 fixes because of removed Material.mtex and Material.group 2018-06-07 15:18:18 +02:00
Sybren A. Stüvel
dfa07e19cc Fix T55007: Support fluid simulation cache files
This also adds support for entire directory paths to be assets, in
addition to globs and numbered file sequences.
2018-06-05 15:12:10 +02:00
Sybren A. Stüvel
285a88793a Debug-log skipping of packed datablocks. 2018-05-08 12:15:56 +02:00
Sybren A. Stüvel
21fb18247d Find textures and images of various modifiers
- Wave
- UV Project
- Weight VG Edit
- Weight VG Mix
- Weight VG Proximity
2018-03-26 17:14:08 +02:00
Sybren A. Stüvel
0d82dc7fd0 Find texture of displacement modifier 2018-03-26 16:46:13 +02:00
Sybren A. Stüvel
c515509b24 Use decorator to register modifier walker. 2018-03-26 16:43:32 +02:00
Sybren A. Stüvel
53e22a4a2f Added GPL comment blocks with proper attibution. 2018-03-16 13:25:20 +01:00
Sybren A. Stüvel
f7150c0d29 Allow aborting a pack operation.
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.
2018-03-16 12:12:15 +01:00
Sybren A. Stüvel
889f3abd25 Implemented reporting callbacks.
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.
2018-03-15 17:59:55 +01:00
Sybren A. Stüvel
c9664ca045 Report missing files in Packer.strategise() 2018-03-14 12:24:26 +01:00
Sybren A. Stüvel
fdbbc3a20d Static type checking with mypy
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.
2018-03-09 11:09:47 +01:00
Sybren A. Stüvel
632d01334c Renamed module tracer → trace
This is consistent with the other module names.
2018-03-09 10:02:44 +01:00