Cleanup: API docs
[blender.git] / doc / python_api / examples / bpy.types.Panel.2.py
1 """
2 Mix-in Classes
3 ++++++++++++++
4 A mix-in parent class can be used to share common properties and
5 :class:`Menu.poll` function.
6 """
7 import bpy
8
9
10 class View3DPanel:
11     bl_space_type = 'VIEW_3D'
12     bl_region_type = 'TOOLS'
13
14     @classmethod
15     def poll(cls, context):
16         return (context.object is not None)
17
18
19 class PanelOne(View3DPanel, bpy.types.Panel):
20     bl_idname = "VIEW3D_PT_test_1"
21     bl_label = "Panel One"
22
23     def draw(self, context):
24         self.layout.label("Small Class")
25
26
27 class PanelTwo(View3DPanel, bpy.types.Panel):
28     bl_idname = "VIEW3D_PT_test_2"
29     bl_label = "Panel Two"
30
31     def draw(self, context):
32         self.layout.label("Also Small Class")
33
34
35 bpy.utils.register_class(PanelOne)
36 bpy.utils.register_class(PanelTwo)