Hi there!
Is there any way to create dialogbox that waits for user input and AFTER the user clicked something the code execution continues taking the user decision in account?
I created a user input dialog but the code executes after the call
bpy.ops.sccore.scuimessagebox('INVOKE_DEFAULT', message = "Trying to publish")
print("Hello")
The opperator code looks like this:
class SCUIMessageBox(bpy.types.Operator):
bl_idname = "sccore.scuimessagebox"
bl_label = ""
message : bpy.props.StringProperty( name = "message",description = "message",default = '')
_buttons : bpy.props.EnumProperty(
items=[
('yes', 'Yes', 'yes', '', 0),
('no', 'No', 'no', '', 1),
('cancel', 'Cancel', 'cancel', '', 2),
],
default='no'
)
result : bpy.props.StringProperty( name = "result",description = "MessageBox result",default = '')
def execute(self, context):
self.result = self._buttons
print(self.result)
return {'FINISHED'}
def invoke(self, context, event):
return context.window_manager.invoke_props_dialog(self, width = 250)
def draw(self, context):
layout = self.layout
layout.label(text=self.message)
row = layout.row()
row.prop(self, '_buttons', expand=True)
It works fine except that the code after the opperator call executes till the end. I want to know if the user selected yes, no or cancel. Furthermore: is there any way to get the opperator result after the call anyway?
Thanks in advance!