FBX exporter conversion almost done.
[blender.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         __default_closed__ = True
34         
35         def poll(self, context):
36                 ob = context.object
37                 return (ob and ob.type == 'MESH')
38
39         def draw_header(self, context):
40                 settings = context.object.collision
41                 self.layout.itemR(settings, "enabled", text="")
42
43         def draw(self, context):
44                 layout = self.layout
45                 md = context.collision
46                 settings = context.object.collision
47
48                 layout.active = settings.enabled
49                 
50                 split = layout.split()
51                 
52                 col = split.column()
53                 col.itemL(text="Damping:")
54                 col.itemR(settings, "damping_factor", text="Factor");
55                 col.itemR(settings, "random_damping", text="Random");
56                 
57                 col = split.column()
58                 col.itemL(text="Friction:")
59                 col.itemR(settings, "friction_factor", text="Factor");
60                 col.itemR(settings, "random_friction", text="Random");
61                 
62                 layout.itemR(settings, "permeability");
63                 layout.itemR(settings, "kill_particles");
64
65 bpy.types.register(PHYSICS_PT_field)
66 bpy.types.register(PHYSICS_PT_collision)