7d3bbdde38e24a129e9ec03e350c892ef72f00f7
[blender-staging.git] / release / scripts / ui / properties_data_lattice.py
1 # This software is distributable under the terms of the GNU
2 # General Public License (GPL) v2, the text of which can be found at
3 # http://www.gnu.org/copyleft/gpl.html. Installing, importing or otherwise
4 # using this module constitutes acceptance of the terms of this License.
5
6
7 import bpy
8
9 class DataButtonsPanel(bpy.types.Panel):
10     bl_space_type = 'PROPERTIES'
11     bl_region_type = 'WINDOW'
12     bl_context = "data"
13
14     def poll(self, context):
15         return context.lattice
16
17 class DATA_PT_context_lattice(DataButtonsPanel):
18     bl_label = ""
19     bl_show_header = False
20
21     def draw(self, context):
22         layout = self.layout
23
24         ob = context.object
25         lat = context.lattice
26         space = context.space_data
27
28         split = layout.split(percentage=0.65)
29
30         if ob:
31             split.template_ID(ob, "data")
32             split.itemS()
33         elif lat:
34             split.template_ID(space, "pin_id")
35             split.itemS()
36
37 class DATA_PT_lattice(DataButtonsPanel):
38     bl_label = "Lattice"
39
40     def draw(self, context):
41         layout = self.layout
42
43         lat = context.lattice
44
45         row = layout.row()
46         row.itemR(lat, "points_u")
47         row.itemR(lat, "interpolation_type_u", expand=True)
48
49         row = layout.row()
50         row.itemR(lat, "points_v")
51         row.itemR(lat, "interpolation_type_v", expand=True)
52
53         row = layout.row()
54         row.itemR(lat, "points_w")
55         row.itemR(lat, "interpolation_type_w", expand=True)
56
57         row = layout.row()
58         row.itemO("lattice.make_regular")
59         row.itemR(lat, "outside")
60
61 bpy.types.register(DATA_PT_context_lattice)
62 bpy.types.register(DATA_PT_lattice)