Revision: 34625
          
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=34625
Author:   campbellbarton
Date:     2011-02-03 11:02:02 +0000 (Thu, 03 Feb 2011)
Log Message:
-----------
remove unused variable
also clear scene data before running batch import (utility script).

Modified Paths:
--------------
    trunk/blender/source/blender/editors/screen/screen_ops.c
    trunk/blender/source/tests/batch_import.py

Modified: trunk/blender/source/blender/editors/screen/screen_ops.c
===================================================================
--- trunk/blender/source/blender/editors/screen/screen_ops.c    2011-02-03 
10:07:15 UTC (rev 34624)
+++ trunk/blender/source/blender/editors/screen/screen_ops.c    2011-02-03 
11:02:02 UTC (rev 34625)
@@ -2695,7 +2695,6 @@
                sound_stop_scene(scene);
        }
        else {
-               ScrArea *sa= CTX_wm_area(C);
                int refresh= SPACE_TIME; /* these settings are currently only 
available from a menu in the TimeLine */
                
                if (mode == 1) // XXX only play audio forwards!?

Modified: trunk/blender/source/tests/batch_import.py
===================================================================
--- trunk/blender/source/tests/batch_import.py  2011-02-03 10:07:15 UTC (rev 
34624)
+++ trunk/blender/source/tests/batch_import.py  2011-02-03 11:02:02 UTC (rev 
34625)
@@ -20,13 +20,39 @@
 
 """
 Example Usage:
-  blender --background --python source/tests/batch_import.py --  
--operator="bpy.ops.import_scene.obj" --path="/fe/obj" --match="*.obj" 
--start=0 --end=10 --save_path=/tmp/test
+
+./blender.bin --background --python source/tests/batch_import.py -- \
+    --operator="bpy.ops.import_scene.obj" \
+    --path="/fe/obj" \
+    --match="*.obj" \
+    --start=0 --end=10 \
+    --save_path=/tmp/test
+
+./blender.bin --background --python source/tests/batch_import.py -- \
+    --operator="bpy.ops.import_scene.autodesk_3ds" \
+    --path="/fe/" \
+    --match="*.3ds" \
+    --start=0 --end=1000 \
+    --save_path=/tmp/test
 """
 
 import os
 import sys
 
+def clear_scene():
+    import bpy
+    unique_obs = set()
+    for scene in bpy.data.scenes:
+        for obj in scene.objects[:]:
+            scene.objects.unlink(obj)
+            unique_obs.add(obj)
 
+    # remove obdata, for now only worry about the startup scene
+    for bpy_data_iter in (bpy.data.objects, bpy.data.meshes, bpy.data.lamps, 
bpy.data.cameras):
+        for id_data in bpy_data_iter:
+            bpy_data_iter.remove(id_data)
+
+
 def batch_import(operator="",
                    path="",
                    save_path="",
@@ -74,6 +100,7 @@
     for i, f in enumerate(files):
         print("    %s(filepath=%r) # %d of %d" % (operator, f, i + start, 
len(files)))
         bpy.ops.wm.read_factory_settings()
+        clear_scene()
 
         op(filepath=f)
 

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to