Collection Manager: Improve width calculation. Task: T69577
Improves the width calculation for the main window to better accommodate sub-collections and take into account the width of the scroll bar when it's present.
This commit is contained in:
parent
4e3539fa89
commit
e7a8ab2481
|
@ -22,7 +22,7 @@ bl_info = {
|
|||
"name": "Collection Manager",
|
||||
"description": "Manage collections and their objects",
|
||||
"author": "Ryan Inch",
|
||||
"version": (1,8,7),
|
||||
"version": (1,8,8),
|
||||
"blender": (2, 80, 0),
|
||||
"location": "View3D - Object Mode (Shortcut - M)",
|
||||
"warning": '', # used for warning icon and text in addons panel
|
||||
|
|
|
@ -152,23 +152,8 @@ class CollectionManager(Operator):
|
|||
|
||||
def execute(self, context):
|
||||
wm = context.window_manager
|
||||
lvl = 0
|
||||
|
||||
#expanded.clear()
|
||||
|
||||
#excludeall_history.clear()
|
||||
#restrictselectall_history.clear()
|
||||
#hideall_history.clear()
|
||||
#disableviewall_history.clear()
|
||||
#disablerenderall_history.clear()
|
||||
|
||||
update_property_group(context)
|
||||
|
||||
lvl = get_max_lvl()
|
||||
|
||||
if lvl > 25:
|
||||
lvl = 25
|
||||
|
||||
self.view_layer = context.view_layer.name
|
||||
|
||||
# sync selection in ui list with active layer collection
|
||||
|
@ -179,6 +164,7 @@ class CollectionManager(Operator):
|
|||
except:
|
||||
context.scene.CMListIndex = -1
|
||||
|
||||
# check if in phantom mode and if it's still viable
|
||||
if context.scene.CM_Phantom_Mode:
|
||||
if set(layer_collections.keys()) != set(phantom_history["initial_state"].keys()):
|
||||
context.scene.CM_Phantom_Mode = False
|
||||
|
@ -186,7 +172,22 @@ class CollectionManager(Operator):
|
|||
if context.view_layer.name != phantom_history["view_layer"]:
|
||||
context.scene.CM_Phantom_Mode = False
|
||||
|
||||
return wm.invoke_popup(self, width=(400+(lvl*20)))
|
||||
# handle window sizing
|
||||
max_width = 960
|
||||
min_width = 456
|
||||
width_step = 21
|
||||
scrollbar_width = 21
|
||||
lvl = get_max_lvl()
|
||||
|
||||
width = min_width + (width_step * lvl)
|
||||
|
||||
if len(layer_collections) > 14:
|
||||
width += scrollbar_width
|
||||
|
||||
if width > max_width:
|
||||
width = max_width
|
||||
|
||||
return wm.invoke_popup(self, width=width)
|
||||
|
||||
|
||||
def update_selection(self, context):
|
||||
|
|
Loading…
Reference in New Issue