diff options
author | Ryan Inch <mythologylover75@gmail.com> | 2020-04-25 11:15:30 +0300 |
---|---|---|
committer | Ryan Inch <mythologylover75@gmail.com> | 2020-04-25 11:32:07 +0300 |
commit | fa71f709da9cdeccde8b22f228886069d828f6c6 (patch) | |
tree | 5ea0f09275672ea59c518677916023be39b5a093 /object_collection_manager/operators.py | |
parent | b734e59dd43b1d6550aad36daebd043bf9ea5d2e (diff) |
Collection Manager: Fix active collections. Task: T69577
Fix display of and interaction with active collections.
Diffstat (limited to 'object_collection_manager/operators.py')
-rw-r--r-- | object_collection_manager/operators.py | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/object_collection_manager/operators.py b/object_collection_manager/operators.py index c1259acd..b03370d9 100644 --- a/object_collection_manager/operators.py +++ b/object_collection_manager/operators.py @@ -69,13 +69,13 @@ class SetActiveCollection(Operator): '''Set the active collection''' bl_label = "Set Active Collection" bl_idname = "view3d.set_active_collection" - bl_options = {'REGISTER', 'UNDO'} + bl_options = {'UNDO'} collection_index: IntProperty() collection_name: StringProperty() def execute(self, context): - if self.collection_index == 0: + if self.collection_index == -1: cm = context.scene.collection_manager cm.cm_list_index = -1 layer_collection = context.view_layer.layer_collection @@ -86,6 +86,9 @@ class SetActiveCollection(Operator): context.view_layer.active_layer_collection = layer_collection + if context.view_layer.active_layer_collection != layer_collection: + self.report({'WARNING'}, "Can't set excluded collection as active") + return {'FINISHED'} @@ -961,6 +964,11 @@ class CMNewCollectionOperator(Operator): cm.cm_list_index = 0 + + # set new collection to active + layer_collection = layer_collections[new_collection.name]["ptr"] + context.view_layer.active_layer_collection = layer_collection + global rename rename[0] = True |