From c609f720804ebe5ad6c82a92ddfcec08bf211731 Mon Sep 17 00:00:00 2001 From: Fabian Date: Wed, 16 Jun 2021 12:29:56 +0200 Subject: [PATCH 1/2] fix: All brushes --- multi_user/utils.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/multi_user/utils.py b/multi_user/utils.py index a593015..c8539b6 100644 --- a/multi_user/utils.py +++ b/multi_user/utils.py @@ -101,11 +101,14 @@ def get_state_str(state): def clean_scene(): - for type_name in dir(bpy.data): + to_delete = [f for f in dir(bpy.data) if f not in ['brushes', 'palettes']] + for type_name in to_delete: try: + sub_collection_to_avoid = [bpy.data.linestyles['LineStyle'], bpy.data.materials['Dots Stroke']] type_collection = getattr(bpy.data, type_name) for item in type_collection: - type_collection.remove(item) + if item not in sub_collection_to_avoid : + type_collection.remove(item) except: continue From 5830fe1abb06cf2f6f1973bc0f05bac5ad83cf12 Mon Sep 17 00:00:00 2001 From: Fabian Date: Wed, 16 Jun 2021 14:28:26 +0200 Subject: [PATCH 2/2] fix: add `items_to_remove` --- multi_user/utils.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/multi_user/utils.py b/multi_user/utils.py index c8539b6..adae5c4 100644 --- a/multi_user/utils.py +++ b/multi_user/utils.py @@ -106,9 +106,12 @@ def clean_scene(): try: sub_collection_to_avoid = [bpy.data.linestyles['LineStyle'], bpy.data.materials['Dots Stroke']] type_collection = getattr(bpy.data, type_name) - for item in type_collection: - if item not in sub_collection_to_avoid : - type_collection.remove(item) + items_to_remove = [i for i in type_collection if i not in sub_collection_to_avoid] + for item in items_to_remove: + try: + type_collection.remove(item) + except: + continue except: continue