Removed UI for point cache users.
[blender.git] / release / scripts / startup / bl_ui / properties_physics_field.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         basic_force_field_settings_ui,
25         basic_force_field_falloff_ui,
26         )
27
28
29 class PhysicButtonsPanel:
30     bl_space_type = 'PROPERTIES'
31     bl_region_type = 'WINDOW'
32     bl_context = "physics"
33
34     @classmethod
35     def poll(cls, context):
36         rd = context.scene.render
37         return (context.object) and (not rd.use_game_engine)
38
39
40 class PHYSICS_PT_field(PhysicButtonsPanel, Panel):
41     bl_label = "Force Fields"
42
43     @classmethod
44     def poll(cls, context):
45         ob = context.object
46         rd = context.scene.render
47         return (not rd.use_game_engine) and (ob.field) and (ob.field.type != 'NONE')
48
49     def draw(self, context):
50         layout = self.layout
51
52         ob = context.object
53         field = ob.field
54
55         split = layout.split(percentage=0.2)
56         split.label(text="Type:")
57
58         split.prop(field, "type", text="")
59
60         if field.type not in {'NONE', 'GUIDE', 'TEXTURE'}:
61             split = layout.split(percentage=0.2)
62             split.label(text="Shape:")
63             split.prop(field, "shape", text="")
64         elif field.type == 'TEXTURE':
65             split = layout.split(percentage=0.2)
66             split.label(text="Texture:")
67             split.row().template_ID(field, "texture", new="texture.new")
68
69         split = layout.split()
70
71         if field.type == 'NONE':
72             return  # nothing to draw
73         elif field.type == 'GUIDE':
74             col = split.column()
75             col.prop(field, "guide_minimum")
76             col.prop(field, "guide_free")
77             col.prop(field, "falloff_power")
78             col.prop(field, "use_guide_path_add")
79             col.prop(field, "use_guide_path_weight")
80
81             col = split.column()
82             col.label(text="Clumping:")
83             col.prop(field, "guide_clump_amount")
84             col.prop(field, "guide_clump_shape")
85
86             row = layout.row()
87             row.prop(field, "use_max_distance")
88             sub = row.row()
89             sub.active = field.use_max_distance
90             sub.prop(field, "distance_max")
91
92             layout.separator()
93
94             layout.prop(field, "guide_kink_type")
95             if field.guide_kink_type != 'NONE':
96                 layout.prop(field, "guide_kink_axis")
97
98                 split = layout.split()
99
100                 col = split.column()
101                 col.prop(field, "guide_kink_frequency")
102                 col.prop(field, "guide_kink_shape")
103
104                 col = split.column()
105                 col.prop(field, "guide_kink_amplitude")
106
107         elif field.type == 'TEXTURE':
108             col = split.column()
109             col.prop(field, "strength")
110             col.prop(field, "texture_mode", text="")
111             col.prop(field, "texture_nabla")
112
113             col = split.column()
114             col.prop(field, "use_object_coords")
115             col.prop(field, "use_2d_force")
116         elif field.type == 'SMOKE_FLOW':
117             col = split.column()
118             col.prop(field, "strength")
119             col.prop(field, "flow")
120             col = split.column()
121             col.label(text="Domain Object:")
122             col.prop(field, "source_object", "")
123             col.prop(field, "use_smoke_density")
124         else:
125             basic_force_field_settings_ui(self, context, field)
126
127         if field.type not in {'NONE', 'GUIDE'}:
128
129             layout.label(text="Falloff:")
130             layout.prop(field, "falloff_type", expand=True)
131
132             basic_force_field_falloff_ui(self, context, field)
133
134             if field.falloff_type == 'CONE':
135                 layout.separator()
136
137                 split = layout.split(percentage=0.35)
138
139                 col = split.column()
140                 col.label(text="Angular:")
141                 col.prop(field, "use_radial_min", text="Use Minimum")
142                 col.prop(field, "use_radial_max", text="Use Maximum")
143
144                 col = split.column()
145                 col.prop(field, "radial_falloff", text="Power")
146
147                 sub = col.column()
148                 sub.active = field.use_radial_min
149                 sub.prop(field, "radial_min", text="Angle")
150
151                 sub = col.column()
152                 sub.active = field.use_radial_max
153                 sub.prop(field, "radial_max", text="Angle")
154
155             elif field.falloff_type == 'TUBE':
156                 layout.separator()
157
158                 split = layout.split(percentage=0.35)
159
160                 col = split.column()
161                 col.label(text="Radial:")
162                 col.prop(field, "use_radial_min", text="Use Minimum")
163                 col.prop(field, "use_radial_max", text="Use Maximum")
164
165                 col = split.column()
166                 col.prop(field, "radial_falloff", text="Power")
167
168                 sub = col.column()
169                 sub.active = field.use_radial_min
170                 sub.prop(field, "radial_min", text="Distance")
171
172                 sub = col.column()
173                 sub.active = field.use_radial_max
174                 sub.prop(field, "radial_max", text="Distance")
175
176
177 class PHYSICS_PT_collision(PhysicButtonsPanel, Panel):
178     bl_label = "Collision"
179
180     @classmethod
181     def poll(cls, context):
182         ob = context.object
183         rd = context.scene.render
184         return (ob and ob.type == 'MESH') and (not rd.use_game_engine) and (context.collision)
185
186     def draw(self, context):
187         layout = self.layout
188
189         md = context.collision
190
191         split = layout.split()
192
193         coll = md.settings
194
195         if coll:
196             settings = context.object.collision
197
198             layout.active = settings.use
199
200             split = layout.split()
201
202             col = split.column()
203             col.label(text="Particle:")
204             col.prop(settings, "permeability", slider=True)
205             col.prop(settings, "stickiness")
206             col.prop(settings, "use_particle_kill")
207             col.label(text="Particle Damping:")
208             sub = col.column(align=True)
209             sub.prop(settings, "damping_factor", text="Factor", slider=True)
210             sub.prop(settings, "damping_random", text="Random", slider=True)
211
212             col.label(text="Particle Friction:")
213             sub = col.column(align=True)
214             sub.prop(settings, "friction_factor", text="Factor", slider=True)
215             sub.prop(settings, "friction_random", text="Random", slider=True)
216
217             col = split.column()
218             col.label(text="Soft Body and Cloth:")
219             sub = col.column(align=True)
220             sub.prop(settings, "thickness_outer", text="Outer", slider=True)
221             sub.prop(settings, "thickness_inner", text="Inner", slider=True)
222
223             col.label(text="Soft Body Damping:")
224             col.prop(settings, "damping", text="Factor", slider=True)
225
226             col.label(text="Force Fields:")
227             col.prop(settings, "absorption", text="Absorption")
228
229 if __name__ == "__main__":  # only for live edit.
230     bpy.utils.register_module(__name__)