2.5 Physic Buttons:
[blender-staging.git] / release / ui / buttons_physics_field.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                 return (context.object != None)
11                 
12 class PHYSICS_PT_field(PhysicButtonsPanel):
13         __idname__ = "PHYSICS_PT_field"
14         __label__ = "Field"
15
16         def draw(self, context):
17                 layout = self.layout
18                 ob = context.object
19                 field = ob.field
20
21                 layout.itemR(field, "type")
22
23                 if field.type != "NONE":
24                         layout.itemR(field, "strength")
25
26                 if field.type in ("HARMONIC", "SPHERICAL", "CHARGE", "LENNARDj"):
27                         if ob.type in ("MESH", "SURFACE", "FONT", "CURVE"):
28                                 layout.itemR(field, "surface")
29
30 class PHYSICS_PT_collision(PhysicButtonsPanel):
31         __idname__ = "PHYSICS_PT_collision"
32         __label__ = "Collision"
33         
34         def poll(self, context):
35                 ob = context.object
36                 return (ob and ob.type == 'MESH')
37
38         def draw_header(self, context):
39                 settings = context.object.collision
40                 self.layout.itemR(settings, "enabled", text="")
41
42         def draw(self, context):
43                 layout = self.layout
44                 md = context.collision
45                 settings = context.object.collision
46
47                 if settings.enabled:
48                         pass
49
50 bpy.types.register(PHYSICS_PT_field)
51 bpy.types.register(PHYSICS_PT_collision)
52