-
Notifications
You must be signed in to change notification settings - Fork 0
/
easytile_panel_editor.py
53 lines (42 loc) · 2.18 KB
/
easytile_panel_editor.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
import bpy
class EASYTILE_UL_tiles(bpy.types.UIList):
def draw_item(self, context, layout, data, item, icon, active_data, active_propname, index):
ref = item.ref
if self.layout_type in {'DEFAULT', 'COMPACT'}:
layout.prop(ref, "name", text="", emboss=False, icon_value=layout.icon(ref))
elif self.layout_type in {'GRID'}:
layout.alignment = 'CENTER'
layout.label(text="", icon_value=layout.icon(ref))
def invoke(self, context, event):
pass
class EASYTILE_PT_editor_panel(bpy.types.Panel):
bl_idname = "EASYTILE_PT_editor_panel"
bl_label = "EasyTile"
bl_category = "EasyTile"
bl_space_type = "VIEW_3D"
bl_region_type = "UI"
def draw(self, context):
layout = self.layout
scn = context.scene
rows = 2
row = layout.row()
row.template_list("EASYTILE_UL_tiles", "easytile_tiles_list", scn.easytile, "tiles", scn.easytile, "tile_index",
rows=rows)
col = row.column(align=True)
col.operator("easytile.tiles_actions", icon='ADD', text="").action = 'ADD'
col.operator("easytile.tiles_actions", icon='REMOVE', text="").action = 'REMOVE'
col.separator()
col.operator("easytile.tiles_actions", icon='TRIA_UP', text="").action = 'UP'
col.operator("easytile.tiles_actions", icon='TRIA_DOWN', text="").action = 'DOWN'
row = layout.row()
row.operator("easytile.properties_actions", icon="REMOVE", text="").action = "DEC_GRID"
row.label(text=f"Grid size: {scn.easytile.get_grid_dimension()}")
row.operator("easytile.properties_actions", icon="ADD", text="").action = "INC_GRID"
row = layout.row()
row.operator("easytile.properties_actions", icon="REMOVE", text="").action = "DEC_HEIGHT"
row.label(text=f"Height increment: {scn.easytile.get_height_increment()}")
row.operator("easytile.properties_actions", icon="ADD", text="").action = "INC_HEIGHT"
row = layout.row()
row.prop(scn.easytile, "height", text="Tile Height")
row = layout.row()
row.operator("easytile.editor", text="Draw tiles")