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:
-rw-r--r--object_collection_manager/__init__.py2
-rw-r--r--object_collection_manager/internals.py16
-rw-r--r--object_collection_manager/qcd_move_widget.py6
-rw-r--r--object_collection_manager/ui.py23
4 files changed, 32 insertions, 15 deletions
diff --git a/object_collection_manager/__init__.py b/object_collection_manager/__init__.py
index ad67c29b..1e74a3c0 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, 12, 2),
+ "version": (2, 12, 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/internals.py b/object_collection_manager/internals.py
index 8a225443..857e73aa 100644
--- a/object_collection_manager/internals.py
+++ b/object_collection_manager/internals.py
@@ -597,13 +597,21 @@ def generate_state():
return state
-def get_move_selection():
+def get_move_selection(*, names_only=False):
global move_selection
if not move_selection:
- move_selection = [obj.name for obj in bpy.context.selected_objects]
+ move_selection = {obj.name for obj in bpy.context.selected_objects}
- return [bpy.data.objects[name] for name in move_selection]
+ if names_only:
+ return move_selection
+
+ else:
+ if len(move_selection) <= 5:
+ return {bpy.data.objects[name] for name in move_selection}
+
+ else:
+ return {obj for obj in bpy.data.objects if obj.name in move_selection}
def get_move_active():
@@ -613,7 +621,7 @@ def get_move_active():
if not move_active:
move_active = getattr(bpy.context.view_layer.objects.active, "name", None)
- if move_active not in [obj.name for obj in get_move_selection()]:
+ if move_active not in get_move_selection(names_only=True):
move_active = None
return bpy.data.objects[move_active] if move_active else None
diff --git a/object_collection_manager/qcd_move_widget.py b/object_collection_manager/qcd_move_widget.py
index 28ed9c01..1b2a6bee 100644
--- a/object_collection_manager/qcd_move_widget.py
+++ b/object_collection_manager/qcd_move_widget.py
@@ -655,6 +655,10 @@ def allocate_main_ui(self, context):
self.areas["Button Row 2 B"] = button_row_2_b
+ selected_objects = qcd_operators.get_move_selection()
+ active_object = qcd_operators.get_move_active()
+
+
# BUTTONS
def get_buttons(button_row, row_num):
cur_width_pos = button_row["vert"][0]
@@ -667,8 +671,6 @@ def allocate_main_ui(self, context):
if qcd_slot_name:
qcd_laycol = layer_collections[qcd_slot_name]["ptr"]
collection_objects = qcd_laycol.collection.objects
- selected_objects = qcd_operators.get_move_selection()
- active_object = qcd_operators.get_move_active()
# BUTTON
x = cur_width_pos
diff --git a/object_collection_manager/ui.py b/object_collection_manager/ui.py
index c6403fe2..7858e5bf 100644
--- a/object_collection_manager/ui.py
+++ b/object_collection_manager/ui.py
@@ -178,8 +178,12 @@ class CollectionManager(Operator):
row_setcol = global_rto_row.row()
row_setcol.alignment = 'LEFT'
row_setcol.operator_context = 'INVOKE_DEFAULT'
+
selected_objects = get_move_selection()
active_object = get_move_active()
+ CM_UL_items.selected_objects = selected_objects
+ CM_UL_items.active_object = active_object
+
collection = context.view_layer.layer_collection.collection
icon = 'MESH_CUBE'
@@ -188,7 +192,7 @@ class CollectionManager(Operator):
if active_object and active_object.name in collection.objects:
icon = 'SNAP_VOLUME'
- elif not set(selected_objects).isdisjoint(collection.objects):
+ elif not selected_objects.isdisjoint(collection.objects):
icon = 'STICKY_UVS_LOC'
else:
@@ -437,6 +441,9 @@ class CollectionManager(Operator):
class CM_UL_items(UIList):
last_filter_value = ""
+ selected_objects = set()
+ active_object = None
+
filter_by_selected: BoolProperty(
name="Filter By Selected",
default=False,
@@ -456,8 +463,8 @@ class CM_UL_items(UIList):
view_layer = context.view_layer
laycol = layer_collections[item.name]
collection = laycol["ptr"].collection
- selected_objects = get_move_selection()
- active_object = get_move_active()
+ selected_objects = CM_UL_items.selected_objects
+ active_object = CM_UL_items.active_object
column = layout.column(align=True)
@@ -545,7 +552,7 @@ class CM_UL_items(UIList):
if active_object and active_object.name in collection.objects:
icon = 'SNAP_VOLUME'
- elif not set(selected_objects).isdisjoint(collection.objects):
+ elif not selected_objects.isdisjoint(collection.objects):
icon = 'STICKY_UVS_LOC'
else:
@@ -781,14 +788,15 @@ def view3d_header_qcd_slots(self, context):
update_collection_tree(context)
+ selected_objects = get_move_selection()
+ active_object = get_move_active()
+
for x in range(20):
qcd_slot_name = qcd_slots.get_name(str(x+1))
if qcd_slot_name:
qcd_laycol = layer_collections[qcd_slot_name]["ptr"]
collection_objects = qcd_laycol.collection.objects
- selected_objects = get_move_selection()
- active_object = get_move_active()
icon_value = 0
@@ -797,9 +805,8 @@ def view3d_header_qcd_slots(self, context):
active_object.name in collection_objects):
icon = 'LAYER_ACTIVE'
-
# if there are selected objects use LAYER_ACTIVE
- elif not set(selected_objects).isdisjoint(collection_objects):
+ elif not selected_objects.isdisjoint(collection_objects):
icon = 'LAYER_USED'
# If there are objects use LAYER_USED