2
$\begingroup$

I'm creating an add-on with a custom object. When I select the object, I'd like to be able to edit some custom properties of the object with a small panel. I'd prefer to put it in the object properties menu, here:

enter image description here

How do I go about creating and adding a panel here?

$\endgroup$
1
$\begingroup$

To create a custom panel you subclass bpy.types.Panel and set the space, region and context to suit. Setting the space and region to PROPERTIES and WINDOW will place the panel within the properties. Without a context it will show in every section, object will place it only in the object properties.

class testPanel(bpy.types.Panel):
    bl_label = "Test Panel"
    bl_idname = "OBJECT_PT_tester"
    bl_space_type = 'PROPERTIES'
    bl_region_type = 'WINDOW'
    bl_context = 'object'

    def draw(self, context):
        row = self.layout.row()
        row.label(text='stuff here')
$\endgroup$

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.