change blender python interface for classes not to ise __idname__ rather bl_idname...
[blender-staging.git] / release / scripts / ui / buttons_data_lattice.py
1
2 import bpy
3
4 class DataButtonsPanel(bpy.types.Panel):
5         bl_space_type = 'PROPERTIES'
6         bl_region_type = 'WINDOW'
7         bl_context = "data"
8         
9         def poll(self, context):
10                 return context.lattice
11         
12 class DATA_PT_context_lattice(DataButtonsPanel):
13         bl_show_header = False
14         
15         def draw(self, context):
16                 layout = self.layout
17                 
18                 ob = context.object
19                 lat = context.lattice
20                 space = context.space_data
21
22                 split = layout.split(percentage=0.65)
23
24                 if ob:
25                         split.template_ID(ob, "data")
26                         split.itemS()
27                 elif lat:
28                         split.template_ID(space, "pin_id")
29                         split.itemS()
30
31 class DATA_PT_lattice(DataButtonsPanel):
32         bl_label = "Lattice"
33
34         def draw(self, context):
35                 layout = self.layout
36                 
37                 lat = context.lattice
38
39                 row = layout.row()
40                 row.itemR(lat, "points_u")
41                 row.itemR(lat, "interpolation_type_u", expand=True)
42                         
43                 row = layout.row()
44                 row.itemR(lat, "points_v")
45                 row.itemR(lat, "interpolation_type_v", expand=True)
46                         
47                 row = layout.row()
48                 row.itemR(lat, "points_w")
49                 row.itemR(lat, "interpolation_type_w", expand=True)
50                         
51                 row = layout.row()
52                 row.itemO("lattice.make_regular")
53                 row.itemR(lat, "outside")
54
55 bpy.types.register(DATA_PT_context_lattice)
56 bpy.types.register(DATA_PT_lattice)