System Information
Operating system: Windows-10-10.0.19045-SP0 64 Bits
Graphics card: NVIDIA GeForce RTX 2080 Ti/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 516.94
Blender Version
Broken: version: 3.4.0 Alpha, branch: master, commit date: 2022-10-28 14:24, hash: rBf9113b7eb6ee
Worked: /
Short description of error
In a situation where the prop_search is used within an operator custom draw function:
If the user presses the 'X' cross displayed inside the prop_search, supposed to clear the text content of the prop_search text field, the active operator redo panel will be closed.
I imagine, a possible reason for that issue is that the bpy.ops.ui.button_string_clear is itself registrered to allow Undo, causing the active operator to change and therefor the redo panel of the original operator to be closed.
It would be great if this could be avoided when the prop_search is used within an operator's custom draw function. (After all manually deleting the text from the prop_search does not cause that issue.)
Exact steps for others to reproduce the error
- From the default startup, run the following script:
import bpy
def update_field(self,context):
print(f"Value changed to: {self.ui_object_search_field}")
class BUGREPORT_OT_BUTTON_SRTING_CLEAR(bpy.types.Operator):
bl_idname = "object.bugreport_button_string_clear"
bl_label = "BugReport button_string_clear"
bl_options = { 'REGISTER', 'UNDO'}
ui_object_search_field:bpy.props.StringProperty(default="", name='Example', update=update_field)
def execute(self, context):
print(f"execution with param={self.ui_object_search_field}")
return {'FINISHED'}
def draw(self,context):
self.layout.prop_search(self, "ui_object_search_field", bpy.context.scene, "objects", results_are_suggestions=True)
def register():
bpy.utils.register_class(BUGREPORT_OT_BUTTON_SRTING_CLEAR)
def unregister():
bpy.utils.unregister_class(BUGREPORT_OT_BUTTON_SRTING_CLEAR)
register()- Make sure to have at least one object in the scene (Will be listed in the prop_search)
- Select an object
- Press F3, type "bugreport_", in the list select the operator object.bugreport_button_string_clear
- If needed, expand the Redo panel that could be collapsed in the bottom right part of the viewport.
- Click on the prop_search, and in the list of objects that should appear, pick an object from the scene.
- Now, click the little 'x' in the prop_search, expecting to just have the text cleared
- Notice that instead of having the text cleared, the entire redo panel you were interacting with is now gone