From ac2e69bd665a7fe75855707a872e57caba5282d2 Mon Sep 17 00:00:00 2001 From: Gorgious56 Date: Tue, 14 Jan 2025 08:44:21 +0100 Subject: [PATCH] Don't close type manager when using the enum search feature while adding a new type Also reduce the attribute name a bit --- src/bonsai/bonsai/bim/helper.py | 4 ++-- src/bonsai/bonsai/bim/module/root/operator.py | 10 +++++----- src/bonsai/bonsai/bim/operator.py | 4 ++-- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/bonsai/bonsai/bim/helper.py b/src/bonsai/bonsai/bim/helper.py index 2eb7860671..b29e79f060 100644 --- a/src/bonsai/bonsai/bim/helper.py +++ b/src/bonsai/bonsai/bim/helper.py @@ -272,7 +272,7 @@ def prop_with_search( layout: bpy.types.UILayout, data: ENUM_ITEMS_DATA, prop_name: str, - should_click_ok_to_validate: bool = False, + should_click_ok: bool = False, original_operator_path: Optional[str] = None, **kwargs: Any, ): @@ -285,7 +285,7 @@ def prop_with_search( row.context_pointer_set(name="data", data=data) op = row.operator("bim.enum_property_search", text="", icon="VIEWZOOM") op.prop_name = prop_name - op.should_click_ok_to_validate = should_click_ok_to_validate + op.should_click_ok = should_click_ok op.original_operator_path = original_operator_path or "" except TypeError: # Prop is not iterable pass diff --git a/src/bonsai/bonsai/bim/module/root/operator.py b/src/bonsai/bonsai/bim/module/root/operator.py index b8f9f745f8..6213fcc4a7 100644 --- a/src/bonsai/bonsai/bim/module/root/operator.py +++ b/src/bonsai/bonsai/bim/module/root/operator.py @@ -556,15 +556,15 @@ class AddElement(bpy.types.Operator, tool.Ifc.Operator): props = context.scene.BIMRootProperties self.layout.use_property_split = True self.layout.use_property_decorate = False - prop_with_search(self.layout, props, "ifc_product", text="Definition") - prop_with_search(self.layout, props, "ifc_class", should_click_ok_to_validate=True) + prop_with_search(self.layout, props, "ifc_product", text="Definition", should_click_ok=True) + prop_with_search(self.layout, props, "ifc_class", should_click_ok=True) ifc_predefined_types = root_prop.get_ifc_predefined_types(context.scene.BIMRootProperties, context) if ifc_predefined_types: - prop_with_search(self.layout, props, "ifc_predefined_type") + prop_with_search(self.layout, props, "ifc_predefined_type", should_click_ok=True) if props.ifc_predefined_type == "USERDEFINED": row = self.layout.row() row.prop(props, "ifc_userdefined_type") - prop_with_search(self.layout, props, "representation_template", text="Representation") + prop_with_search(self.layout, props, "representation_template", text="Representation", should_click_ok=True) if props.representation_template == "OBJ": row = self.layout.row() row.prop(props, "representation_obj", text="Object") @@ -572,7 +572,7 @@ class AddElement(bpy.types.Operator, tool.Ifc.Operator): row = self.layout.row() row.prop(props, "profile", text="Profile") if props.representation_template != "EMPTY": - prop_with_search(self.layout, props, "contexts") + prop_with_search(self.layout, props, "contexts", should_click_ok=True) class LaunchAddElement(bpy.types.Operator, tool.Ifc.Operator): diff --git a/src/bonsai/bonsai/bim/operator.py b/src/bonsai/bonsai/bim/operator.py index 41eacbd5b0..e048b88015 100644 --- a/src/bonsai/bonsai/bim/operator.py +++ b/src/bonsai/bonsai/bim/operator.py @@ -868,7 +868,7 @@ def update_enum_property_search_prop(self, context): if self.first_launch: self.first_launch = False else: - if not self.should_click_ok_to_validate: + if not self.should_click_ok: context.window.screen = context.window.screen if predefined_type: try: @@ -889,7 +889,7 @@ class BIM_OT_enum_property_search(bpy.types.Operator): collection_identifiers: bpy.props.CollectionProperty(type=StrProperty) collection_predefined_types: bpy.props.CollectionProperty(type=StrProperty) prop_name: bpy.props.StringProperty() - should_click_ok_to_validate: bpy.props.BoolProperty(default=False) + should_click_ok: bpy.props.BoolProperty(default=False) original_operator_path: bpy.props.StringProperty(name="Original Operator Path", default="", options={"SKIP_SAVE"}) identifiers: list[str]