diff options
author | Campbell Barton <ideasman42@gmail.com> | 2011-03-20 09:02:47 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2011-03-20 09:02:47 +0300 |
commit | 35cee79a37ba1a6712ec92e027c70c9c14cd5b94 (patch) | |
tree | cd79ca86175c50a8de6a7128eb675172cdb95969 | |
parent | 283bac0073490c5e0b6323f8cffeab1d1b816b3a (diff) |
fix so the batch importer can run with addons passed as arguments.
-rw-r--r-- | source/tests/batch_import.py | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/source/tests/batch_import.py b/source/tests/batch_import.py index 5fbe38e08ce..627acbcdb6c 100644 --- a/source/tests/batch_import.py +++ b/source/tests/batch_import.py @@ -34,6 +34,14 @@ Example Usage: --match="*.3ds" \ --start=0 --end=1000 \ --save_path=/tmp/test + +./blender.bin --background --addons io_curve_svg --python source/tests/batch_import.py -- \ + --operator="bpy.ops.import_curve.svg" \ + --path="/usr/" \ + --match="*.svg" \ + --start=0 --end=1000 \ + --save_path=/tmp/test + """ import os @@ -61,8 +69,9 @@ def batch_import(operator="", start=0, end=sys.maxsize, ): + import addon_utils + _reset_all = addon_utils.reset_all # XXX, hack - print(list(globals().keys())) import fnmatch path = os.path.normpath(path) @@ -100,7 +109,13 @@ def batch_import(operator="", op = eval(operator) for i, f in enumerate(files): print(" %s(filepath=%r) # %d of %d" % (operator, f, i + start, len(files))) + + # hack so loading the new file doesnt undo our loaded addons + addon_utils.reset_all = lambda: None # XXX, hack + bpy.ops.wm.read_factory_settings() + + addon_utils.reset_all = _reset_all # XXX, hack clear_scene() op(filepath=f) |