fix: add items_to_remove

This commit is contained in:
Fabian 2021-06-16 14:28:26 +02:00
parent c609f72080
commit 5830fe1abb

View File

@ -106,9 +106,12 @@ def clean_scene():
try: try:
sub_collection_to_avoid = [bpy.data.linestyles['LineStyle'], bpy.data.materials['Dots Stroke']] sub_collection_to_avoid = [bpy.data.linestyles['LineStyle'], bpy.data.materials['Dots Stroke']]
type_collection = getattr(bpy.data, type_name) type_collection = getattr(bpy.data, type_name)
for item in type_collection: items_to_remove = [i for i in type_collection if i not in sub_collection_to_avoid]
if item not in sub_collection_to_avoid : for item in items_to_remove:
type_collection.remove(item) try:
type_collection.remove(item)
except:
continue
except: except:
continue continue