diff options
author | Ryan Inch <mythologylover75@gmail.com> | 2020-08-11 07:02:52 +0300 |
---|---|---|
committer | Ryan Inch <mythologylover75@gmail.com> | 2020-08-11 07:02:52 +0300 |
commit | 1d1bb1a707554ce51696d85d2feb9718e34a0220 (patch) | |
tree | d17b7d663e1eb2ad9c41b36412148fc15dfe4a4a /object_collection_manager/operators.py | |
parent | 8db46434a4b25569372a7172f83733ec14dffb31 (diff) |
Collection Manager: Object selection. Task: T69577
Adds the ability to select all object in a QCD slot.
Alt+LMB deselects everything and selects all objects in the QCD slot.
Alt+Shift+LMB adds/removes objects in the QCD slot to/from the selection.
Added a selection operator for use in the Collection Manager popup.
(currently unused)
Diffstat (limited to 'object_collection_manager/operators.py')
-rw-r--r-- | object_collection_manager/operators.py | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/object_collection_manager/operators.py b/object_collection_manager/operators.py index 46e83023..7509d3f2 100644 --- a/object_collection_manager/operators.py +++ b/object_collection_manager/operators.py @@ -65,6 +65,7 @@ from .operator_utils import ( clear_swap, link_child_collections_to_parent, remove_collection, + select_collection_objects, ) class SetActiveCollection(Operator): @@ -215,6 +216,58 @@ class ExpandSublevelOperator(Operator): return {'FINISHED'} +class CMSelectCollectionObjectsOperator(Operator): + bl_label = "Select All Objects in the Collection" + bl_description = ( + " * LMB - Select all objects in collection.\n" + " * Shift+LMB - Add/Remove collection objects from selection.\n" + " * Ctrl+LMB - Isolate nested selection.\n" + " * Ctrl+Shift+LMB - Add/Remove nested from selection" + ) + bl_idname = "view3d.select_collection_objects" + bl_options = {'REGISTER', 'UNDO'} + + collection_index: IntProperty() + collection_name: StringProperty() + + def invoke(self, context, event): + modifiers = get_modifiers(event) + + if modifiers == {"shift"}: + select_collection_objects( + collection_index=self.collection_index, + collection_name=self.collection_name, + replace=False, + nested=False + ) + + elif modifiers == {"ctrl"}: + select_collection_objects( + collection_index=self.collection_index, + collection_name=self.collection_name, + replace=True, + nested=True + ) + + elif modifiers == {"ctrl", "shift"}: + select_collection_objects( + collection_index=self.collection_index, + collection_name=self.collection_name, + replace=False, + nested=True + ) + + else: + select_collection_objects( + collection_index=self.collection_index, + collection_name=self.collection_name, + replace=True, + nested=False + ) + + return {'FINISHED'} + + class CMSetCollectionOperator(Operator): bl_label = "Set Object Collection" bl_description = ( |