diff --git a/src/bonsai/bonsai/bim/prop.py b/src/bonsai/bonsai/bim/prop.py index 9d5505c6b2..c78d2e46af 100644 --- a/src/bonsai/bonsai/bim/prop.py +++ b/src/bonsai/bonsai/bim/prop.py @@ -370,19 +370,23 @@ class Attribute(PropertyGroup): def get_tab( self: "Union[BIMAreaProperties, BIMTabProperties]", context: bpy.types.Context ) -> list[tuple[str, str, str, str, int]]: - return [ - ("PROJECT", "Project Overview", "", bonsai.bim.icons["IFC"].icon_id, 0), - ("OBJECT", "Object Information", "", "FILE_3D", 1), - ("GEOMETRY", "Geometry and Materials", "", "MATERIAL", 2), - ("DRAWINGS", "Drawings and Documents", "", "DOCUMENTS", 3), - ("SERVICES", "Services and Systems", "", "NETWORK_DRIVE", 4), - ("STRUCTURE", "Structural Analysis", "", "EDITMODE_HLT", 5), - ("SCHEDULING", "Costing and Scheduling", "", "NLA", 6), - ("FM", "Facility Management", "", "PACKAGE", 7), - ("QUALITY", "Quality and Coordination", "", "COMMUNITY", 8), - None, - ("BLENDER", "Blender Properties", "", "BLENDER", 9), - ] + # Items are not very dynamic, but can't make them completely static + # because icons are not yet available during prop registration. + if not hasattr(get_tab, "enum_items"): + get_tab.enum_items = [ + ("PROJECT", "Project Overview", "", bonsai.bim.icons["IFC"].icon_id, 0), + ("OBJECT", "Object Information", "", "FILE_3D", 1), + ("GEOMETRY", "Geometry and Materials", "", "MATERIAL", 2), + ("DRAWINGS", "Drawings and Documents", "", "DOCUMENTS", 3), + ("SERVICES", "Services and Systems", "", "NETWORK_DRIVE", 4), + ("STRUCTURE", "Structural Analysis", "", "EDITMODE_HLT", 5), + ("SCHEDULING", "Costing and Scheduling", "", "NLA", 6), + ("FM", "Facility Management", "", "PACKAGE", 7), + ("QUALITY", "Quality and Coordination", "", "COMMUNITY", 8), + None, + ("BLENDER", "Blender Properties", "", "BLENDER", 9), + ] + return get_tab.enum_items class BIMAreaProperties(PropertyGroup):