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:
authorRyan Inch <mythologylover75@gmail.com>2020-09-16 06:33:16 +0300
committerRyan Inch <mythologylover75@gmail.com>2020-09-16 06:33:16 +0300
commitafe8fd7ce5e6e9d107c042e7e463909e407dbcae (patch)
treea90cf59fd0dedeb9c633735a20ceb28addfb3163 /object_collection_manager
parent32f0fe86807f453e09cad573e9502281c030a403 (diff)
Collection Manager: Fix QCD slot toggling error. Task: T69577
Fixes QCD slots being unable to be toggled on when they contain objects in edit mode. Fixes an error when toggling and there is no active object.
Diffstat (limited to 'object_collection_manager')
-rw-r--r--object_collection_manager/__init__.py2
-rw-r--r--object_collection_manager/qcd_operators.py33
2 files changed, 15 insertions, 20 deletions
diff --git a/object_collection_manager/__init__.py b/object_collection_manager/__init__.py
index 769c60b5..72a279d1 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 b64c87f8..6b5bce4a 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