I'm confused about how to declare a panel.

I've tried to write a simple panel but it doesn't work:

class TestPanel(bpy.types.Panel):
    bl_idname = "object.test"
    bl_label = "test"
    bl_space_type = 'VIEW_3D'
    bl_region_type = 'TOOLS'
    bl_context = 'sculptmode'
    bl_category = "test"

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

I would like which values can be used in bl_context


In you specific case, the bl_context you are looking for is sculpt_mode. There are many others including:

  • objectmode
  • mesh_edit
  • curve_edit
  • surface_edit
  • text_edit
  • armature_edit
  • mball_edit
  • lattice_edit
  • pose_mode
  • imagepaint
  • weightpaint
  • vertexpaint
  • particlemode
  • 2
    $\begingroup$ Handy list, the docs don't help much. . Is it worth noting what the equivalent Panel.poll(...) test would be, eg "objectmode" context.mode == 'OBJECT' $\endgroup$
    – batFINGER
    Jul 16 '18 at 15:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.