merged from trunk 20741:20848
[blender-staging.git] / release / ui / buttons_data_mesh.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.mesh != None)
11
12 class DATA_PT_mesh(DataButtonsPanel):
13         __idname__ = "DATA_PT_mesh"
14         __label__ = "Mesh"
15
16         def draw(self, context):
17                 ob = context.object
18                 mesh = context.mesh
19                 space = context.space_data
20                 layout = self.layout
21
22                 split = layout.split(percentage=0.65)
23
24                 if ob:
25                         split.template_ID(context, ob, "data")
26                         split.itemS()
27                 elif mesh:
28                         split.template_ID(context, space, "pin_id")
29                         split.itemS()
30
31                 if mesh:
32                         layout.itemS()
33
34                         split = layout.split()
35                 
36                         col = split.column()
37                         col.itemR(mesh, "autosmooth")
38                         colsub = col.column()
39                         colsub.active = mesh.autosmooth
40                         colsub.itemR(mesh, "autosmooth_angle", text="Angle")
41                         sub = split.column()
42                         sub.itemR(mesh, "vertex_normal_flip")
43                         sub.itemR(mesh, "double_sided")
44                         
45                         layout.itemR(mesh, "texco_mesh")                        
46                                         
47 bpy.types.register(DATA_PT_mesh)