Blender add-on: dialog box closes when I click outside

Viewed 327

I'm new in blender addon development and trying to create a popup dialog box that doesn't close when I click outside the box, It should only close when I click on the close button.

please let me know I you know of any solution.

Here is the sample code of the dialog box

import bpy


class DialogOperator(bpy.types.Operator):
    bl_idname = "object.dialog_operator"
    bl_label = "Simple Dialog Operator"

    my_float: bpy.props.FloatProperty(name="Some Floating Point")
    my_bool: bpy.props.BoolProperty(name="Toggle Option")
    my_string: bpy.props.StringProperty(name="String Value")

    def execute(self, context):
        message = (
            "Popup Values: %f, %d, '%s'" %
            (self.my_float, self.my_bool, self.my_string)
        )
        self.report({'INFO'}, message)
        return {'FINISHED'}

    def invoke(self, context, event):
        wm = context.window_manager
        return wm.invoke_props_dialog(self)


bpy.utils.register_class(DialogOperator)

bpy.ops.object.dialog_operator('INVOKE_DEFAULT')
0 Answers
Related