Add Setting popup in Render Top Bar Menu

I want add this DialogOperator

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)

        prepareTransit()

        filepathOfOpenFile = bpy.data.filepath

        print(filepathOfOpenFile)


        return {'FINISHED'}

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

as a new menu option/button in the Render Top Bar. I’ve unsuccessfully attempted to implement this feature with

import bpy

class my_settings(bpy.types.PropertyGroup):

    my_bool: bpy.props.BoolProperty(
        name='Settings',
        default=True
    )



def draw(self, context):
    layout = self.layout
    rn_tool = context.scene.my_tool

    row = layout.row()
    row.prop(my_tool, "my_bool")


def register():
    bpy.types.TOPBAR_MT_render.append(draw)
    bpy.utils.register_class(my_settings)
    bpy.types.Scene.my_tool = bpy.props.PointerProperty(type=my_settings)


def unregister():
    bpy.types.TOPBAR_MT_render.remove(draw)
    bpy.utils.unregister_class(my_settings)
    del bpy.types.Scene.my_tool


if __name__ == '__main__':
    register()

its the code of a similar project described on this website


thanks for your assistance

See if this is what your wanting.

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)

        prepareTransit()

        filepathOfOpenFile = bpy.data.filepath

        print(filepathOfOpenFile)


        return {'FINISHED'}

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

    
def draw(self, context):
    self.layout.operator("object.dialog_operator")

        
def register():
    bpy.types.TOPBAR_MT_render.append(draw)
    bpy.utils.register_class(DialogOperator)


def unregister():
    bpy.types.TOPBAR_MT_render.remove(draw)
    bpy.utils.unregister_class(DialogOperator)


if __name__ == '__main__':
    register()
1 Like