mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-01 09:26:26 +00:00
Fix regression in caeabe2 where actor data didn't load.
This commit is contained in:
@@ -217,17 +217,16 @@ class ActorData:
|
|||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def load(cls):
|
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.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
|
@classmethod
|
||||||
def the_actor(cls):
|
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)]
|
return [(str(p.id()), p[0] or "Unnamed", "") for p in tool.Ifc.get().by_type(ifc_class)]
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
@@ -249,7 +248,7 @@ class ActorData:
|
|||||||
return actors
|
return actors
|
||||||
|
|
||||||
@classmethod
|
@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()
|
version = tool.Ifc.get_schema()
|
||||||
return [
|
return [
|
||||||
("IfcActor", "Actor", get_entity_doc(version, "IfcActor").get("description", "")),
|
("IfcActor", "Actor", get_entity_doc(version, "IfcActor").get("description", "")),
|
||||||
@@ -257,7 +256,7 @@ class ActorData:
|
|||||||
]
|
]
|
||||||
|
|
||||||
@classmethod
|
@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()
|
version = tool.Ifc.get_schema()
|
||||||
return [
|
return [
|
||||||
("IfcPerson", "Person", get_entity_doc(version, "IfcPerson").get("description", "")),
|
("IfcPerson", "Person", get_entity_doc(version, "IfcPerson").get("description", "")),
|
||||||
|
|||||||
@@ -65,16 +65,16 @@ def update_actor_class(self, context):
|
|||||||
ActorData.data["actors"] = ActorData.actors()
|
ActorData.data["actors"] = ActorData.actors()
|
||||||
|
|
||||||
|
|
||||||
def get_actor_class_enum(self, context):
|
def get_actor_class(self, context):
|
||||||
if not ActorData.is_loaded:
|
if not ActorData.is_loaded:
|
||||||
ActorData.load()
|
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:
|
if not ActorData.is_loaded:
|
||||||
ActorData.load()
|
ActorData.load()
|
||||||
return ActorData.data["actor_type_enum"]
|
return ActorData.data["actor_type"]
|
||||||
|
|
||||||
|
|
||||||
class BIMOwnerProperties(PropertyGroup):
|
class BIMOwnerProperties(PropertyGroup):
|
||||||
@@ -106,12 +106,12 @@ class BIMOwnerProperties(PropertyGroup):
|
|||||||
active_actor_id: IntProperty(name="Active Actor Id")
|
active_actor_id: IntProperty(name="Active Actor Id")
|
||||||
actor_attributes: CollectionProperty(name="Actor Attributes", type=Attribute)
|
actor_attributes: CollectionProperty(name="Actor Attributes", type=Attribute)
|
||||||
actor_class: EnumProperty(
|
actor_class: EnumProperty(
|
||||||
items=get_actor_class_enum,
|
items=get_actor_class,
|
||||||
name="Actor Type",
|
name="Actor Type",
|
||||||
update=update_actor_class,
|
update=update_actor_class,
|
||||||
)
|
)
|
||||||
actor_type: EnumProperty(
|
actor_type: EnumProperty(
|
||||||
items=get_actor_type_enum,
|
items=get_actor_type,
|
||||||
name="Actor Type",
|
name="Actor Type",
|
||||||
update=update_actor_type,
|
update=update_actor_type,
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user