Welcome to mirror list, hosted at ThFree Co, Russian Federation.

buttons_physics_fluid.py « ui « release - git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 6f7a97ff793647bda0939e8766835e6d88ae1310 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260

import bpy

class PhysicButtonsPanel(bpy.types.Panel):
	__space_type__ = 'PROPERTIES'
	__region_type__ = 'WINDOW'
	__context__ = "physics"

	def poll(self, context):
		ob = context.object
		rd = context.scene.render_data
		return (ob and ob.type == 'MESH') and (not rd.use_game_engine)
		
class PHYSICS_PT_fluid(PhysicButtonsPanel):
	__label__ = "Fluid"

	def draw(self, context):
		layout = self.layout
		
		md = context.fluid
		ob = context.object

		split = layout.split()
		split.operator_context = 'EXEC_DEFAULT'

		if md:
			# remove modifier + settings
			split.set_context_pointer("modifier", md)
			split.itemO("object.modifier_remove", text="Remove")

			row = split.row(align=True)
			row.itemR(md, "render", text="")
			row.itemR(md, "realtime", text="")
			
			fluid = md.settings
			
		else:
			# add modifier
			split.item_enumO("object.modifier_add", "type", 'FLUID_SIMULATION', text="Add")
			split.itemL()
			
			fluid = None
		
		
		if fluid:
			layout.itemR(fluid, "type")

			if fluid.type == 'DOMAIN':
				layout.itemO("fluid.bake", text="Bake Fluid Simulation", icon='ICON_MOD_FLUIDSIM')
				split = layout.split()
				
				col = split.column()
				col.itemL(text="Resolution:")
				col.itemR(fluid, "resolution", text="Final")
				col.itemL(text="Render Display:")
				col.itemR(fluid, "render_display_mode", text="")
				col.itemL(text="Time:")
				sub = col.column(align=True)
				sub.itemR(fluid, "start_time", text="Start")
				sub.itemR(fluid, "end_time", text="End")
				
				col = split.column()
				col.itemL(text="Required Memory: " + fluid.memory_estimate)
				col.itemR(fluid, "preview_resolution", text="Preview")
				col.itemL(text="Viewport Display:")
				col.itemR(fluid, "viewport_display_mode", text="")
				col.itemL()
				col.itemR(fluid, "generate_speed_vectors")
				col.itemR(fluid, "reverse_frames")
				
				layout.itemR(fluid, "path", text="")
				
			elif fluid.type == 'FLUID':
				split = layout.split()
				
				col = split.column()
				col.itemL(text="Volume Initialization:")
				col.itemR(fluid, "volume_initialization", text="")
				col.itemR(fluid, "export_animated_mesh")
				
				col = split.column()
				col.itemL(text="Initial Velocity:")
				col.itemR(fluid, "initial_velocity", text="")
				
			elif fluid.type == 'OBSTACLE':
				split = layout.split()
				
				col = split.column()
				col.itemL(text="Volume Initialization:")
				col.itemR(fluid, "volume_initialization", text="")
				col.itemR(fluid, "export_animated_mesh")
				
				col = split.column()
				col.itemL(text="Slip Type:")
				col.itemR(fluid, "slip_type", text="")
				if fluid.slip_type == 'PARTIALSLIP':
					col.itemR(fluid, "partial_slip_factor", slider=True, text="Amount")
					
				col.itemL(text="Impact:")
				col.itemR(fluid, "impact_factor", text="Factor")
				
			elif fluid.type == 'INFLOW':
				split = layout.split()
				
				col = split.column()
				col.itemL(text="Volume Initialization:")
				col.itemR(fluid, "volume_initialization", text="")
				col.itemR(fluid, "export_animated_mesh")
				col.itemR(fluid, "local_coordinates")
				
				col = split.column()
				col.itemL(text="Inflow Velocity:")
				col.itemR(fluid, "inflow_velocity", text="")
				
			elif fluid.type == 'OUTFLOW':
				split = layout.split()
				
				col = split.column()
				col.itemL(text="Volume Initialization:")
				col.itemR(fluid, "volume_initialization", text="")
				col.itemR(fluid, "export_animated_mesh")
				
				split.column()
				
			elif fluid.type == 'PARTICLE':
				split = layout.split(percentage=0.5)
				
				col = split.column()
				col.itemL(text="Influence:")
				col.itemR(fluid, "particle_influence", text="Size")
				col.itemR(fluid, "alpha_influence", text="Alpha")
				
				col = split.column()
				col.itemL(text="Type:")
				col.itemR(fluid, "drops")
				col.itemR(fluid, "floats")
				col = split.column()
				col.itemL()
				col.itemR(fluid, "tracer")
				
				layout.itemR(fluid, "path", text="")
				
			elif fluid.type == 'CONTROL':
				split = layout.split()
				
				col = split.column()
				col.itemL(text="")
				col.itemR(fluid, "quality", slider=True)
				col.itemR(fluid, "reverse_frames")
				
				col = split.column()
				col.itemL(text="Time:")
				sub = col.column(align=True)
				sub.itemR(fluid, "start_time", text="Start")
				sub.itemR(fluid, "end_time", text="End")
				
				split = layout.split()
				
				col = split.column()
				col.itemL(text="Attraction Force:")
				sub = col.column(align=True)
				sub.itemR(fluid, "attraction_strength", text="Strength")
				sub.itemR(fluid, "attraction_radius", text="Radius")
				
				col = split.column()
				col.itemL(text="Velocity Force:")
				sub = col.column(align=True)
				sub.itemR(fluid, "velocity_strength", text="Strength")
				sub.itemR(fluid, "velocity_radius", text="Radius")

