Collection Manager: Depth first renumber. Task: T69577

Add a depth first option to the Renumber QCD Slots operator.
This commit is contained in:
Ryan Inch 2020-06-25 00:56:08 -04:00
parent 2aa4745799
commit 0e9e40f5e4
3 changed files with 12 additions and 4 deletions

View File

@ -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

View File

@ -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

View File

@ -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()