[Durian-svn] [5308] option to clear unused grops for batch script

campbell institute at blender.org
Fri Jun 18 12:26:14 CEST 2010


Revision: 5308
          https://blenderinstitute.dyndns.org/durian-svn/?do=log&project=durian&path=/&rev=5308
Author:   campbell
Date:     2010-06-18 12:26:14 +0200 (Fri, 18 Jun 2010)
Log Message:
-----------
option to clear unused grops for batch script

Modified Paths:
--------------
    pro/scripts/utilities/findPathError.py

Modified: pro/scripts/utilities/findPathError.py
===================================================================
--- pro/scripts/utilities/findPathError.py	2010-06-18 10:22:21 UTC (rev 5307)
+++ pro/scripts/utilities/findPathError.py	2010-06-18 10:26:14 UTC (rev 5308)
@@ -331,16 +331,41 @@
 
     print("Cleared %d of %d objects! (save and reload)" % (clear, tot))
     return bool(clear)
-    
 
+def clear_unused_groups():
+    clear = 0
+    tot = 0
 
+    for group in bpy.data.groups:
+        if not group.library:
+            if not group.users_dupli_group:
+                ok = 0
+                for ob in group.objects:
+                    if ob.users_scene:
+                        ok = 1
+                        break
+
+                if not ok:
+                    group.user_clear()
+                    for ob in group.objects:
+                        ob.user_clear()
+                    clear += 1
+
+            tot += 1
+
+    print("Cleared %d of %d groups! (save and reload)" % (clear, tot))
+    return bool(clear)
+
+
 if __name__ == "__main__":
     change = 0
+    '''
     report_images()
     report_modifiers()
     # report_drivers() # very verbose!
     report_zombie_objects()
     report_character_locations()
+    '''
     
     # optional, take care!
     #change |= make_relative()
@@ -348,6 +373,7 @@
     #change |= merge_duplicates()
     #change |= clear_actions()
     #change |= clear_durian_links()
+    change |= clear_unused_groups()
 
     print("Changing??? ", change)
     if change:



More information about the Durian-svn mailing list