Merge from 2.5 r20991 through r21037
[blender.git] / release / ui / buttons_data_lattice.py
1
2 import bpy
3
4 class DataButtonsPanel(bpy.types.Panel):
5         __space_type__ = "BUTTONS_WINDOW"
6         __region_type__ = "WINDOW"
7         __context__ = "data"
8         
9         def poll(self, context):
10                 return (context.lattice != None)
11         
12 class DATA_PT_lattice(DataButtonsPanel):
13         __idname__ = "DATA_PT_lattice"
14         __label__ = "Lattice"
15         
16         def poll(self, context):
17                 return (context.object.type == 'LATTICE')
18
19         def draw(self, context):
20                 layout = self.layout
21                 
22                 ob = context.object
23                 lat = context.lattice
24                 space = context.space_data
25
26                 split = layout.split(percentage=0.65)
27
28                 if ob:
29                         split.template_ID(context, ob, "data")
30                         split.itemS()
31                 elif lat:
32                         split.template_ID(context, space, "pin_id")
33                         split.itemS()
34
35                 if lat:
36                         layout.itemS()
37
38                         row = layout.row()
39                         row.itemR(lat, "points_u")
40                         row.itemR(lat, "interpolation_type_u", expand=True)
41                         
42                         row = layout.row()
43                         row.itemR(lat, "points_v")
44                         row.itemR(lat, "interpolation_type_v", expand=True)
45                         
46                         row = layout.row()
47                         row.itemR(lat, "points_w")
48                         row.itemR(lat, "interpolation_type_w", expand=True)
49                         
50                         row = layout.row()
51                         row.itemR(lat, "outside")
52                         row.itemR(lat, "shape_keys")
53
54 bpy.types.register(DATA_PT_lattice)