24 Commits

Author SHA1 Message Date
Sybren A. Stüvel
09a0866c14 Cache open blend files
This simplifies blend file handling, ensuring that blend files are only
opened once. Otherwise it would be harder to handle things like dependency
diamonds (libraries that are referenced via multiple paths through multiple
other libraries).
2018-03-07 17:13:47 +01:00
Sybren A. Stüvel
e2123f8090 Path rewriting for sequences seems to be working too. 2018-03-06 16:41:16 +01:00
Sybren A. Stüvel
71dd5bc11b Path rewriting when packing.
Doesn't work with sequences, nor with split dirname/basename fields.
2018-03-06 16:06:36 +01:00
Sybren A. Stüvel
6d1cae1225 Tracer: don't warn about missing expanders for LI and DATA blocks 2018-03-06 11:40:56 +01:00
Sybren A. Stüvel
5c8e074c68 Implemented simple 'bat pack' CLI command
No path rewriting yet, just simply copying the dependencies. They are
copied to the target directory + the path relative to the current working
directory. For example:

bat pack scenes/05-barber/05_02_C-agent_focused/05_02_C.lighting.blend /tmp/packer

will write to
/tmp/packer/scenes/05-barber/05_02_C-agent_focused/05_02_C.lighting.blend
and will copy ./path/to/file → /tmp/packer/path/to/file
2018-03-02 17:59:04 +01:00
Sybren A. Stüvel
f2694df602 Don't warn about missing readers in blend2asserts
It's still logged at debug level, but it's aimed at developers and not
artists/end users.
2018-03-02 15:45:26 +01:00
Sybren A. Stüvel
8009ff1e47 Added block expansion
The expansion process follows pointers and library links to construct
the full set of actually-used data blocks. This set consists of all data
blocks in the initial blend file, and all *actually linked-to* data
blocks in linked blend files.

I've also removed non-recursive dependency listing.
2018-03-02 15:44:07 +01:00
Sybren A. Stüvel
677d388a15 Convert BlendPath to pathlib.Path using local filesystem encoding
UTF-8 is tried first, and if that fails the local filesystem encoding is
used.
2018-03-02 13:42:49 +01:00
Sybren A. Stüvel
8bb130d336 Moved cdefs one module up 2018-03-02 13:36:08 +01:00
Sybren A. Stüvel
7167d51730 Added BlendFileBlock.id_name property
Evaluated only once, so safe to call multiple times without producing
excessive disk I/O. Returns None instead of raising KeyError when there is
no (b'id', b'name') field.
2018-03-02 11:26:02 +01:00
Sybren A. Stüvel
2bb9cffa49 Renamed block_walkers to blocks2assets 2018-03-02 10:06:41 +01:00
Sybren A. Stüvel
2c0cc6003d Updated block_walkers docstring 2018-03-01 10:35:51 +01:00
Sybren A. Stüvel
d93516d34f Better naming of functions in block_walkers.py 2018-03-01 10:31:41 +01:00
Sybren A. Stüvel
204626b671 Fix issue when library blend file does not exist 2018-02-28 17:23:43 +01:00
Sybren A. Stüvel
6252b041d5 Implemented JSON dependency logging output 2018-02-28 17:18:18 +01:00
Sybren A. Stüvel
2af8d94cb9 Perform recursion after handling all blocks of current file
This way file access isn't interleaved and all dependencies of one file are
reported before moving to the next.
2018-02-28 17:02:19 +01:00
Sybren A. Stüvel
ca964181fe Beginning of CLI interface + protection against infinite recursion. 2018-02-28 16:47:13 +01:00
Sybren A. Stüvel
8ae400acbe Support particle simulation point cache data
Also see https://developer.blender.org/T53562
2018-02-28 14:11:48 +01:00
Sybren A. Stüvel
86af05e823 Added recursion into library blend files. 2018-02-28 12:42:27 +01:00
Sybren A. Stüvel
cb5eff2dcb Some docstrings 2018-02-28 11:56:41 +01:00
Sybren A. Stüvel
7541922b74 Also report library blocks.
Those are needed for recursive tracing of dependencies.
2018-02-28 11:55:10 +01:00
Sybren A. Stüvel
0d7bbb34f0 Reduced cyclomatic complexity of BlockUsage.__init__() 2018-02-28 11:17:27 +01:00
Sybren A. Stüvel
65b690e998 Added block walker implementations + tests 2018-02-27 17:30:28 +01:00
Sybren A. Stüvel
15cd74cda4 Start of dependency tracer work. 2018-02-26 18:16:15 +01:00