Patch from William
[blender-staging.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_context(DataButtonsPanel):
13         __idname__ = "DATA_PT_context"
14         __label__ = " "
15         
16         def poll(self, context):
17                 return (context.object and 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(ob, "data")
30                         split.itemS()
31                 elif lat:
32                         split.template_ID(space, "pin_id")
33                         split.itemS()
34
35
36 class DATA_PT_lattice(DataButtonsPanel):
37         __idname__ = "DATA_PT_lattice"
38         __label__ = "Lattice"
39         
40         def poll(self, context):
41                 return (context.object and context.object.type == 'LATTICE')
42
43         def draw(self, context):
44                 layout = self.layout
45                 
46                 ob = context.object
47                 lat = context.lattice
48                 space = context.space_data
49
50                 if lat:
51                         row = layout.row()
52                         row.itemR(lat, "points_u")
53                         row.itemR(lat, "interpolation_type_u", expand=True)
54                         
55                         row = layout.row()
56                         row.itemR(lat, "points_v")
57                         row.itemR(lat, "interpolation_type_v", expand=True)
58                         
59                         row = layout.row()
60                         row.itemR(lat, "points_w")
61                         row.itemR(lat, "interpolation_type_w", expand=True)
62                         
63                         row = layout.row()
64                         row.itemO("LATTICE_OT_make_regular")
65                         row.itemR(lat, "outside")
66
67 bpy.types.register(DATA_PT_context)
68 bpy.types.register(DATA_PT_lattice)