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
+5 -1
View File
@@ -370,7 +370,10 @@ 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
# 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), ("PROJECT", "Project Overview", "", bonsai.bim.icons["IFC"].icon_id, 0),
("OBJECT", "Object Information", "", "FILE_3D", 1), ("OBJECT", "Object Information", "", "FILE_3D", 1),
("GEOMETRY", "Geometry and Materials", "", "MATERIAL", 2), ("GEOMETRY", "Geometry and Materials", "", "MATERIAL", 2),
@@ -383,6 +386,7 @@ def get_tab(
None, None,
("BLENDER", "Blender Properties", "", "BLENDER", 9), ("BLENDER", "Blender Properties", "", "BLENDER", 9),
] ]
return get_tab.enum_items
class BIMAreaProperties(PropertyGroup): class BIMAreaProperties(PropertyGroup):