[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [35637] trunk/blender/source/tests/ batch_import.py: fix so the batch importer can run with addons passed as arguments.

Campbell Barton ideasman42 at gmail.com
Sun Mar 20 07:02:47 CET 2011


Revision: 35637
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=35637
Author:   campbellbarton
Date:     2011-03-20 06:02:47 +0000 (Sun, 20 Mar 2011)
Log Message:
-----------
fix so the batch importer can run with addons passed as arguments.

Modified Paths:
--------------
    trunk/blender/source/tests/batch_import.py

Modified: trunk/blender/source/tests/batch_import.py
===================================================================
--- trunk/blender/source/tests/batch_import.py	2011-03-20 04:44:03 UTC (rev 35636)
+++ trunk/blender/source/tests/batch_import.py	2011-03-20 06:02:47 UTC (rev 35637)
@@ -34,6 +34,14 @@
     --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 @@
                    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 @@
     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)




More information about the Bf-blender-cvs mailing list