From 24c4858570d683d948ad5af492e1aa463bf035eb Mon Sep 17 00:00:00 2001 From: Andrej730 Date: Mon, 8 Jul 2024 14:58:34 +0500 Subject: [PATCH] Profiles UI - support renaming profiles by double-click Example - https://imgur.com/a/05I5tSz --- src/blenderbim/blenderbim/bim/module/profile/prop.py | 7 ++++++- src/blenderbim/blenderbim/bim/module/profile/ui.py | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/blenderbim/blenderbim/bim/module/profile/prop.py b/src/blenderbim/blenderbim/bim/module/profile/prop.py index 2939173ffe..89f7ed401c 100644 --- a/src/blenderbim/blenderbim/bim/module/profile/prop.py +++ b/src/blenderbim/blenderbim/bim/module/profile/prop.py @@ -43,8 +43,13 @@ def get_profile_classes(self, context): return ProfileData.data["profile_classes"] +def update_profile_name(self: "Profile", context: bpy.types.Context) -> None: + profile = tool.Ifc.get().by_id(self.ifc_definition_id) + profile.ProfileName = self.name + + class Profile(PropertyGroup): - name: StringProperty(name="Name") + name: StringProperty(name="Name", update=update_profile_name) ifc_class: StringProperty(name="IFC Class") ifc_definition_id: IntProperty(name="IFC Definition ID") diff --git a/src/blenderbim/blenderbim/bim/module/profile/ui.py b/src/blenderbim/blenderbim/bim/module/profile/ui.py index f1bce17c83..9ce74affdb 100644 --- a/src/blenderbim/blenderbim/bim/module/profile/ui.py +++ b/src/blenderbim/blenderbim/bim/module/profile/ui.py @@ -110,7 +110,7 @@ class BIM_UL_profiles(UIList): props = context.scene.BIMProfileProperties if item: row = layout.row(align=True) - row.label(text=item.name or "Unnamed") + row.prop(item, "name", text="", emboss=False) row.label(text=item.ifc_class) if props.active_profile_id == item.ifc_definition_id: