4020c71759d646685e6afa1a13935a8b09c18a09
[blender-staging.git] / release / ui / buttons_data_modifier.py
1
2 import bpy
3
4 class DataButtonsPanel(bpy.types.Panel):
5         __space_type__ = "BUTTONS_WINDOW"
6         __region_type__ = "WINDOW"
7         __context__ = "modifier"
8
9         def poll(self, context):
10                 ob = context.active_object
11                 return (ob and ob.type in ('MESH', 'CURVE', 'SURFACE', 'TEXT', 'LATTICE'))
12                 
13 class DATA_PT_modifiers(DataButtonsPanel):
14         __idname__ = "DATA_PT_modifiers"
15         __label__ = "Modifiers"
16
17         def draw(self, context):
18                 ob = context.active_object
19                 layout = self.layout
20
21                 if not ob:
22                         return
23
24                 row = layout.row()
25                 row.item_menu_enumO("OBJECT_OT_modifier_add", "type")
26                 row.itemL();
27
28                 for md in ob.modifiers:
29                         box = layout.template_modifier(context, md)
30
31                         if md.expanded:
32                                 if md.type == 'ARMATURE':
33                                         self.armature(box, md)
34
35         def armature(self, layout, md):
36                 layout.itemR(md, "object")
37                 row = layout.row()
38                 row.itemR(md, "vertex_group")
39                 row.itemR(md, "invert")
40                 flow = layout.column_flow()
41                 flow.itemR(md, "use_vertex_groups")
42                 flow.itemR(md, "use_bone_envelopes")
43                 flow.itemR(md, "quaternion")
44                 flow.itemR(md, "multi_modifier")
45                 
46 bpy.types.register(DATA_PT_modifiers)
47