remove use of gettext: _("...") style translation now its handled by rna.
[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         if md:
51             layout.prop(md, "smoke_type", expand=True)
52
53             if md.smoke_type == 'DOMAIN':
54                 domain = md.domain_settings
55
56                 split = layout.split()
57
58                 split.enabled = not domain.point_cache.is_baked
59
60                 col = split.column()
61                 col.label(text="Resolution:")
62                 col.prop(domain, "resolution_max", text="Divisions")
63                 col.label(text="Time:")
64                 col.prop(domain, "time_scale", text="Scale")
65                 col.label(text="Border Collisions:")
66                 col.prop(domain, "collision_extents", text="")
67
68                 col = split.column()
69                 col.label(text="Behavior:")
70                 col.prop(domain, "alpha")
71                 col.prop(domain, "beta", text="Temp. Diff.")
72                 col.prop(domain, "vorticity")
73                 col.prop(domain, "use_dissolve_smoke", text="Dissolve")
74                 sub = col.column()
75                 sub.active = domain.use_dissolve_smoke
76                 sub.prop(domain, "dissolve_speed", text="Time")
77                 sub.prop(domain, "use_dissolve_smoke_log", text="Slow")
78
79             elif md.smoke_type == 'FLOW':
80
81                 flow = md.flow_settings
82
83                 split = layout.split()
84
85                 col = split.column()
86                 col.prop(flow, "use_outflow")
87                 col.label(text="Particle System:")
88                 col.prop_search(flow, "particle_system", ob, "particle_systems", text="")
89
90                 sub = col.column()
91                 sub.active = not md.flow_settings.use_outflow
92
93                 sub.prop(flow, "initial_velocity", text="Initial Velocity")
94                 sub = sub.column()
95                 sub.active = flow.initial_velocity
96                 sub.prop(flow, "velocity_factor", text="Multiplier")
97
98                 sub = split.column()
99                 sub.active = not md.flow_settings.use_outflow
100                 sub.label(text="Initial Values:")
101                 sub.prop(flow, "use_absolute")
102                 sub.prop(flow, "density")
103                 sub.prop(flow, "temperature")
104
105
106 class PHYSICS_PT_smoke_groups(PhysicButtonsPanel, Panel):
107     bl_label = "Smoke Groups"
108     bl_options = {'DEFAULT_CLOSED'}
109
110     @classmethod
111     def poll(cls, context):
112         md = context.smoke
113         return md and (md.smoke_type == 'DOMAIN')
114
115     def draw(self, context):
116         layout = self.layout
117
118         group = context.smoke.domain_settings
119
120         split = layout.split()
121
122         col = split.column()
123         col.label(text="Flow Group:")
124         col.prop(group, "fluid_group", text="")
125
126         #col.label(text="Effector Group:")
127         #col.prop(group, "effector_group", text="")
128
129         col = split.column()
130         col.label(text="Collision Group:")
131         col.prop(group, "collision_group", text="")
132
133
134 class PHYSICS_PT_smoke_highres(PhysicButtonsPanel, Panel):
135     bl_label = "Smoke High Resolution"
136     bl_options = {'DEFAULT_CLOSED'}
137
138     @classmethod
139     def poll(cls, context):
140         md = context.smoke
141         return md and (md.smoke_type == 'DOMAIN')
142
143     def draw_header(self, context):
144         md = context.smoke.domain_settings
145
146         self.layout.prop(md, "use_high_resolution", text="")
147
148     def draw(self, context):
149         layout = self.layout
150
151         md = context.smoke.domain_settings
152
153         layout.active = md.use_high_resolution
154
155         split = layout.split()
156         split.enabled = not md.point_cache.is_baked
157
158         col = split.column()
159         col.label(text="Resolution:")
160         col.prop(md, "amplify", text="Divisions")
161         col.prop(md, "smooth_emitter")
162
163         col = split.column()
164         col.label(text="Noise Method:")
165         col.row().prop(md, "noise_type", text="")
166         col.prop(md, "strength")
167
168         layout.prop(md, "show_high_resolution")
169
170
171 class PHYSICS_PT_smoke_cache(PhysicButtonsPanel, Panel):
172     bl_label = "Smoke Cache"
173     bl_options = {'DEFAULT_CLOSED'}
174
175     @classmethod
176     def poll(cls, context):
177         md = context.smoke
178         return md and (md.smoke_type == 'DOMAIN')
179
180     def draw(self, context):
181         layout = self.layout
182
183         md = context.smoke.domain_settings
184         cache = md.point_cache
185
186         layout.label(text="Compression:")
187         layout.prop(md, "point_cache_compress_type", expand=True)
188
189         point_cache_ui(self, context, cache, (cache.is_baked is False), 'SMOKE')
190
191
192 class PHYSICS_PT_smoke_field_weights(PhysicButtonsPanel, Panel):
193     bl_label = "Smoke Field Weights"
194     bl_options = {'DEFAULT_CLOSED'}
195
196     @classmethod
197     def poll(cls, context):
198         smoke = context.smoke
199         return (smoke and smoke.smoke_type == 'DOMAIN')
200
201     def draw(self, context):
202         domain = context.smoke.domain_settings
203         effector_weights_ui(self, context, domain.effector_weights)
204
205 if __name__ == "__main__":  # only for live edit.
206     bpy.utils.register_module(__name__)