5
$\begingroup$

I am making an updater for blender and I want add "Update Blender" entry to the Help menu. How I do that ?

I know about the menu template , I know how to make the menu, my question is how I inject it to the bottom of the Help menu.

$\endgroup$

1 Answer 1

3
$\begingroup$

You need to make a custom menu drawing function, accepting two arguments: the parent Menu object and context access object.

def draw_help_item(self, context):
    self.layout.operator('wm.new_help_item', text = "New Help Item")

Then either append or prepend the function to the menu's class upon registering the new class, and remove it when unregistering:

def register():
    bpy.types.INFO_MT_add.append(draw_help_item)
    bpy.utils.register_module(__name__)

def unregister():
    bpy.types.INFO_MT_add.remove(draw_help_item)
    bpy.utils.unregister_module(__name__)

The appropriate class' name, in this case bpy.types.INFO_MT_add, can be searched in Python shell assisted by autocompletion. It's usually prefixed with the area type, then either _MT for menu or _HT for header, and is fairly easy to deduce which UI element it corresponds with.

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .