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/qcd_init.py2
-rw-r--r--object_collection_manager/qcd_operators.py64
-rw-r--r--object_collection_manager/ui.py7
4 files changed, 73 insertions, 2 deletions
diff --git a/object_collection_manager/__init__.py b/object_collection_manager/__init__.py
index 3936d11b..aa9211d6 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, 22, 3),
+ "version": (2, 23, 0),
"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_init.py b/object_collection_manager/qcd_init.py
index 49951da3..ed235a63 100644
--- a/object_collection_manager/qcd_init.py
+++ b/object_collection_manager/qcd_init.py
@@ -59,6 +59,8 @@ qcd_classes = (
qcd_operators.MoveToQCDSlot,
qcd_operators.ViewQCDSlot,
qcd_operators.ViewMoveQCDSlot,
+ qcd_operators.UnassignedQCDSlot,
+ qcd_operators.CreateAllQCDSlots,
qcd_operators.RenumerateQCDSlots,
ui.EnableAllQCDSlotsMenu,
)
diff --git a/object_collection_manager/qcd_operators.py b/object_collection_manager/qcd_operators.py
index 5f465eb5..0fdf1045 100644
--- a/object_collection_manager/qcd_operators.py
+++ b/object_collection_manager/qcd_operators.py
@@ -759,6 +759,70 @@ class ViewQCDSlot(Operator):
return {'FINISHED'}
+class UnassignedQCDSlot(Operator):
+ bl_label = ""
+ bl_idname = "view3d.unassigned_qcd_slot"
+ bl_options = {'REGISTER', 'UNDO'}
+
+ slot: StringProperty()
+
+ @classmethod
+ def description(cls, context, properties):
+ slot_string = f"Unassigned QCD Slot {properties.slot}:\n"
+
+ hotkey_string = (
+ " * LMB - Create slot.\n"
+ " * Shift+LMB - Create and isolate slot.\n"
+ " * Ctrl+LMB - Create and move objects to slot.\n"
+ " * Ctrl+Shift+LMB - Create and add objects to slot"
+ )
+
+ return f"{slot_string}{hotkey_string}"
+
+ def invoke(self, context, event):
+ modifiers = get_modifiers(event)
+
+ new_collection = bpy.data.collections.new(f"Collection {self.slot}")
+ context.scene.collection.children.link(new_collection)
+ internals.qcd_slots.add_slot(f"{self.slot}", new_collection.name)
+
+ # update tree view property
+ update_property_group(context)
+
+ if modifiers == {"shift"}:
+ bpy.ops.view3d.view_qcd_slot(slot=self.slot, toggle=False)
+
+ elif modifiers == {"ctrl"}:
+ bpy.ops.view3d.move_to_qcd_slot(slot=self.slot, toggle=False)
+
+ elif modifiers == {"ctrl", "shift"}:
+ bpy.ops.view3d.move_to_qcd_slot(slot=self.slot, toggle=True)
+
+ else:
+ pass
+
+ return {'FINISHED'}
+
+
+class CreateAllQCDSlots(Operator):
+ bl_label = "Create All QCD Slots"
+ bl_description = "Create any missing QCD slots so you have a full 20"
+ bl_idname = "view3d.create_all_qcd_slots"
+ bl_options = {'REGISTER', 'UNDO'}
+
+ def execute(self, context):
+ for slot_number in range(1, 21):
+ if not internals.qcd_slots.get_name(f"{slot_number}"):
+ new_collection = bpy.data.collections.new(f"Collection {slot_number}")
+ context.scene.collection.children.link(new_collection)
+ internals.qcd_slots.add_slot(f"{slot_number}", new_collection.name)
+
+ # update tree view property
+ update_property_group(context)
+
+ return {'FINISHED'}
+
+
class RenumerateQCDSlots(Operator):
bl_label = "Renumber QCD Slots"
bl_description = (
diff --git a/object_collection_manager/ui.py b/object_collection_manager/ui.py
index b7bc1b32..ec2c7354 100644
--- a/object_collection_manager/ui.py
+++ b/object_collection_manager/ui.py
@@ -1016,6 +1016,10 @@ class EnableAllQCDSlotsMenu(Menu):
def draw(self, context):
layout = self.layout
+ layout.operator("view3d.create_all_qcd_slots")
+
+ layout.separator()
+
layout.operator("view3d.enable_all_qcd_slots")
layout.operator("view3d.enable_all_qcd_slots_isolated")
@@ -1100,7 +1104,8 @@ def view3d_header_qcd_slots(self, context):
prop.slot = str(x+1)
else:
- row.label(text="", icon='X')
+ prop = row.operator("view3d.unassigned_qcd_slot", text="", icon='X', emboss=False)
+ prop.slot = str(x+1)
if idx%5==0: