[Bf-extensions-cvs] [11aebc01] master: Collection Manager: Fix nested selection bug. Task: T69577
Ryan Inch
noreply at git.blender.org
Tue Oct 26 10:14:03 CEST 2021
Commit: 11aebc017869f0ae86cbd8aa8927e6bb511fec85
Author: Ryan Inch
Date: Tue Oct 26 04:10:38 2021 -0400
Branches: master
https://developer.blender.org/rBA11aebc017869f0ae86cbd8aa8927e6bb511fec85
Collection Manager: Fix nested selection bug. Task: T69577
Fix a bug where attempting to deselect nested collections fails
when there are no objects present in the parent collection.
Reported by 1D_Inc
===================================================================
M object_collection_manager/__init__.py
M object_collection_manager/operator_utils.py
===================================================================
diff --git a/object_collection_manager/__init__.py b/object_collection_manager/__init__.py
index aa9211d6..53004bac 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, 23, 0),
+ "version": (2, 23, 1),
"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/operator_utils.py b/object_collection_manager/operator_utils.py
index 820ab1bb..ec72fdb4 100644
--- a/object_collection_manager/operator_utils.py
+++ b/object_collection_manager/operator_utils.py
@@ -134,7 +134,7 @@ def set_rto(layer_collection, rto, value):
setattr(collection, rto_path[rto].split(".")[1], value)
-def apply_to_children(parent, apply_function):
+def apply_to_children(parent, apply_function, *args, **kwargs):
# works for both Collections & LayerCollections
child_lists = [parent.children]
@@ -143,7 +143,7 @@ def apply_to_children(parent, apply_function):
for child_list in child_lists:
for child in child_list:
- apply_function(child)
+ apply_function(child, *args, **kwargs)
if child.children:
new_child_lists.append(child.children)
@@ -620,20 +620,20 @@ def select_collection_objects(is_master_collection, collection_name, replace, ne
if replace:
bpy.ops.object.select_all(action='DESELECT')
- if selection_state == None:
- selection_state = get_move_selection().isdisjoint(target_collection.objects)
+ def select_objects(collection, selection_state):
+ if selection_state == None:
+ selection_state = get_move_selection().isdisjoint(collection.objects)
- def select_objects(collection):
- for obj in collection.objects:
- try:
- obj.select_set(selection_state)
- except RuntimeError:
- pass
+ for obj in collection.objects:
+ try:
+ obj.select_set(selection_state)
+ except RuntimeError:
+ pass
- select_objects(target_collection)
+ select_objects(target_collection, selection_state)
if nested:
- apply_to_children(target_collection, select_objects)
+ apply_to_children(target_collection, select_objects, selection_state)
def set_exclude_state(target_layer_collection, state):
# get current child exclusion state
More information about the Bf-extensions-cvs
mailing list