[Bf-extensions-cvs] [0e9e40f5] master: Collection Manager: Depth first renumber. Task: T69577

Ryan Inch noreply at git.blender.org
Thu Jun 25 06:58:49 CEST 2020


Commit: 0e9e40f5e438b27ebfa1d5931a6bc9250557b57e
Author: Ryan Inch
Date:   Thu Jun 25 00:56:08 2020 -0400
Branches: master
https://developer.blender.org/rBA0e9e40f5e438b27ebfa1d5931a6bc9250557b57e

Collection Manager: Depth first renumber. Task: T69577

Add a depth first option to the Renumber QCD Slots operator.

===================================================================

M	object_collection_manager/__init__.py
M	object_collection_manager/internals.py
M	object_collection_manager/qcd_operators.py

===================================================================

diff --git a/object_collection_manager/__init__.py b/object_collection_manager/__init__.py
index 6a1a9f22..91901c6f 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, 8, 0),
+    "version": (2, 9, 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/internals.py b/object_collection_manager/internals.py
index f3bcf37f..8e0c5b90 100644
--- a/object_collection_manager/internals.py
+++ b/object_collection_manager/internals.py
@@ -210,7 +210,7 @@ class QCDSlots():
                 if self.length() > 20:
                     break
 
-    def renumerate(self, *, beginning=False):
+    def renumerate(self, *, depth_first=False, beginning=False):
         if beginning:
             self.clear_slots()
             self.overrides.clear()
@@ -242,7 +242,11 @@ class QCDSlots():
                         self.add_slot(f"{x+1}", layer_collection.name)
 
 
-            laycol_iter_list.extend(list(layer_collection.children))
+            if depth_first:
+                laycol_iter_list[0:0] = list(layer_collection.children)
+
+            else:
+                laycol_iter_list.extend(list(layer_collection.children))
 
             if self.length() > 20:
                 break
diff --git a/object_collection_manager/qcd_operators.py b/object_collection_manager/qcd_operators.py
index 53212920..7330dd0f 100644
--- a/object_collection_manager/qcd_operators.py
+++ b/object_collection_manager/qcd_operators.py
@@ -287,7 +287,8 @@ class RenumerateQCDSlots(Operator):
     bl_label = "Renumber QCD Slots"
     bl_description = (
         "Renumber QCD slots.\n"
-        "  * LMB - Renumber starting from the slot designated 1.\n"
+        "  * LMB - Renumber (breadth first) starting from the slot designated 1.\n"
+        "  * Ctrl+LMB - Renumber (depth first) starting from the slot designated 1.\n"
         "  * Alt+LMB - Renumber from the beginning"
         )
     bl_idname = "view3d.renumerate_qcd_slots"
@@ -301,6 +302,9 @@ class RenumerateQCDSlots(Operator):
         if modifiers == {'alt'}:
             qcd_slots.renumerate(beginning=True)
 
+        elif modifiers == {'ctrl'}:
+            qcd_slots.renumerate(depth_first=True)
+
         else:
             qcd_slots.renumerate()



More information about the Bf-extensions-cvs mailing list