Fix #5333 : Searching for the class name using the looking glass button doesn't close the type manager anymore.

This commit is contained in:
Gorgious56
2024-09-20 09:53:00 +02:00
parent 4f64d044ac
commit a8abc8e379
2 changed files with 5 additions and 2 deletions
+2 -1
View File
@@ -199,7 +199,7 @@ def export_attributes(props, callback: Optional[Callable] = None) -> dict[str, A
return attributes
def prop_with_search(layout, data, prop_name, **kwargs):
def prop_with_search(layout, data, prop_name, should_click_ok_to_validate=False, **kwargs):
# kwargs are layout.prop arguments (text, icon, etc.)
row = layout.row(align=True)
row.prop(data, prop_name, **kwargs)
@@ -209,6 +209,7 @@ def prop_with_search(layout, data, prop_name, **kwargs):
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
except TypeError: # Prop is not iterable
pass
+3 -1
View File
@@ -868,7 +868,8 @@ def update_enum_property_search_prop(self, context):
if self.first_launch:
self.first_launch = False
else:
context.window.screen = context.window.screen
if not self.should_click_ok_to_validate:
context.window.screen = context.window.screen
if predefined_type:
try:
setattr(context.data, "ifc_predefined_type", predefined_type)
@@ -888,6 +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)
def invoke(self, context, event):
self.clear_collections()