Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender-addons.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'object_collection_manager/operators.py')
-rw-r--r--object_collection_manager/operators.py25
1 files changed, 25 insertions, 0 deletions
diff --git a/object_collection_manager/operators.py b/object_collection_manager/operators.py
index cfa4146c..afcfb266 100644
--- a/object_collection_manager/operators.py
+++ b/object_collection_manager/operators.py
@@ -265,6 +265,31 @@ class CMSelectCollectionObjectsOperator(Operator):
return {'FINISHED'}
+class SelectAllCumulativeObjectsOperator(Operator):
+ '''Select all objects that are present in more than one collection'''
+ bl_label = "Select All Cumulative Objects"
+ bl_idname = "view3d.select_all_cumulative_objects"
+
+ def execute(self, context):
+ selected_cumulative_objects = 0
+ total_cumulative_objects = 0
+
+ bpy.ops.object.select_all(action='DESELECT')
+
+ for obj in bpy.data.objects:
+ if len(obj.users_collection) > 1:
+ if obj.visible_get():
+ obj.select_set(True)
+ if obj.select_get() == True: # needed because obj.select_set can fail silently
+ selected_cumulative_objects +=1
+
+ total_cumulative_objects += 1
+
+ self.report({'INFO'}, f"{selected_cumulative_objects}/{total_cumulative_objects} Cumulative Objects Selected")
+
+ return {'FINISHED'}
+
+
class CMSetCollectionOperator(Operator):
bl_label = "Set Object Collection"
bl_description = (