2.5 Physic Buttons:
[blender-staging.git] / release / ui / buttons_physics_softbody.py
1
2 import bpy
3
4 class PhysicButtonsPanel(bpy.types.Panel):
5         __space_type__ = "BUTTONS_WINDOW"
6         __region_type__ = "WINDOW"
7         __context__ = "physics"
8
9         def poll(self, context):
10                 ob = context.object
11                 return (ob and ob.type == 'MESH')
12                 
13 class PHYSICS_PT_softbody(PhysicButtonsPanel):
14         __idname__ = "PHYSICS_PT_softbody"
15         __label__ = "Soft Body"
16
17         def draw(self, context):
18                 layout = self.layout
19                 md = context.soft_body
20                 ob = context.object
21
22                 split = layout.split()
23                 split.operator_context = "EXEC_DEFAULT"
24
25                 if md:
26                         # remove modifier + settings
27                         split.set_context_pointer("modifier", md)
28                         split.itemO("OBJECT_OT_modifier_remove", text="Remove")
29
30                         row = split.row(align=True)
31                         row.itemR(md, "render", text="")
32                         row.itemR(md, "realtime", text="")
33                 else:
34                         # add modifier
35                         split.item_enumO("OBJECT_OT_modifier_add", "type", "SOFTBODY", text="Add")
36                         split.itemL()
37
38                 if md:
39                         softbody = md.settings
40
41                         split = layout.split()
42                         
43 bpy.types.register(PHYSICS_PT_softbody)
44