[Durian-svn] [4100] clear action script
campbell
institute at blender.org
Sat May 29 18:35:44 CEST 2010
Revision: 4100
https://blenderinstitute.dyndns.org/durian-svn/?do=log&project=durian&path=/&rev=4100
Author: campbell
Date: 2010-05-29 18:35:44 +0200 (Sat, 29 May 2010)
Log Message:
-----------
clear action script
Modified Paths:
--------------
pro/scripts/utilities/findPathError.py
Modified: pro/scripts/utilities/findPathError.py
===================================================================
--- pro/scripts/utilities/findPathError.py 2010-05-29 16:10:38 UTC (rev 4099)
+++ pro/scripts/utilities/findPathError.py 2010-05-29 16:35:44 UTC (rev 4100)
@@ -189,7 +189,7 @@
def report_zombie_objects():
for obj in bpy.data.objects:
if obj.library is None:
- if not obj.scene_users and not obj.group_users:
+ if not obj.users_scene and not obj.users_group:
print("ERROR ZOMBIE:", obj)
@@ -263,6 +263,27 @@
return change
+
+def clear_actions():
+ clear = 0
+ tot = 0
+ for act in bpy.data.actions:
+ if act.library == None:
+ users = act.users
+ if act.fake_user:
+ users -= 1
+
+ if users == 0:
+ if act.name.startswith("Action"): # <--- durian exception, assume named actions should be kept.
+ act.user_clear()
+ clear += 1
+
+ tot += 1
+
+ print("Cleared %d of %d actions! (save and reload)" % (clear, tot))
+ return bool(clear)
+
+
if __name__ == "__main__":
change = 0
report_images()
@@ -274,8 +295,12 @@
#change |= make_relative()
#change |= clear_images(rem_missing = True)
#change |= merge_duplicates()
-
+ change |= clear_actions()
+
print("Changing??? ", change)
if change:
bpy.ops.wm.save_mainfile(check_existing=False, path=bpy.data.filename)
-
\ No newline at end of file
+
+ # incase running in GUI mode
+ import sys
+ sys.exit(0)
More information about the Durian-svn
mailing list