4 class PhysicButtonsPanel(bpy.types.Panel):
5 __space_type__ = "BUTTONS_WINDOW"
6 __region_type__ = "WINDOW"
7 __context__ = "physics"
9 def poll(self, context):
11 return (ob and ob.type == 'MESH')
13 class PHYSICS_PT_fluid(PhysicButtonsPanel):
14 __idname__ = "PHYSICS_PT_fluid"
17 def draw(self, context):
22 split = layout.split()
23 split.operator_context = "EXEC_DEFAULT"
26 # remove modifier + settings
27 split.set_context_pointer("modifier", md)
28 split.itemO("object.modifier_remove", text="Remove")
30 row = split.row(align=True)
31 row.itemR(md, "render", text="")
32 row.itemR(md, "realtime", text="")
38 split.item_enumO("object.modifier_add", "type", "FLUID_SIMULATION", text="Add")
46 col = layout.column(align=True)
47 col.itemR(fluid, "type")
49 if fluid.type == 'DOMAIN':
50 layout.itemO("fluid.bake", text="BAKE")
51 split = layout.split()
54 col.itemL(text="Resolution:")
56 colsub.itemR(fluid, "resolution", text="Final")
57 colsub.itemL(text="Render Display:")
58 colsub.itemR(fluid, "render_display_mode", text="")
59 col.itemL(text="Time:")
60 colsub = col.column(align=True)
61 colsub.itemR(fluid, "start_time", text="Start")
62 colsub.itemR(fluid, "end_time", text="End")
66 colsub.itemL(text="Required Memory: " + fluid.memory_estimate)
67 colsub.itemR(fluid, "preview_resolution", text="Preview")
68 colsub.itemL(text="Viewport Display:")
69 colsub.itemR(fluid, "viewport_display_mode", text="")
72 colsub.itemR(fluid, "reverse_frames")
73 colsub.itemR(fluid, "generate_speed_vectors")
75 layout.itemL(text="Path:")
76 layout.itemR(fluid, "path", text="")
78 if fluid.type == 'FLUID':
79 split = layout.split()
81 col.itemL(text="Volume Initialization:")
82 col.itemR(fluid, "volume_initialization", text="")
83 col.itemR(fluid, "export_animated_mesh")
85 col.itemL(text="Initial Velocity:")
86 col.itemR(fluid, "initial_velocity", text="")
88 if fluid.type == 'OBSTACLE':
89 split = layout.split()
91 col.itemL(text="Volume Initialization:")
92 col.itemR(fluid, "volume_initialization", text="")
93 col.itemR(fluid, "export_animated_mesh")
95 col.itemL(text="Slip Type:")
96 colsub=col.column(align=True)
97 colsub.itemR(fluid, "slip_type", text="")
98 if fluid.slip_type == 'PARTIALSLIP':
99 colsub.itemR(fluid, "partial_slip_amount", slider=True, text="Amount")
101 col.itemR(fluid, "impact_factor")
103 if fluid.type == 'INFLOW':
104 split = layout.split()
106 col.itemL(text="Volume Initialization:")
107 col.itemR(fluid, "volume_initialization", text="")
108 col.itemR(fluid, "export_animated_mesh")
109 col.itemR(fluid, "local_coordinates")
112 col.itemL(text="Inflow Velocity:")
113 col.itemR(fluid, "inflow_velocity", text="")
115 if fluid.type == 'OUTFLOW':
116 split = layout.split()
118 col.itemL(text="Volume Initialization:")
119 col.itemR(fluid, "volume_initialization", text="")
120 col.itemR(fluid, "export_animated_mesh")
123 if fluid.type == 'PARTICLE':
124 split = layout.split()
127 col.itemL(text="Influence:")
128 colsub = col.column(align=True)
129 colsub.itemR(fluid, "particle_influence", text="Size")
130 colsub.itemR(fluid, "alpha_influence", text="Alpha")
131 col.itemL(text="Path:")
133 layout.itemR(fluid, "path", text="")
136 col.itemL(text="Type:")
137 col.itemR(fluid, "drops")
138 col.itemR(fluid, "floats")
139 col.itemR(fluid, "tracer")
141 if fluid.type == 'CONTROL':
142 split = layout.split()
146 col.itemR(fluid, "quality", slider=True)
147 col.itemR(fluid, "reverse_frames")
150 col.itemL(text="Time:")
151 col=col.column(align=True)
152 col.itemR(fluid, "start_time", text="Start")
153 col.itemR(fluid, "end_time", text="End")
155 split = layout.split()
158 col.itemL(text="Attraction Force:")
159 col=col.column(align=True)
160 col.itemR(fluid, "attraction_strength", text="Strength")
161 col.itemR(fluid, "attraction_radius", text="Radius")
164 col.itemL(text="Velocity Force:")
165 col=col.column(align=True)
166 col.itemR(fluid, "velocity_strength", text="Strength")
167 col.itemR(fluid, "velocity_radius", text="Radius")
169 class PHYSICS_PT_domain_gravity(PhysicButtonsPanel):
170 __idname__ = "PHYSICS_PT_domain_gravity"
171 __label__ = "Domain World"
172 __default_closed__ = True
174 def poll(self, context):
177 settings = md.settings
179 return (settings.type == 'DOMAIN')
183 def draw(self, context):
185 fluid = context.fluid.settings
187 split = layout.split()
190 col.itemL(text="Gravity:")
191 col.itemR(fluid, "gravity", text="")
193 col.itemL(text="Real World Size:")
194 col.itemR(fluid, "real_world_size", text="Metres")
197 col.itemL(text="Viscosity Presets:")
198 colsub=col.column(align=True)
199 colsub.itemR(fluid, "viscosity_preset", text="")
201 if fluid.viscosity_preset == 'MANUAL':
202 colsub.itemR(fluid, "viscosity_base", text="Base")
203 colsub.itemR(fluid, "viscosity_exponent", text="Exponent", slider=True)
205 colsub.itemL(text="")
206 colsub.itemL(text="")
208 col.itemL(text="Optimization:")
209 col=col.column(align=True)
210 col.itemR(fluid, "grid_levels", slider=True)
211 col.itemR(fluid, "compressibility", slider=True)
213 class PHYSICS_PT_domain_boundary(PhysicButtonsPanel):
214 __idname__ = "PHYSICS_PT_domain_boundary"
215 __label__ = "Domain Boundary"
216 __default_closed__ = True
218 def poll(self, context):
221 settings = md.settings
223 return (settings.type == 'DOMAIN')
227 def draw(self, context):
229 fluid = context.fluid.settings
231 split = layout.split()
233 col.itemL(text="Slip Type:")
234 col=col.column(align=True)
235 col.itemR(fluid, "slip_type", text="")
236 if fluid.slip_type == 'PARTIALSLIP':
237 col.itemR(fluid, "partial_slip_amount", slider=True, text="Amount")
239 col.itemL(text="Surface:")
240 col=col.column(align=True)
241 col.itemR(fluid, "surface_smoothing", text="Smoothing")
242 col.itemR(fluid, "surface_subdivisions", text="Subdivisions")
244 class PHYSICS_PT_domain_particles(PhysicButtonsPanel):
245 __idname__ = "PHYSICS_PT_domain_particles"
246 __label__ = "Domain Particles"
247 __default_closed__ = True
249 def poll(self, context):
252 settings = md.settings
254 return (settings.type == 'DOMAIN')
258 def draw(self, context):
260 fluid = context.fluid.settings
262 col=layout.column(align=True)
263 col.itemR(fluid, "tracer_particles")
264 col.itemR(fluid, "generate_particles")
266 bpy.types.register(PHYSICS_PT_fluid)
267 bpy.types.register(PHYSICS_PT_domain_gravity)
268 bpy.types.register(PHYSICS_PT_domain_boundary)
269 bpy.types.register(PHYSICS_PT_domain_particles)