Commit 45428803 authored by Ryan Inch's avatar Ryan Inch
Browse files

Collection Manager: sync list selection to active collection. Task: T69577

parent ef6ef414
......@@ -23,7 +23,7 @@ bl_info = {
"name": "Collection Manager",
"description": "Manage collections and their objects",
"author": "Ryan Inch",
"version": (1,1,2),
"version": (1,2,0),
"blender": (2, 80, 0),
"location": "View3D - Object Mode (Shortcut - M)",
"warning": '', # used for warning icon and text in addons panel
......@@ -79,7 +79,7 @@ def register():
bpy.utils.register_class(cls)
bpy.types.Scene.CMListCollection = CollectionProperty(type=internals.CMListCollection)
bpy.types.Scene.CMListIndex = IntProperty()
bpy.types.Scene.CMListIndex = IntProperty(update=ui.update_selection)
bpy.types.Scene.show_exclude = BoolProperty(default=True, name="Exclude from View Layer")
bpy.types.Scene.show_selectable = BoolProperty(default=True, name="Selectable")
......
......@@ -21,8 +21,7 @@ class ExpandAllOperator(bpy.types.Operator):
if laycol["ptr"].children:
expanded.append(laycol["name"])
# set selected row to the first row and update tree view
context.scene.CMListIndex = 0
# update tree view
update_property_group(context)
return {'FINISHED'}
......
......@@ -129,9 +129,21 @@ class CollectionManager(Operator):
self.view_layer = context.view_layer.name
# sync selection in ui list with active layer collection
active_laycol_name = context.view_layer.active_layer_collection.name
active_laycol_row_index = layer_collections[active_laycol_name]["row_index"]
context.scene.CMListIndex = active_laycol_row_index
return wm.invoke_popup(self, width=(400+(lvl*20)))
def update_selection(self, context):
selected_item = context.scene.CMListCollection[context.scene.CMListIndex]
layer_collection = layer_collections[selected_item.name]["ptr"]
context.view_layer.active_layer_collection = layer_collection
class CM_UL_items(UIList):
last_filter_value = ""
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment