Skip to content

Commit 066b7bd

Browse files
committed
Create ui module
This is where you put all your panels, menus, ui lists, etc. For panels I usually put everything in a column, because I prefer how the spacing looks.
1 parent 434cb71 commit 066b7bd

File tree

2 files changed

+34
-0
lines changed

2 files changed

+34
-0
lines changed

addon/ui/__init__.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import bpy
2+
from . import example_panel
3+
4+
5+
classes = (
6+
example_panel.ExamplePanel,
7+
)
8+
9+
10+
def register():
11+
for cls in classes:
12+
bpy.utils.register_class(cls)
13+
14+
15+
def unregister():
16+
for cls in reversed(classes):
17+
bpy.utils.unregister_class(cls)

addon/ui/example_panel.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import bpy
2+
from .. import utils
3+
4+
5+
class ExamplePanel(bpy.types.Panel):
6+
bl_idname = 'EXAMPLE_PT_ExamplePanel'
7+
bl_category = 'Example'
8+
bl_label = 'Example Panel'
9+
bl_space_type = 'VIEW_3D'
10+
bl_region_type = 'UI'
11+
12+
13+
def draw(self, context):
14+
column = self.layout.column()
15+
16+
box = column.box()
17+
utils.ui.draw_op(box, 'Useless Button', 'example.example_operator')

0 commit comments

Comments
 (0)