Usual i18n/UI messages fixes.
[blender.git] / release / scripts / startup / bl_ui / properties_physics_smoke.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         point_cache_ui,
25         effector_weights_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         ob = context.object
37         rd = context.scene.render
38         return (ob and ob.type == 'MESH') and (not rd.use_game_engine) and (context.smoke)
39
40
41 class PHYSICS_PT_smoke(PhysicButtonsPanel, Panel):
42     bl_label = "Smoke"
43
44     def draw(self, context):
45         layout = self.layout
46
47         md = context.smoke
48         ob = context.object
49
50         layout.prop(md, "smoke_type", expand=True)
51
52         if md.smoke_type == 'DOMAIN':
53             domain = md.domain_settings
54
55             split = layout.split()
56
57             split.enabled = not domain.point_cache.is_baked
58
59             col = split.column()
60             col.label(text="Resolution:")
61             col.prop(domain, "resolution_max", text="Divisions")
62             col.label(text="Time:")
63             col.prop(domain, "time_scale", text="Scale")
64             col.label(text="Border Collisions:")
65             col.prop(domain, "collision_extents", text="")
66
67             col = split.column()
68             col.label(text="Behavior:")
69             col.prop(domain, "alpha")
70             col.prop(domain, "beta", text="Temp. Diff.")
71             col.prop(domain, "vorticity")
72             col.prop(domain, "use_dissolve_smoke", text="Dissolve")
73             sub = col.column()
74             sub.active = domain.use_dissolve_smoke
75             sub.prop(domain, "dissolve_speed", text="Time")
76             sub.prop(domain, "use_dissolve_smoke_log", text="Slow")
77
78         elif md.smoke_type == 'FLOW':
79
80             flow = md.flow_settings
81
82             layout.prop(flow, "smoke_flow_type", expand=False)
83
84             if flow.smoke_flow_type != 'OUTFLOW':
85                 split = layout.split()
86                 col = split.column()
87                 col.label(text="Flow Source:")
88                 col.prop(flow, "smoke_flow_source", expand=False, text="")
89                 if flow.smoke_flow_source == 'PARTICLES':
90                     col.label(text="Particle System:")
91                     col.prop_search(flow, "particle_system", ob, "particle_systems", text="")
92                     col.prop(flow, "use_particle_size", text="Set Size")
93                     sub = col.column()
94                     sub.active = flow.use_particle_size
95                     sub.prop(flow, "particle_size")
96                 else:
97                     col.prop(flow, "surface_distance")
98                     col.prop(flow, "volume_density")
99
100                 sub = col.column(align=True)
101                 sub.prop(flow, "use_initial_velocity")
102
103                 sub = sub.column()
104                 sub.active = flow.use_initial_velocity
105                 sub.prop(flow, "velocity_factor")
106                 if flow.smoke_flow_source == 'MESH':
107                     sub.prop(flow, "velocity_normal")
108                     #sub.prop(flow, "velocity_random")
109
110                 sub = split.column()
111                 sub.label(text="Initial Values:")
112                 sub.prop(flow, "use_absolute")
113                 if flow.smoke_flow_type in {'SMOKE', 'BOTH'}:
114                     sub.prop(flow, "density")
115                     sub.prop(flow, "temperature")
116                     sub.prop(flow, "smoke_color")
117                 if flow.smoke_flow_type in {'FIRE', 'BOTH'}:
118                     sub.prop(flow, "fuel_amount")
119                 sub.label(text="Sampling:")
120                 sub.prop(flow, "subframes")
121
122         elif md.smoke_type == 'COLLISION':
123             coll = md.coll_settings
124
125             split = layout.split()
126
127             col = split.column()
128             col.prop(coll, "collision_type")
129
130
131 class PHYSICS_PT_smoke_flow_advanced(PhysicButtonsPanel, Panel):
132     bl_label = "Smoke Flow Advanced"
133     bl_options = {'DEFAULT_CLOSED'}
134
135     @classmethod
136     def poll(cls, context):
137         md = context.smoke
138         return md and (md.smoke_type == 'FLOW') and (md.flow_settings.smoke_flow_source == 'MESH')
139
140     def draw(self, context):
141         layout = self.layout
142         ob = context.object
143         flow = context.smoke.flow_settings
144
145         split = layout.split()
146         col = split.column()
147
148         col.prop(flow, "use_texture")
149         sub = col.column()
150         sub.active = flow.use_texture
151         sub.prop(flow, "noise_texture", text="")
152         sub.label(text="Mapping:")
153         sub.prop(flow, "texture_map_type", expand=False, text="")
154         if flow.texture_map_type == 'UV':
155             sub.prop_search(flow, "uv_layer", ob.data, "uv_textures", text="")
156         if flow.texture_map_type == 'AUTO':
157             sub.prop(flow, "texture_size")
158         sub.prop(flow, "texture_offset")
159
160         col = split.column()
161         col.label(text="Vertex Group:")
162         col.prop_search(flow, "density_vertex_group", ob, "vertex_groups", text="")
163
164
165 class PHYSICS_PT_smoke_fire(PhysicButtonsPanel, Panel):
166     bl_label = "Smoke Flames"
167     bl_options = {'DEFAULT_CLOSED'}
168
169     @classmethod
170     def poll(cls, context):
171         md = context.smoke
172         return md and (md.smoke_type == 'DOMAIN')
173
174     def draw(self, context):
175         layout = self.layout
176         domain = context.smoke.domain_settings
177
178         split = layout.split()
179         split.enabled = not domain.point_cache.is_baked
180
181         col = split.column(align=True)
182         col.label(text="Reaction:")
183         col.prop(domain, "burning_rate")
184         col.prop(domain, "flame_smoke")
185         col.prop(domain, "flame_vorticity")
186
187         col = split.column(align=True)
188         col.label(text="Temperatures:")
189         col.prop(domain, "flame_ignition")
190         col.prop(domain, "flame_max_temp")
191         col.prop(domain, "flame_smoke_color")
192
193
194 class PHYSICS_PT_smoke_adaptive_domain(PhysicButtonsPanel, Panel):
195     bl_label = "Smoke Adaptive Domain"
196     bl_options = {'DEFAULT_CLOSED'}
197
198     @classmethod
199     def poll(cls, context):
200         md = context.smoke
201         return md and (md.smoke_type == 'DOMAIN')
202
203     def draw_header(self, context):
204         md = context.smoke.domain_settings
205
206         self.layout.prop(md, "use_adaptive_domain", text="")
207
208     def draw(self, context):
209         layout = self.layout
210
211         domain = context.smoke.domain_settings
212         layout.active = domain.use_adaptive_domain
213
214         split = layout.split()
215         split.enabled = (not domain.point_cache.is_baked)
216
217         col = split.column(align=True)
218         col.label(text="Resolution:")
219         col.prop(domain, "additional_res")
220         col.prop(domain, "adapt_margin")
221
222         col = split.column(align=True)
223         col.label(text="Advanced:")
224         col.prop(domain, "adapt_threshold")
225
226
227 class PHYSICS_PT_smoke_highres(PhysicButtonsPanel, Panel):
228     bl_label = "Smoke High Resolution"
229     bl_options = {'DEFAULT_CLOSED'}
230
231     @classmethod
232     def poll(cls, context):
233         md = context.smoke
234         rd = context.scene.render
235         return md and (md.smoke_type == 'DOMAIN') and (not rd.use_game_engine)
236
237     def draw_header(self, context):
238         md = context.smoke.domain_settings
239
240         self.layout.prop(md, "use_high_resolution", text="")
241
242     def draw(self, context):
243         layout = self.layout
244
245         md = context.smoke.domain_settings
246
247         layout.active = md.use_high_resolution
248
249         split = layout.split()
250         split.enabled = not md.point_cache.is_baked
251
252         col = split.column()
253         col.label(text="Resolution:")
254         col.prop(md, "amplify", text="Divisions")
255         col.label(text="Flow Sampling:")
256         col.row().prop(md, "highres_sampling", text="")
257
258         col = split.column()
259         col.label(text="Noise Method:")
260         col.row().prop(md, "noise_type", text="")
261         col.prop(md, "strength")
262
263         layout.prop(md, "show_high_resolution")
264
265
266 class PHYSICS_PT_smoke_groups(PhysicButtonsPanel, Panel):
267     bl_label = "Smoke Groups"
268     bl_options = {'DEFAULT_CLOSED'}
269
270     @classmethod
271     def poll(cls, context):
272         md = context.smoke
273         rd = context.scene.render
274         return md and (md.smoke_type == 'DOMAIN') and (not rd.use_game_engine)
275
276     def draw(self, context):
277         layout = self.layout
278         domain = context.smoke.domain_settings
279
280         split = layout.split()
281
282         col = split.column()
283         col.label(text="Flow Group:")
284         col.prop(domain, "fluid_group", text="")
285
286         #col.label(text="Effector Group:")
287         #col.prop(domain, "effector_group", text="")
288
289         col = split.column()
290         col.label(text="Collision Group:")
291         col.prop(domain, "collision_group", text="")
292
293
294 class PHYSICS_PT_smoke_cache(PhysicButtonsPanel, Panel):
295     bl_label = "Smoke Cache"
296     bl_options = {'DEFAULT_CLOSED'}
297
298     @classmethod
299     def poll(cls, context):
300         md = context.smoke
301         rd = context.scene.render
302         return md and (md.smoke_type == 'DOMAIN') and (not rd.use_game_engine)
303
304     def draw(self, context):
305         layout = self.layout
306
307         domain = context.smoke.domain_settings
308         cache_file_format = domain.cache_file_format
309
310         layout.prop(domain, "cache_file_format")
311
312         if cache_file_format == 'POINTCACHE':
313             layout.label(text="Compression:")
314             layout.prop(domain, "point_cache_compress_type", expand=True)
315         elif cache_file_format == 'OPENVDB':
316             if not bpy.app.build_options.openvdb:
317                 layout.label("Built without OpenVDB support")
318                 return
319
320             layout.label(text="Compression:")
321             layout.prop(domain, "openvdb_cache_compress_type", expand=True)
322             row = layout.row()
323             row.label("Data Depth:")
324             row.prop(domain, "data_depth", expand=True, text="Data Depth")
325
326         cache = domain.point_cache
327         point_cache_ui(self, context, cache, (cache.is_baked is False), 'SMOKE')
328
329
330 class PHYSICS_PT_smoke_field_weights(PhysicButtonsPanel, Panel):
331     bl_label = "Smoke Field Weights"
332     bl_options = {'DEFAULT_CLOSED'}
333
334     @classmethod
335     def poll(cls, context):
336         md = context.smoke
337         rd = context.scene.render
338         return md and (md.smoke_type == 'DOMAIN') and (not rd.use_game_engine)
339
340     def draw(self, context):
341         domain = context.smoke.domain_settings
342         effector_weights_ui(self, context, domain.effector_weights, 'SMOKE')
343
344 if __name__ == "__main__":  # only for live edit.
345     bpy.utils.register_module(__name__)