70 Commits

Author SHA1 Message Date
Isaac Weaver
a910ea70f0 Fix T53782: Can't bundle blend file with image sequences
Differential revision: D3016
2019-04-15 10:56:49 +02:00
6e69e2c6d9 Improved the output of --help for bam.pack 2018-03-06 11:25:25 +01:00
7afb1fe606 Correct seek use
Harmless but misleading since both args are zero.
2017-11-18 18:25:57 +11:00
c4f935159e Fix for when no temp dir was passed on the CLI 2017-06-10 11:08:04 +02:00
bad09883a4 Fix T51692: issue when passing temporary directory.
Since BAM wants to handle all paths as bytes, care should be taken to
always encode.
2017-06-10 09:40:44 +02:00
8c8bc6ff35 Removed two assertions.
They were useful while testing out certain things, but get in the way
now because (apparently) aren't absolute truth.
2017-06-10 09:38:32 +02:00
eaa10175fe Added exclusion filter to blendfile_pack:main()
Also improved CLI descriptions and added some assertions to help debuggin
stuff.
2017-04-21 17:51:00 +02:00
a6c5400db2 Corrected usage text for pack function 2017-04-21 17:21:31 +02:00
ff777ad695 Moved some imports to the top of the file 2017-04-21 17:21:31 +02:00
b3d0fcb243 Always try to pack using a unique temporary folder name.
This allows multiple users to create multiple ZIP files in the same
directory.
2017-04-21 16:24:20 +02:00
8994385c63 Added support for Alembic caches. 2017-04-21 11:45:48 +02:00
9fbb3801bb Added a BlendFileError exception
This avoid having to raise (and catch) an Exception instance. Catching
such an exception is unnecessarily broad, as it'll also catch things like
SyntaxError and AttributeError.
2017-04-12 11:01:39 +02:00
250c35ce12 blendfile.py: Add support reading single char DNA values as unsigned integer.
A single char is nearly never a string or byte, but rather a small int
or bitflag value. ;)
2017-04-12 10:57:54 +02:00
48ed23a261 Make blendfile.py reading/parsing slightly more robust/helpful in broken .blend files cases. 2017-04-12 10:57:34 +02:00
c4dbf01f5f Fix T51131: Textures do not get packed when used in particle system 2017-04-05 12:50:28 +02:00
c43248a235 More control over logging + added extra DEBUG level 2017-04-05 12:50:28 +02:00
4c0de51d2a set_as_str() now also works for sets of non-string data.
Also not doubly-sorting any more.
2017-04-05 12:32:33 +02:00
9524c88b32 Added some type annotations to aid debugging. 2017-04-05 12:29:45 +02:00
a6c32b25e5 Added BlendFile.__repr__() to show more useful info than memory pointer 2017-04-05 12:28:31 +02:00
b035757d3b Fix: fail to move lib blend files to the destination dir when mode=FILE 2017-01-17 17:02:05 +01:00
94253975ca Cleaner way to use os.makedirs()
It's not necessary to do an os.path.exists(dst_dir) check before calling
os.makedirs(), the exist_ok=True parameter is meant for this common
pattern.
2017-01-17 17:01:37 +01:00
9e8f95114c Added some type annotations 2017-01-17 17:00:49 +01:00
e4e94f077f Fixed bad import 2017-01-17 17:00:40 +01:00
5e5a9e37f1 Report fp_blend with %r formatting, just like all other reported paths. 2017-01-17 16:07:48 +01:00
e286f472b4 Made bam.utils and bam.blend proper packages.
Without __init__.py those are namespaces, not packages, which can be merged
with the same namespaces that are defined on different places in sys.path.
This is flexibility we don't need.
2017-01-17 16:07:30 +01:00
89fe6be951 Fix (unreported) temp dir not being removed by bam pack -m FILE. 2016-12-14 14:18:17 +01:00
b75b744032 Fix T50244: bam pack with -m FILE fails on copying deeper hierachies because of missing destination folders.
As suggested by reporter, check for existing dst dir and use os.makedirs
first if missing.
2016-12-14 14:16:04 +01:00
127843e648 Extend 'pack' feature by adding option to keep repo's hierarchy, and warn about external deps.
`bam_cli.py pack` command now takes two more (optional) parameters, one
to specify the base directory of the repository, and one to enable
warnings when 'external' dependencies (to given base dir) are found.

