Fix regression in caeabe2 where actor data didn't load.

This commit is contained in:
Dion Moult
2025-02-07 16:58:45 +11:00
parent 9f75a14204
commit f09002c7e2
2 changed files with 14 additions and 15 deletions
+8 -9
View File
@@ -217,17 +217,16 @@ class ActorData:
@classmethod
def load(cls):
cls.data = {
"the_actor": cls.the_actor(),
"actors": cls.actors(),
"actor_class_enum": cls.actor_class_enum(),
"get_actor_type_enum": cls.get_actor_type_enum(),
}
cls.is_loaded = True
cls.data["actor_class"] = cls.actor_class()
cls.data["actor_type"] = cls.actor_type()
cls.data["the_actor"] = cls.the_actor()
cls.data["actors"] = cls.actors()
@classmethod
def the_actor(cls):
ifc_class = bpy.context.scene.BIMOwnerProperties.actor_type
if not (ifc_class := bpy.context.scene.BIMOwnerProperties.actor_type):
ifc_class = cls.actor_type()[0][0]
return [(str(p.id()), p[0] or "Unnamed", "") for p in tool.Ifc.get().by_type(ifc_class)]
@classmethod
@@ -249,7 +248,7 @@ class ActorData:
return actors
@classmethod
def actor_class_enum(cls) -> list[tuple[str, str, str]]:
def actor_class(cls) -> list[tuple[str, str, str]]:
version = tool.Ifc.get_schema()
return [
("IfcActor", "Actor", get_entity_doc(version, "IfcActor").get("description", "")),
@@ -257,7 +256,7 @@ class ActorData:
]
@classmethod
def get_actor_type_enum(cls) -> list[tuple[str, str, str]]:
def actor_type(cls) -> list[tuple[str, str, str]]:
version = tool.Ifc.get_schema()
return [
("IfcPerson", "Person", get_entity_doc(version, "IfcPerson").get("description", "")),
+6 -6
View File
@@ -65,16 +65,16 @@ def update_actor_class(self, context):
ActorData.data["actors"] = ActorData.actors()
def get_actor_class_enum(self, context):
def get_actor_class(self, context):
if not ActorData.is_loaded:
ActorData.load()
return ActorData.data["actor_class_enum"]
return ActorData.data["actor_class"]
def get_actor_type_enum(self, context):
def get_actor_type(self, context):
if not ActorData.is_loaded:
ActorData.load()
return ActorData.data["actor_type_enum"]
return ActorData.data["actor_type"]
class BIMOwnerProperties(PropertyGroup):
@@ -106,12 +106,12 @@ class BIMOwnerProperties(PropertyGroup):
active_actor_id: IntProperty(name="Active Actor Id")
actor_attributes: CollectionProperty(name="Actor Attributes", type=Attribute)
actor_class: EnumProperty(
items=get_actor_class_enum,
items=get_actor_class,
name="Actor Type",
update=update_actor_class,
)
actor_type: EnumProperty(
items=get_actor_type_enum,
items=get_actor_type,
name="Actor Type",
update=update_actor_type,
)