class PHYSICS_PT_domain_gravity(PhysicButtonsPanel):
	__label__ = "Domain World"
	__default_closed__ = True
	
	def poll(self, context):
		md = context.fluid
		if md:
			return (md.settings.type == 'DOMAIN')

	def draw(self, context):
		layout = self.layout
		
		fluid = context.fluid.settings
		
		split = layout.split()
		
		col = split.column()
		col.itemL(text="Gravity:")
		col.itemR(fluid, "gravity", text="")
		col.itemL(text="Real World Size:")
		col.itemR(fluid, "real_world_size", text="Metres")
		
		col = split.column()
		col.itemL(text="Viscosity Presets:")
		sub = col.column(align=True)
		sub.itemR(fluid, "viscosity_preset", text="")
		
		if fluid.viscosity_preset == 'MANUAL':
			sub.itemR(fluid, "viscosity_base", text="Base")
			sub.itemR(fluid, "viscosity_exponent", text="Exponent", slider=True)
		else:
			sub.itemL()
			sub.itemL()
			
		col.itemL(text="Optimization:")
		sub = col.column(align=True)
		sub.itemR(fluid, "grid_levels", slider=True)
		sub.itemR(fluid, "compressibility", slider=True)
	
class PHYSICS_PT_domain_boundary(PhysicButtonsPanel):
	__label__ = "Domain Boundary"
	__default_closed__ = True
	
	def poll(self, context):
		md = context.fluid
		if md:
			return (md.settings.type == 'DOMAIN')

	def draw(self, context):
		layout = self.layout
		
		fluid = context.fluid.settings
		
		split = layout.split()
		
		col = split.column()
		col.itemL(text="Slip Type:")
		sub = col.column(align=True)
		sub.itemR(fluid, "slip_type", text="")
		if fluid.slip_type == 'PARTIALSLIP':
			sub.itemR(fluid, "partial_slip_factor", slider=True, text="Amount")

		col = split.column()
		col.itemL(text="Surface:")
		sub = col.column(align=True)
		sub.itemR(fluid, "surface_smoothing", text="Smoothing")
		sub.itemR(fluid, "surface_subdivisions", text="Subdivisions")	
		
class PHYSICS_PT_domain_particles(PhysicButtonsPanel):
	__label__ = "Domain Particles"
	__default_closed__ = True
	
	def poll(self, context):
		md = context.fluid
		if md:
			return (md.settings.type == 'DOMAIN')
			
	def draw(self, context):
		layout = self.layout
		
		fluid = context.fluid.settings
		
		col = layout.column(align=True)
		col.itemR(fluid, "tracer_particles")
		col.itemR(fluid, "generate_particles")

bpy.types.register(PHYSICS_PT_fluid)
bpy.types.register(PHYSICS_PT_domain_gravity)
bpy.types.register(PHYSICS_PT_domain_boundary)
bpy.types.register(PHYSICS_PT_domain_particles)