diff --git a/object_collection_manager/__init__.py b/object_collection_manager/__init__.py index 769c60b5861c76b4fa61f3cc4070d8f0a9774c71..72a279d1abed317840825539897e11fa636889a8 100644 --- a/object_collection_manager/__init__.py +++ b/object_collection_manager/__init__.py @@ -22,7 +22,7 @@ bl_info = { "name": "Collection Manager", "description": "Manage collections and their objects", "author": "Ryan Inch", - "version": (2, 14, 2), + "version": (2, 14, 3), "blender": (2, 80, 0), "location": "View3D - Object Mode (Shortcut - M)", "warning": '', # used for warning icon and text in addons panel diff --git a/object_collection_manager/qcd_operators.py b/object_collection_manager/qcd_operators.py index b64c87f847c598e9952036b5c5825117861b0c02..6b5bce4a93dada8522100ed922f1de0ed0d29064 100644 --- a/object_collection_manager/qcd_operators.py +++ b/object_collection_manager/qcd_operators.py @@ -222,10 +222,11 @@ class ViewQCDSlot(Operator): if self.toggle: # check if slot can be toggled off. - for obj in qcd_laycol.collection.objects: - if obj.mode != 'OBJECT': - if obj.mode not in ['POSE', 'WEIGHT_PAINT'] or obj == locked_active_obj: - return {'CANCELLED'} + if not qcd_laycol.exclude: + for obj in qcd_laycol.collection.objects: + if obj.mode != 'OBJECT': + if obj.mode not in ['POSE', 'WEIGHT_PAINT'] or obj == locked_active_obj: + return {'CANCELLED'} # get current child exclusion state child_exclusion = [] @@ -242,15 +243,6 @@ class ViewQCDSlot(Operator): for laycol in child_exclusion: laycol[0].exclude = laycol[1] - # restore locked objects back to their original mode - # needed because of exclude child updates - if locked_objs: - context.view_layer.objects.active = locked_active_obj - bpy.ops.object.mode_set(mode=locked_objs_mode) - - # set layer as active layer collection - context.view_layer.active_layer_collection = qcd_laycol - else: # exclude all collections for laycol in layer_collections.values(): @@ -274,14 +266,17 @@ class ViewQCDSlot(Operator): apply_to_children(qcd_laycol, exclude_all_children) - # restore locked objects back to their original mode - # needed because of exclude child updates - if locked_objs: - context.view_layer.objects.active = locked_active_obj + + # restore locked objects back to their original mode + # needed because of exclude child updates + if locked_objs: + context.view_layer.objects.active = locked_active_obj + + if context.view_layer.objects.active: bpy.ops.object.mode_set(mode=locked_objs_mode) - # set layer as active layer collection - context.view_layer.active_layer_collection = qcd_laycol + # set layer as active layer collection + context.view_layer.active_layer_collection = qcd_laycol # update header UI