From 4e1daea838d67431130ade36fa70ee55855c2ccc Mon Sep 17 00:00:00 2001 From: Gorgious56 Date: Mon, 30 Oct 2023 14:19:01 +0100 Subject: [PATCH] Clicking on an entry in the search field popup automatically validates and closes the popup No need to click on "OK" anymore. This is not a hacky workaround using the mouse position, it uses a signal sent to Blender to close the active popup See https://blenderartists.org/t/programatically-close-pie-menu-2-79/1488807/2 re-committing since it seems I commited to the wrong branch last week --- src/blenderbim/blenderbim/bim/operator.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/blenderbim/blenderbim/bim/operator.py b/src/blenderbim/blenderbim/bim/operator.py index e65ad34b49..8937205a9a 100644 --- a/src/blenderbim/blenderbim/bim/operator.py +++ b/src/blenderbim/blenderbim/bim/operator.py @@ -816,6 +816,10 @@ def update_enum_property_search_prop(self, context): if prop.name == self.dummy_name: setattr(context.data, self.prop_name, self.collection_identifiers[i].name) predefined_type = self.collection_predefined_types[i].name + if self.first_launch: + self.first_launch = False + else: + context.window.screen = context.window.screen if predefined_type: try: setattr(context.data, "ifc_predefined_type", predefined_type) @@ -828,6 +832,7 @@ class BIM_OT_enum_property_search(bpy.types.Operator): bl_idname = "bim.enum_property_search" bl_label = "Search For Property" bl_options = {"REGISTER", "UNDO"} + first_launch: bpy.props.BoolProperty(default=True, options={"SKIP_SAVE"}) dummy_name: bpy.props.StringProperty(name="Property", update=update_enum_property_search_prop) collection_names: bpy.props.CollectionProperty(type=StrProperty) collection_identifiers: bpy.props.CollectionProperty(type=StrProperty)