Editing the menu bars without using the python API


So long story short, I’m trying to edit the user interface of blender 2.8. When I say edit the user interface, I’m mainly talking about the (File, Edit, Render, Window, Help) tabs. I’ve tried many things, but I just can’t seem to place my custom items in there. Deleting goes without a problem, but adding is a pain.

Are there any directions on how to accomplish this? Documentation? I’ve tried debugging and seeing what happens, compared it to my own operation and it pretty much runs in paralel, the thing is that my item just doesn’t show. Perhaps there’s something stopping it from doing so? Perhaps my item id doesn’t match some list defined elsewhere with id’s that DO get shown in said menus? Is something defined somewhere which limits items from showing? Number limitation? So many questions, zero answers as of now.

Thank you for reading!

(AFWS) #2

Not sure if I follow you. You say you don’t want to use the python API ,but yet you are trying to add something to the existing menus?

See if this helps any. This adds a operator to those menus.

import bpy

# Here's the classes for File, Edit, Render, Window, Help

#  TOPBAR_MT_file
#  TOPBAR_MT_edit
#  TOPBAR_MT_render
#  TOPBAR_MT_window
#  TOPBAR_MT_help

def menu_func(self, context):

def register():

    # Here we use the TOPBAR_MT_file class to append the add cube operator to File menu.

def unregister():


if __name__ == "__main__":

This would be adding a menu.

import bpy

class CustomMenu(bpy.types.Menu):
    bl_label = "Custom Menu"
    bl_idname = "OBJECT_MT_custom_menu"

    def draw(self, context):
        layout = self.layout

        layout.operator("wm.save_as_mainfile").copy = True

def draw_item(self, context):
    layout = self.layout

def register():

    # lets add ourselves to the main header

def unregister():


if __name__ == "__main__":


Isn’t it possible to do this by editing the actual source code?

(AFWS) #4

Right click, Edit Source, and select space_topbar.py file in text editor.


Not sure if we’re on the same page here. When I say " The actual source code ", I mean the actual source code, the .c files. Hence the question, is it not possible to do the same thing, but by editing the .c files? I’m trying to learn the actual source code of Blender, I don’t want to script using the python api, aren’t the functions from the api translated from other c functions? Perhaps I should start there?

(AFWS) #6

I think we are in a completely different book.


Hahaha, I think so too. Thank you for trying to help me out though, much appreciated.