From 6c9e863546fc05f8875926840f886f394334437d Mon Sep 17 00:00:00 2001 From: Petru Conduraru Date: Mon, 13 Jul 2026 06:33:43 +0300 Subject: [PATCH] Fix ci-bonsai-daily: ProjectLibraryData duplicate parent-library enum parent_libraries_enum() adds an explicit entry for get_root_context(), then loops over cls.data["project_libraries"] (all IfcProjectLibrary entities) and appends each. For a library-only file (no IfcProject), get_root_context falls back to the top-level IfcProjectLibrary itself, so the root is appended twice with the same enum key (its STEP id), which Blender EnumProperty requires to be unique -> the data load asserts. Normal project files are unaffected (root is an IfcProject whose id never collides with a library id). Skip library_id == root.id() in the loop (dedup by id, the colliding key). Verified in headless Blender: test_project_library_data.py::TestLibraryOnlyFile goes from 1 failed / 5 passed to 6 passed. This change was made with the assistance of an AI tool. Co-Authored-By: Claude Fable 5 --- src/bonsai/bonsai/bim/module/project/data.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/bonsai/bonsai/bim/module/project/data.py b/src/bonsai/bonsai/bim/module/project/data.py index db64041a89..6f94947013 100644 --- a/src/bonsai/bonsai/bim/module/project/data.py +++ b/src/bonsai/bonsai/bim/module/project/data.py @@ -165,6 +165,12 @@ class ProjectLibraryData: root = tool.Project.get_root_context(library_file) results.append((str(root.id()), f"{root.is_a()} {root.Name or 'Unnamed'}", root.Description or "")) for library_id, data in cls.data["project_libraries"].items(): + # Library-only files have an IfcProjectLibrary as their root context, and + # project_libraries() collects every IfcProjectLibrary in the file (root + # included). Skip it here since it was already added above, otherwise the + # root library is listed twice with colliding enum keys. + if library_id == root.id(): + continue results.append((str(library_id), data["Name"] or "Unnamed", data["Description"] or "")) return results