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 = {
"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
......
......@@ -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
......
......@@ -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()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment