All possible values for the bl_context parameter in UI panel classes

The bl_context parameter is used for placing custom UI panels on the desired tab in the Properties area. The value specified in this parameter is responsible for which tab the user panel will be placed on.

For example, to place a user-defined UI panel on the “Render Properties” tab, the bl_context parameter in the panel definition should be set to “render”.

To get the desired values for each tab, we can right-click on any field already placed in it, select the “Edit Source” row from the pop-up menu, scroll up the opened code to the class definition and just look at the desired value.

We can also get all possible values for the bl_context parameter by looping through the definitions of all the panels used in the Blender API.

To start, let’s get all the classes that are inherited from the UI panel type – bpy.types.Panel, from the list of all Blender API types – bpy.types.

Define a generator function that will allow us to loop through all panel classes:

The __mro__ tuple gives us access to all classes that the current class inherits from. By checking if the bpy.types.Panel class exists in it, we filter out only those bpy.types classes that are responsible for the Blender interface panels.

Having received a list of the required classes, we just have to loop through them and get the value of the bl_context property:

Or, to have only unique values, we can take a set:

Full list of all possible values for Blender 3.5:

{‘modifier’, ‘input’, ‘.sculpt_mode’, ‘.particlemode’, ‘shaderfx’, ‘particle’, ‘keymap’, ‘.mesh_edit’, ‘bone’, ‘experimental’, ‘.greasepencil_weight’, ‘render’, ‘.weightpaint’, ‘.imagepaint’, ‘editing’, ‘viewport’, ‘lights’, ‘.greasepencil_sculpt’, ‘collection’, ‘navigation’, ‘.uv_sculpt’, ‘physics’, ‘output’, ‘.paint_common_2d’, ‘addons’, ‘.greasepencil_vertex’, ‘bone_constraint’, ‘.armature_edit’, ‘data’, ‘.posemode’, ‘.objectmode’, ‘texture’, ‘scene’, ‘file_paths’, ‘.greasepencil_paint’, ‘animation’, ‘.vertexpaint’, ‘view_layer’, ‘object’, ‘interface’, ‘save_load’, ‘system’, ‘themes’, ‘.imagepaint_2d’, ‘world’, ‘constraint’, ‘.paint_common’, ‘.curves_sculpt’, ‘material’}

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comment
Inline Feedbacks
View all comments