UI:
[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 poll(self, context):
17                 return (context.object and context.object.type == 'MESH')
18
19         def draw(self, context):
20                 layout = self.layout
21                 
22                 ob = context.object
23                 mesh = context.mesh
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 mesh:
32                         split.template_ID(context, space, "pin_id")
33                         split.itemS()
34
35                 if mesh:
36                         layout.itemS()
37
38                         split = layout.split()
39                 
40                         col = split.column()
41                         col.itemR(mesh, "autosmooth")
42                         colsub = col.column()
43                         colsub.active = mesh.autosmooth
44                         colsub.itemR(mesh, "autosmooth_angle", text="Angle")
45                         sub = split.column()
46                         sub.itemR(mesh, "vertex_normal_flip")
47                         sub.itemR(mesh, "double_sided")
48                         
49                         layout.itemR(mesh, "texco_mesh")                        
50                                         
51 bpy.types.register(DATA_PT_mesh)