I am developing an addon and often right click on existing ui elements and select "Edit Source" to learn how certain ui elements were made. Almost every ui element inherits from bpy.types.Panel as expected and as I thought was necessary to make a ui panel.
I'm trying to make a similar panel to the Grease Pencil panel, and upon inspecting it's source, the panel's class is not inheriting from anything:
class GreasePencilDataPanel: # subclass must set # bl_space_type = 'IMAGE_EDITOR' bl_label = "Grease Pencil Layers" bl_region_type = 'UI' @staticmethod def draw_header(self, context): self.layout.prop(context.space_data, "show_grease_pencil", text="") @staticmethod def draw(self, context): layout = self.layout # Rest of class ...
Yet somehow it's still accessing attributes such as draw() and layout, which I thought were inherited attributes from bpy.types.Panel.
I've attempted to figure out why this works by making changes in the code, rerunning it, and seeing what changes occur in Blender. Strangely, no changes would take place when I made changes to the python code, unlike most python source code, which will reflect changes right away.
Why does this class not inherit from bpy.types.Panel, and what advantages/disadvantages does this bring?