Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'doc/python_api/examples/bpy.types.Panel.1.py')
-rw-r--r--doc/python_api/examples/bpy.types.Panel.1.py43
1 files changed, 43 insertions, 0 deletions
diff --git a/doc/python_api/examples/bpy.types.Panel.1.py b/doc/python_api/examples/bpy.types.Panel.1.py
new file mode 100644
index 00000000000..ab32a043706
--- /dev/null
+++ b/doc/python_api/examples/bpy.types.Panel.1.py
@@ -0,0 +1,43 @@
+"""
+Simple Object Panel
++++++++++++++++++++
+This panel has a :class:`Panel.poll` and :class:`Panel.draw_header` function,
+even though the contents is basic this closely resemples blenders panels.
+"""
+import bpy
+
+
+class ObjectSelectPanel(bpy.types.Panel):
+ bl_idname = "OBJECT_PT_select"
+ bl_label = "Select"
+ bl_space_type = 'PROPERTIES'
+ bl_region_type = 'WINDOW'
+ bl_context = "object"
+ bl_options = {'DEFAULT_CLOSED'}
+
+ @classmethod
+ def poll(cls, context):
+ return (context.object is not None)
+
+ def draw_header(self, context):
+ layout = self.layout
+ obj = context.object
+ layout.prop(obj, "select", text="")
+
+ def draw(self, context):
+ layout = self.layout
+
+ obj = context.object
+ row = layout.row()
+ row.prop(obj, "hide_select")
+ row.prop(obj, "hide_render")
+
+ box = layout.box()
+ box.label("Selection Tools")
+ box.operator("object.select_all")
+ row = box.row()
+ row.operator("object.select_inverse")
+ row.operator("object.select_random")
+
+
+bpy.utils.register_class(ObjectSelectPanel)