[Bf-extensions-cvs] [e7a8ab24] master: Collection Manager: Improve width calculation. Task: T69577
Ryan Inch
noreply at git.blender.org
Thu Jan 9 07:18:44 CET 2020
Commit: e7a8ab248112edffe09b574b68352160b59021db
Author: Ryan Inch
Date: Thu Jan 9 01:15:22 2020 -0500
Branches: master
https://developer.blender.org/rBAe7a8ab248112edffe09b574b68352160b59021db
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.
===================================================================
M object_collection_manager/__init__.py
M object_collection_manager/ui.py
===================================================================
diff --git a/object_collection_manager/__init__.py b/object_collection_manager/__init__.py
index 4d19a5da..16917fff 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": (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
diff --git a/object_collection_manager/ui.py b/object_collection_manager/ui.py
index 604f105d..dfdeb889 100644
--- a/object_collection_manager/ui.py
+++ b/object_collection_manager/ui.py
@@ -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):
More information about the Bf-extensions-cvs
mailing list