diff options
author | Ryan Inch <mythologylover75@gmail.com> | 2020-01-09 05:28:45 +0300 |
---|---|---|
committer | Ryan Inch <mythologylover75@gmail.com> | 2020-01-09 05:28:45 +0300 |
commit | 4e3539fa890a0f4f43269751b28476122c8b9f6d (patch) | |
tree | 384334232e4ff5978462ea8e96423a5aea14437b /object_collection_manager | |
parent | bad59573c39e07fb2e9e006c60d77ae1151e6103 (diff) |
Collection Manager: Fix selection bug. Task: T69577
Prevents the selection in the treeview from throwing an error
when there is only the master collection.
Diffstat (limited to 'object_collection_manager')
-rw-r--r-- | object_collection_manager/__init__.py | 2 | ||||
-rw-r--r-- | object_collection_manager/ui.py | 9 |
2 files changed, 8 insertions, 3 deletions
diff --git a/object_collection_manager/__init__.py b/object_collection_manager/__init__.py index e5ca072f..4d19a5da 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,6), + "version": (1,8,7), "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 2a37a197..604f105d 100644 --- a/object_collection_manager/ui.py +++ b/object_collection_manager/ui.py @@ -177,7 +177,7 @@ class CollectionManager(Operator): active_laycol_row_index = layer_collections[active_laycol_name]["row_index"] context.scene.CMListIndex = active_laycol_row_index except: - context.scene.CMListIndex = 0 + context.scene.CMListIndex = -1 if context.scene.CM_Phantom_Mode: if set(layer_collections.keys()) != set(phantom_history["initial_state"].keys()): @@ -190,7 +190,12 @@ class CollectionManager(Operator): def update_selection(self, context): - selected_item = context.scene.CMListCollection[context.scene.CMListIndex] + scn = context.scene + + if scn.CMListIndex == -1: + return + + selected_item = scn.CMListCollection[scn.CMListIndex] layer_collection = layer_collections[selected_item.name]["ptr"] context.view_layer.active_layer_collection = layer_collection |