Note that by default, base directory is the directory of the packed
.blend file (such that default behavior does not change at all).

See CLI help for more.
2016-11-28 10:47:31 +01:00
d046db9c81 Added __repr__() to DNAName and DNAStruct classes 2016-09-15 14:37:30 +02:00
a3747e5a3e Don't set log level in the module itself.
Log levels should be set by the user of the module, usually at the
application level, rather than by each individual Python module.
2016-09-15 14:37:15 +02:00
d6aed3491a Added BlendFileBlock.dna_type_name property 2016-09-15 14:36:37 +02:00
59bbdeb310 PEP8 formatting 2016-09-15 14:36:17 +02:00
a404ed8fdb Use relative import
This way the code can remain the same in both Blender's io_blend_utils
module and BAM.
2016-09-15 14:35:53 +02:00
b8a59e504b Fix packing windows paths that span drives
Reported as T48187
2016-07-26 07:09:39 +10:00
e6f6bd6da3 minor edits to blendfile 2016-06-10 02:19:20 +10:00
5f5baf33b2 Minor changes
- use functions instead of lambda
- dont use color for non-terminal tty's
- add --temp argument for blendfile_pack
2016-01-29 17:47:57 +11:00
4d6b5bf4c0 Use tuples for multi-part lookups
Also use real ints instead of extracting from strings.
2016-01-26 18:36:48 +11:00
d54c92b6fb Cleanup: style 2016-01-26 17:20:10 +11:00
4360fa5475 bledfile.py: Port over changes from src_utils repo.
commit 45e3ba4a4f8fb39d2a090f1f67c10d6132939d8e
    blendfile.py: add BlendFileBlock.get_data_hash() 'pointer-invariant' hash generator.

    This aims at giving some kind of uid to replace addr_old, that does not changes on
    every .blend saving.

commit 81c92e60195f9ff3ce327c26278d07eafb4a0596
    blendfile.py: fix/add some 'basic data' reading (mostly arrays of ints/floats/...), add utils to recursively get all items of a struct.

    New `BlendFileBlock.items_recursive_iter()` will yield all valid key/values pair of a given struct,
    including sub ones (e.g. 'id.next', 'id.name', etc.).
2016-01-18 22:08:20 +01:00
5e9eb15409 Add 'bam copy' command. 2016-01-13 02:38:59 +11:00
28429f297b blendfile: "fix" blocks' iteration over values, and add 'user_data' member to Blocks and DNAStruct objects.
Currently blendfile.py does not know how to handle embeded structs - this is solvable for later, but at least
do not raise exception about that when using values()/items() helpers of BlendFileBlock
(for now, return Ellipsis in those cases).

Also, added some user_data member to BlendFileBlock and DNAStruct classes, handy when you need to store
some own data for each of those, and want to avoid having your own list or dict for that.
2015-12-10 16:16:19 +01:00
fba8bf04d6 Fix for stupid typo 2015-06-12 23:50:00 +10:00
e41a17735e Change pack --exclude behavior, don't touch excluded paths at all
Was omitting from zip, but still remapping.
2015-06-11 21:11:04 +10:00
7d7fede5b2 Support context manager for opening blend file 2015-06-09 03:08:18 +10:00
88eefcf6bc check source mode before including alembic files 2015-06-08 23:47:18 +10:00
0aa730089b pack, support --exclude argument
See: bam pack --help
2015-06-04 14:55:40 +10:00
c3d4d85342 Only pack input cache 2015-06-02 21:46:50 +10:00
18901fa5f7 Add alembic support (with option so we can disable) 2015-05-08 01:17:24 +10:00
9e92aa7736 Fix T44099: Packing textures fails
files that touched the same path multiple times was broken
2015-03-25 04:03:51 +11:00
6b0735e402 blendfile: remove redundant struct use 2015-03-05 09:58:32 +11:00