Store enum items strings references to be safe #5673

This commit is contained in:
Andrej730
2024-11-01 12:44:05 +05:00
parent 33b7c0a76f
commit f3019e4d7a
+17 -13
View File
@@ -370,19 +370,23 @@ class Attribute(PropertyGroup):
def get_tab( def get_tab(
self: "Union[BIMAreaProperties, BIMTabProperties]", context: bpy.types.Context self: "Union[BIMAreaProperties, BIMTabProperties]", context: bpy.types.Context
) -> list[tuple[str, str, str, str, int]]: ) -> list[tuple[str, str, str, str, int]]:
return [ # Items are not very dynamic, but can't make them completely static
("PROJECT", "Project Overview", "", bonsai.bim.icons["IFC"].icon_id, 0), # because icons are not yet available during prop registration.
("OBJECT", "Object Information", "", "FILE_3D", 1), if not hasattr(get_tab, "enum_items"):
("GEOMETRY", "Geometry and Materials", "", "MATERIAL", 2), get_tab.enum_items = [
("DRAWINGS", "Drawings and Documents", "", "DOCUMENTS", 3), ("PROJECT", "Project Overview", "", bonsai.bim.icons["IFC"].icon_id, 0),
("SERVICES", "Services and Systems", "", "NETWORK_DRIVE", 4), ("OBJECT", "Object Information", "", "FILE_3D", 1),
("STRUCTURE", "Structural Analysis", "", "EDITMODE_HLT", 5), ("GEOMETRY", "Geometry and Materials", "", "MATERIAL", 2),
("SCHEDULING", "Costing and Scheduling", "", "NLA", 6), ("DRAWINGS", "Drawings and Documents", "", "DOCUMENTS", 3),
("FM", "Facility Management", "", "PACKAGE", 7), ("SERVICES", "Services and Systems", "", "NETWORK_DRIVE", 4),
("QUALITY", "Quality and Coordination", "", "COMMUNITY", 8), ("STRUCTURE", "Structural Analysis", "", "EDITMODE_HLT", 5),
None, ("SCHEDULING", "Costing and Scheduling", "", "NLA", 6),
("BLENDER", "Blender Properties", "", "BLENDER", 9), ("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): class BIMAreaProperties(PropertyGroup):