Removed UI for point cache users.
[blender.git] / release / scripts / startup / bl_ui / properties_physics_softbody.py
1 # ##### BEGIN GPL LICENSE BLOCK #####
2 #
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.
7 #
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.
12 #
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.
16 #
17 # ##### END GPL LICENSE BLOCK #####
18
19 # <pep8 compliant>
20 import bpy
21 from bpy.types import Panel
22
23 from bl_ui.properties_physics_common import (
24         effector_weights_ui,
25         )
26
27
28 class PhysicButtonsPanel:
29     bl_space_type = 'PROPERTIES'
30     bl_region_type = 'WINDOW'
31     bl_context = "physics"
32
33     @classmethod
34     def poll(cls, context):
35         ob = context.object
36         rd = context.scene.render
37         return (ob and (ob.type == 'MESH' or ob.type == 'LATTICE'or ob.type == 'CURVE')) and (not rd.use_game_engine) and (context.soft_body)
38
39
40 class PHYSICS_PT_softbody(PhysicButtonsPanel, Panel):
41     bl_label = "Soft Body"
42
43     def draw(self, context):
44         layout = self.layout
45
46         md = context.soft_body
47         ob = context.object
48
49         softbody = md.settings
50
51         # General
52         split = layout.split()
53
54         col = split.column()
55         col.label(text="Object:")
56         col.prop(softbody, "friction")
57         col.prop(softbody, "mass")
58         col.prop_search(softbody, "vertex_group_mass", ob, "vertex_groups", text="Mass")
59
60         col = split.column()
61         col.label(text="Simulation:")
62         col.prop(softbody, "speed")
63
64
65 class PHYSICS_PT_softbody_goal(PhysicButtonsPanel, Panel):
66     bl_label = "Soft Body Goal"
67     bl_options = {'DEFAULT_CLOSED'}
68
69     def draw_header(self, context):
70         softbody = context.soft_body.settings
71
72         self.layout.prop(softbody, "use_goal", text="")
73
74     def draw(self, context):
75         layout = self.layout
76
77         md = context.soft_body
78         softbody = md.settings
79         ob = context.object
80
81         layout.active = softbody.use_goal
82
83         split = layout.split()
84
85         # Goal
86         split = layout.split()
87
88         col = split.column()
89         col.label(text="Goal Strengths:")
90         col.prop(softbody, "goal_default", text="Default")
91         sub = col.column(align=True)
92         sub.prop(softbody, "goal_min", text="Minimum")
93         sub.prop(softbody, "goal_max", text="Maximum")
94
95         col = split.column()
96         col.label(text="Goal Settings:")
97         col.prop(softbody, "goal_spring", text="Stiffness")
98         col.prop(softbody, "goal_friction", text="Damping")
99
100         layout.prop_search(softbody, "vertex_group_goal", ob, "vertex_groups", text="Vertex Group")
101
102
103 class PHYSICS_PT_softbody_edge(PhysicButtonsPanel, Panel):
104     bl_label = "Soft Body Edges"
105     bl_options = {'DEFAULT_CLOSED'}
106
107     def draw_header(self, context):
108         softbody = context.soft_body.settings
109
110         self.layout.prop(softbody, "use_edges", text="")
111
112     def draw(self, context):
113         layout = self.layout
114
115         md = context.soft_body
116         softbody = md.settings
117         ob = context.object
118
119         layout.active = softbody.use_edges
120
121         split = layout.split()
122
123         col = split.column()
124         col.label(text="Springs:")
125         col.prop(softbody, "pull")
126         col.prop(softbody, "push")
127         col.prop(softbody, "damping")
128         col.prop(softbody, "plastic")
129         col.prop(softbody, "bend")
130         col.prop(softbody, "spring_length", text="Length")
131         col.prop_search(softbody, "vertex_group_spring", ob, "vertex_groups", text="Springs")
132
133         col = split.column()
134         col.prop(softbody, "use_stiff_quads")
135         sub = col.column()
136         sub.active = softbody.use_stiff_quads
137         sub.prop(softbody, "shear")
138
139         col.label(text="Aerodynamics:")
140         col.row().prop(softbody, "aerodynamics_type", expand=True)
141         col.prop(softbody, "aero", text="Factor")
142
143         #sub = col.column()
144         #sub.enabled = softbody.aero > 0
145
146         col.label(text="Collision:")
147         col.prop(softbody, "use_edge_collision", text="Edge")
148         col.prop(softbody, "use_face_collision", text="Face")
149
150
151 class PHYSICS_PT_softbody_collision(PhysicButtonsPanel, Panel):
152     bl_label = "Soft Body Self Collision"
153     bl_options = {'DEFAULT_CLOSED'}
154
155     def draw_header(self, context):
156         softbody = context.soft_body.settings
157
158         self.layout.prop(softbody, "use_self_collision", text="")
159
160     def draw(self, context):
161         layout = self.layout
162
163         md = context.soft_body
164         softbody = md.settings
165
166         layout.active = softbody.use_self_collision
167
168         layout.label(text="Collision Ball Size Calculation:")
169         layout.prop(softbody, "collision_type", expand=True)
170
171         col = layout.column(align=True)
172         col.label(text="Ball:")
173         col.prop(softbody, "ball_size", text="Size")
174         col.prop(softbody, "ball_stiff", text="Stiffness")
175         col.prop(softbody, "ball_damp", text="Dampening")
176
177
178 class PHYSICS_PT_softbody_solver(PhysicButtonsPanel, Panel):
179     bl_label = "Soft Body Solver"
180     bl_options = {'DEFAULT_CLOSED'}
181
182     def draw(self, context):
183         layout = self.layout
184
185         md = context.soft_body
186         softbody = md.settings
187
188         # Solver
189         split = layout.split()
190
191         col = split.column(align=True)
192         col.label(text="Step Size:")
193         col.prop(softbody, "step_min")
194         col.prop(softbody, "step_max")
195         col.prop(softbody, "use_auto_step", text="Auto-Step")
196
197         col = split.column()
198         col.prop(softbody, "error_threshold")
199         col.label(text="Helpers:")
200         col.prop(softbody, "choke")
201         col.prop(softbody, "fuzzy")
202
203         layout.label(text="Diagnostics:")
204         layout.prop(softbody, "use_diagnose")
205         layout.prop(softbody, "use_estimate_matrix")
206
207
208 class PHYSICS_PT_softbody_field_weights(PhysicButtonsPanel, Panel):
209     bl_label = "Soft Body Field Weights"
210     bl_options = {'DEFAULT_CLOSED'}
211
212     def draw(self, context):
213         md = context.soft_body
214         softbody = md.settings
215
216         effector_weights_ui(self, context, softbody.effector_weights, 'SOFTBODY')
217
218 if __name__ == "__main__":  # only for live edit.
219     bpy.utils.register_module(__name__)