From 29f9f04d928f21f8e0063bee0b22a77f12c05fce Mon Sep 17 00:00:00 2001 From: Andrej730 Date: Mon, 25 Nov 2024 16:45:30 +0500 Subject: [PATCH] Change profile object UI #5796 example - https://imgchest.com/p/qb4zwj6ad4j 1) moved profile object selection to the same row as the profile type selection, so it will more noticable that they're related 2) added object requirements in the description 3) filtered only mesh objects to appear in the dropdown --- src/bonsai/bonsai/bim/module/profile/prop.py | 8 +++++++- src/bonsai/bonsai/bim/module/profile/ui.py | 12 ++++++++---- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/src/bonsai/bonsai/bim/module/profile/prop.py b/src/bonsai/bonsai/bim/module/profile/prop.py index 222868e67c..391ddc75c5 100644 --- a/src/bonsai/bonsai/bim/module/profile/prop.py +++ b/src/bonsai/bonsai/bim/module/profile/prop.py @@ -73,7 +73,13 @@ class BIMProfileProperties(PropertyGroup): update=lambda self, context: bpy.ops.bim.load_profiles(), ) object_to_profile: PointerProperty( - name="Object to profile", type=bpy.types.Object, description="Object to copy the mesh to a profile" + name="Object to profile", + type=bpy.types.Object, + description=( + "Optional mesh object to use as a source for a new arbitrary profile.\n" + "Object must be a closed mesh and have at least 1 face" + ), + poll=lambda self, obj: obj.type == "MESH", ) diff --git a/src/bonsai/bonsai/bim/module/profile/ui.py b/src/bonsai/bonsai/bim/module/profile/ui.py index 410bf625b6..421ac3fc59 100644 --- a/src/bonsai/bonsai/bim/module/profile/ui.py +++ b/src/bonsai/bonsai/bim/module/profile/ui.py @@ -71,12 +71,16 @@ class BIM_PT_profiles(Panel): return row = self.layout.row(align=True) - row.prop(self.props, "profile_classes", text="") + if self.props.profile_classes == "IfcArbitraryClosedProfileDef": + split = row.split(factor=0.5, align=True) + row = split.row(align=True) + row.prop(self.props, "profile_classes", text="") + row = split.row(align=True) + row.prop(self.props, "object_to_profile", text="") + else: + row.prop(self.props, "profile_classes", text="") row.operator("bim.add_profile_def", text="", icon="ADD") row.operator("bim.duplicate_profile_def", icon="DUPLICATE", text="") - if self.props.profile_classes == "IfcArbitraryClosedProfileDef": - row = self.layout.row(align=True) - row.prop(self.props, "object_to_profile", text="Create From") self.layout.template_list( "BIM_UL_profiles",