From 6c511f6b1b43998981f972477c6000317dbf47a9 Mon Sep 17 00:00:00 2001 From: Andrej730 Date: Wed, 19 Feb 2025 17:26:34 +0500 Subject: [PATCH] Project library UI - fix missing elements added to parent libraries Previously if there was library A and it had sublibrary B and then some element were directly assigned to library A, UI still wouldn't show this element and would show only elements assigned to the B, the last library in the hierarchy --- src/bonsai/bonsai/bim/module/project/operator.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/bonsai/bonsai/bim/module/project/operator.py b/src/bonsai/bonsai/bim/module/project/operator.py index 9e40f982fb..8510a7d125 100644 --- a/src/bonsai/bonsai/bim/module/project/operator.py +++ b/src/bonsai/bonsai/bim/module/project/operator.py @@ -304,13 +304,14 @@ class ChangeLibraryElement(bpy.types.Operator): if self.breadcrumb_type == "LIBRARY": hierarchy = tool.Project.get_project_hierarchy(library_file) assert active_project_library is not None - if active_project_library == "NO_LIBRARY" or not hierarchy[active_project_library]: - for appendable_type in sorted(tool.Project.get_appendable_asset_types()): - elements = library_file.by_type(appendable_type) - if elements := filter_elements(elements): - self.props.add_library_asset_class(appendable_type, len(elements)) - else: + if active_project_library != "NO_LIBRARY" and hierarchy[active_project_library]: tool.Project.load_project_libraries_to_ui(active_project_library, hierarchy) + + for appendable_type in sorted(tool.Project.get_appendable_asset_types()): + elements = library_file.by_type(appendable_type) + if elements := filter_elements(elements): + self.props.add_library_asset_class(appendable_type, len(elements)) + else: # breadcrumb_type CLASS. elements = self.library_file.by_type(self.element_name) elements = list(filter_elements(elements))