Unfortunately, the developers have not yet provided access to the Quick Favorites menu via the Python API in Blender. However, it is possible to transfer the entire menu to the user panel. We can simply draw the Quick Favorites content on the user panel layout.
First, let’s add a few operators to Quick Favorites, if you haven’t done so before.
The easiest way to add any operator to Quick Favorites is to right-click on the desired button in the Blender interface or on the desired menu item, and select “Add to Quick Favorites”. Now, when we press the “q” key, a new item with a call of this operator will appear in the pop-up menu.
Now, define the user panel class.
1 2 3 4 5 6 7 8 9 |
class TEST_PT_panel(bpy.types.Panel): bl_idname = 'TEST_PT_panel' bl_label = 'TEST' bl_space_type = 'VIEW_3D' bl_region_type = 'UI' bl_category = 'TEST' def draw(self, context): # UI |
Our panel interface will be drawn inside the “draw” function.
We will place the UI output from the Quick Favorites pop-up panel here by calling the “menu_contents()” function, in the parameter of which we will pass the identifier of this menu – “SCREEN_MT_user_menu”.
Our “draw” function will look like this:
1 2 |
def draw(self, context): self.layout.menu_contents('SCREEN_MT_user_menu') |
Register our panel class in the Blender Python API.
1 |
bpy.utils.register_class(TEST_PT_panel) |
Now we can execute the code and verify that all operations from the Quick Favorites menu are displayed as buttons on our custom panel.