diff --git a/src/blenderbim/blenderbim/bim/module/owner/data.py b/src/blenderbim/blenderbim/bim/module/owner/data.py index 3eae8fc574..972da087da 100644 --- a/src/blenderbim/blenderbim/bim/module/owner/data.py +++ b/src/blenderbim/blenderbim/bim/module/owner/data.py @@ -93,15 +93,17 @@ class PeopleData(RolesAddressesData): def get_people(cls): people = [] for person in tool.Ifc.get().by_type("IfcPerson"): + roles = cls.get_roles(person) people.append( { "id": person.id(), "props": bpy.context.scene.BIMOwnerProperties.person_attributes, "name": cls.get_person_name(person), + "roles_label": ", ".join([r["label"] for r in roles]), "is_editing": cls.get_person_is_editing(person), "is_engaged": bool(person.EngagedIn), "list_attributes": cls.get_person_list_attributes(person), - "roles": cls.get_roles(person), + "roles": roles, "addresses": cls.get_addresses(person), } ) @@ -151,14 +153,16 @@ class OrganisationsData(RolesAddressesData): def get_organisations(cls): organisations = [] for organisation in tool.Ifc.get().by_type("IfcOrganization"): + roles = cls.get_roles(organisation) organisations.append( { "id": organisation.id(), "props": bpy.context.scene.BIMOwnerProperties.organisation_attributes, "name": organisation.Name, + "roles_label": ", ".join([r["label"] for r in roles]), "is_editing": bpy.context.scene.BIMOwnerProperties.active_organisation_id == organisation.id(), "is_engaged": bool(organisation.Engages), - "roles": cls.get_roles(organisation), + "roles": roles, "addresses": cls.get_addresses(organisation), } ) @@ -212,13 +216,13 @@ class ActorData: @classmethod def load(cls): cls.data = { - "actor": cls.actor(), + "the_actor": cls.the_actor(), "actors": cls.actors(), } cls.is_loaded = True @classmethod - def actor(cls): + def the_actor(cls): ifc_class = bpy.context.scene.BIMOwnerProperties.actor_type return [(str(p.id()), p[0] or "Unnamed", "") for p in tool.Ifc.get().by_type(ifc_class)] @@ -228,5 +232,14 @@ class ActorData: props = bpy.context.scene.BIMOwnerProperties for actor in tool.Ifc.get().by_type(props.actor_class, include_subtypes=False): is_editing = props.active_actor_id == actor.id() - actors.append({"id": actor.id(), "name": actor.Name or "Unnamed", "is_editing": is_editing}) + if actor.TheActor.is_a("IfcPerson"): + the_actor = actor.TheActor.Identification or "N/A" + elif actor.TheActor.is_a("IfcOrganization"): + the_actor = actor.TheActor.Identification or "N/A" + elif actor.TheActor.is_a("IfcPersonAndOrganization"): + the_actor = actor.TheActor.ThePerson.Identification or "N/A" + the_actor += "-" + actor.TheActor.TheOrganization.Identification or "N/A" + actors.append( + {"id": actor.id(), "name": actor.Name or "Unnamed", "the_actor": the_actor, "is_editing": is_editing} + ) return actors diff --git a/src/blenderbim/blenderbim/bim/module/owner/operator.py b/src/blenderbim/blenderbim/bim/module/owner/operator.py index d678369ac2..48935f91d3 100644 --- a/src/blenderbim/blenderbim/bim/module/owner/operator.py +++ b/src/blenderbim/blenderbim/bim/module/owner/operator.py @@ -315,8 +315,8 @@ class AddActor(bpy.types.Operator, Operator): def _execute(self, context): props = bpy.context.scene.BIMOwnerProperties - if props.actor: - core.add_actor(tool.Ifc, ifc_class=props.actor_class, actor=tool.Ifc.get().by_id(int(props.actor))) + if props.the_actor: + core.add_actor(tool.Ifc, ifc_class=props.actor_class, actor=tool.Ifc.get().by_id(int(props.the_actor))) class EnableEditingActor(bpy.types.Operator, Operator): diff --git a/src/blenderbim/blenderbim/bim/module/owner/prop.py b/src/blenderbim/blenderbim/bim/module/owner/prop.py index 49759be4bc..57e1095c8b 100644 --- a/src/blenderbim/blenderbim/bim/module/owner/prop.py +++ b/src/blenderbim/blenderbim/bim/module/owner/prop.py @@ -44,14 +44,14 @@ def get_user_organisation(self, context): return OwnerData.data["user_organisation"] -def get_actor(self, context): +def get_the_actor(self, context): if not ActorData.is_loaded: ActorData.load() - return ActorData.data["actor"] + return ActorData.data["the_actor"] def update_actor_type(self, context): - ActorData.data["actor"] = ActorData.actor() + ActorData.data["the_actor"] = ActorData.the_actor() def update_actor_class(self, context): @@ -94,4 +94,4 @@ class BIMOwnerProperties(PropertyGroup): name="Actor Type", update=update_actor_type, ) - actor: EnumProperty(items=get_actor, name="Actor") + the_actor: EnumProperty(items=get_the_actor, name="Actor") diff --git a/src/blenderbim/blenderbim/bim/module/owner/ui.py b/src/blenderbim/blenderbim/bim/module/owner/ui.py index e3902775c8..09865648b0 100644 --- a/src/blenderbim/blenderbim/bim/module/owner/ui.py +++ b/src/blenderbim/blenderbim/bim/module/owner/ui.py @@ -127,7 +127,9 @@ class BIM_PT_people(bpy.types.Panel): draw_addresses(box, person) else: row = self.layout.row(align=True) - row.label(text=person["name"]) + row.label(text=person["name"], icon="OUTLINER_OB_ARMATURE") + if person["roles_label"]: + row.label(text=person["roles_label"]) row.operator("bim.enable_editing_person", icon="GREASEPENCIL", text="").person = person["id"] if not person["is_engaged"]: row.operator("bim.remove_person", icon="X", text="").person = person["id"] @@ -171,7 +173,9 @@ class BIM_PT_organisations(bpy.types.Panel): draw_addresses(box, organisation) else: row = self.layout.row(align=True) - row.label(text=organisation["name"]) + row.label(text=organisation["name"], icon="COMMUNITY") + if organisation["roles_label"]: + row.label(text=organisation["roles_label"]) op = row.operator("bim.enable_editing_organisation", icon="GREASEPENCIL", text="") op.organisation = organisation["id"] if not organisation["is_engaged"]: @@ -254,9 +258,9 @@ class BIM_PT_actor(bpy.types.Panel): row = self.layout.row(align=True) row.prop(self.props, "actor_class", text="") row.prop(self.props, "actor_type", text="") - if ActorData.data["actor"]: + if ActorData.data["the_actor"]: row = self.layout.row(align=True) - row.prop(self.props, "actor", text="") + row.prop(self.props, "the_actor", text="") row.operator("bim.add_actor", icon="ADD", text="") else: self.layout.label(text="No users found.") @@ -273,6 +277,7 @@ class BIM_PT_actor(bpy.types.Panel): blenderbim.bim.helper.draw_attributes(self.props.actor_attributes, box) else: row = self.layout.row(align=True) - row.label(text=actor["name"]) + row.label(text=actor["name"], icon="USER") + row.label(text=actor["the_actor"]) row.operator("bim.enable_editing_actor", icon="GREASEPENCIL", text="").actor = actor["id"] row.operator("bim.remove_actor", icon="X", text="").actor = actor["id"]