Skip to content
Snippets Groups Projects
Commit 0e9e40f5 authored by Ryan Inch's avatar Ryan Inch
Browse files

Collection Manager: Depth first renumber. Task: T69577

Add a depth first option to the Renumber QCD Slots operator.
parent 2aa47457
No related branches found
No related tags found
No related merge requests found
...@@ -22,7 +22,7 @@ bl_info = { ...@@ -22,7 +22,7 @@ bl_info = {
"name": "Collection Manager", "name": "Collection Manager",
"description": "Manage collections and their objects", "description": "Manage collections and their objects",
"author": "Ryan Inch", "author": "Ryan Inch",
"version": (2, 8, 0), "version": (2, 9, 0),
"blender": (2, 80, 0), "blender": (2, 80, 0),
"location": "View3D - Object Mode (Shortcut - M)", "location": "View3D - Object Mode (Shortcut - M)",
"warning": '', # used for warning icon and text in addons panel "warning": '', # used for warning icon and text in addons panel
......
...@@ -210,7 +210,7 @@ class QCDSlots(): ...@@ -210,7 +210,7 @@ class QCDSlots():
if self.length() > 20: if self.length() > 20:
break break
def renumerate(self, *, beginning=False): def renumerate(self, *, depth_first=False, beginning=False):
if beginning: if beginning:
self.clear_slots() self.clear_slots()
self.overrides.clear() self.overrides.clear()
...@@ -242,7 +242,11 @@ class QCDSlots(): ...@@ -242,7 +242,11 @@ class QCDSlots():
self.add_slot(f"{x+1}", layer_collection.name) 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: if self.length() > 20:
break break
......
...@@ -287,7 +287,8 @@ class RenumerateQCDSlots(Operator): ...@@ -287,7 +287,8 @@ class RenumerateQCDSlots(Operator):
bl_label = "Renumber QCD Slots" bl_label = "Renumber QCD Slots"
bl_description = ( bl_description = (
"Renumber QCD slots.\n" "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" " * Alt+LMB - Renumber from the beginning"
) )
bl_idname = "view3d.renumerate_qcd_slots" bl_idname = "view3d.renumerate_qcd_slots"
...@@ -301,6 +302,9 @@ class RenumerateQCDSlots(Operator): ...@@ -301,6 +302,9 @@ class RenumerateQCDSlots(Operator):
if modifiers == {'alt'}: if modifiers == {'alt'}:
qcd_slots.renumerate(beginning=True) qcd_slots.renumerate(beginning=True)
elif modifiers == {'ctrl'}:
qcd_slots.renumerate(depth_first=True)
else: else:
qcd_slots.renumerate() qcd_slots.renumerate()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment