1 # ##### BEGIN GPL LICENSE BLOCK #####
3 # This program is free software; you can redistribute it and/or
4 # modify it under the terms of the GNU General Public License
5 # as published by the Free Software Foundation; either version 2
6 # of the License, or (at your option) any later version.
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details.
13 # You should have received a copy of the GNU General Public License
14 # along with this program; if not, write to the Free Software Foundation,
15 # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 # ##### END GPL LICENSE BLOCK #####
21 from bpy.types import Panel
24 class PHYSICS_PT_rigidbody_panel():
25 bl_space_type = 'PROPERTIES'
26 bl_region_type = 'WINDOW'
27 bl_context = "physics"
30 class PHYSICS_PT_rigid_body(PHYSICS_PT_rigidbody_panel, Panel):
31 bl_label = "Rigid Body"
34 def poll(cls, context):
36 return (obj and obj.rigid_body and
37 (not context.scene.render.use_game_engine))
39 def draw(self, context):
46 layout.prop(rbo, "type", text="Type")
48 if rbo.type == 'ACTIVE':
49 row.prop(rbo, "enabled", text="Dynamic")
50 row.prop(rbo, "kinematic", text="Animated")
52 if rbo.type == 'ACTIVE':
53 layout.prop(rbo, "mass")
56 class PHYSICS_PT_rigid_body_collisions(PHYSICS_PT_rigidbody_panel, Panel):
57 bl_label = "Rigid Body Collisions"
60 def poll(cls, context):
62 return (obj and obj.rigid_body and
63 (not context.scene.render.use_game_engine))
65 def draw(self, context):
71 layout.prop(rbo, "collision_shape", text="Shape")
73 if rbo.collision_shape in {'MESH', 'CONVEX_HULL'}:
74 layout.prop(rbo, "mesh_source", text="Source")
76 if rbo.collision_shape == 'MESH' and rbo.mesh_source == 'DEFORM':
77 layout.prop(rbo, "use_deform", text="Deforming")
79 split = layout.split()
82 col.label(text="Surface Response:")
83 col.prop(rbo, "friction")
84 col.prop(rbo, "restitution", text="Bounciness")
87 col.label(text="Sensitivity:")
88 if rbo.collision_shape in {'MESH', 'CONE'}:
89 col.prop(rbo, "collision_margin", text="Margin")
91 col.prop(rbo, "use_margin")
93 sub.active = rbo.use_margin
94 sub.prop(rbo, "collision_margin", text="Margin")
96 layout.prop(rbo, "collision_groups")
99 class PHYSICS_PT_rigid_body_dynamics(PHYSICS_PT_rigidbody_panel, Panel):
100 bl_label = "Rigid Body Dynamics"
101 bl_default_closed = True
104 def poll(cls, context):
106 return (obj and obj.rigid_body and
107 obj.rigid_body.type == 'ACTIVE' and
108 (not context.scene.render.use_game_engine))
110 def draw(self, context):
116 #col = layout.column(align=1)
117 #col.label(text="Activation:")
118 # XXX: settings such as activate on collison/etc.
120 split = layout.split()
123 col.label(text="Deactivation:")
124 col.prop(rbo, "use_deactivation")
126 sub.active = rbo.use_deactivation
127 sub.prop(rbo, "use_start_deactivated")
128 sub.prop(rbo, "deactivate_linear_velocity", text="Linear Vel")
129 sub.prop(rbo, "deactivate_angular_velocity", text="Angular Vel")
130 # TODO: other params such as time?
133 col.label(text="Damping:")
134 col.prop(rbo, "linear_damping", text="Translation")
135 col.prop(rbo, "angular_damping", text="Rotation")
137 if __name__ == "__main__": # only for live edit.
138 bpy.utils.register_module(__name__)