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

2 Comment
Newest
Oldest Most Voted
Inline Feedbacks
View all comments
Slyedoc
Slyedoc
3 months ago

Updated list for 4.2 if anyone runs into this:

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