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.
Blender Stack Exchange is a question and answer site for people who use Blender to create 3D graphics, animations, or games. It only takes a minute to sign up.Sign up to join this community
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")
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.