2009-11-01 15:21:20 +00:00
|
|
|
# ##### BEGIN GPL LICENSE BLOCK #####
|
|
|
|
#
|
|
|
|
# This program is free software; you can redistribute it and/or
|
|
|
|
# modify it under the terms of the GNU General Public License
|
|
|
|
# as published by the Free Software Foundation; either version 2
|
|
|
|
# of the License, or (at your option) any later version.
|
2009-11-03 07:23:02 +00:00
|
|
|
#
|
2009-11-01 15:21:20 +00:00
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
2009-11-03 07:23:02 +00:00
|
|
|
#
|
2009-11-01 15:21:20 +00:00
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with this program; if not, write to the Free Software Foundation,
|
2010-02-12 13:34:04 +00:00
|
|
|
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
2009-11-01 15:21:20 +00:00
|
|
|
#
|
|
|
|
# ##### END GPL LICENSE BLOCK #####
|
2009-10-31 20:16:59 +00:00
|
|
|
|
2009-10-31 23:35:56 +00:00
|
|
|
# <pep8 compliant>
|
2009-07-02 19:41:31 +00:00
|
|
|
import bpy
|
2012-04-15 21:02:08 +00:00
|
|
|
from bpy.types import Panel, Menu
|
2013-02-10 10:29:38 +00:00
|
|
|
from bpy.app.translations import pgettext_iface as iface_
|
2013-02-10 09:09:26 +00:00
|
|
|
|
2012-04-20 18:50:18 +00:00
|
|
|
|
2012-04-15 21:02:08 +00:00
|
|
|
class FLUID_MT_presets(Menu):
|
|
|
|
bl_label = "Fluid Presets"
|
|
|
|
preset_subdir = "fluid"
|
|
|
|
preset_operator = "script.execute_preset"
|
|
|
|
draw = Menu.draw_preset
|
2009-10-31 23:35:56 +00:00
|
|
|
|
2011-09-20 18:29:19 +00:00
|
|
|
|
2010-08-02 02:55:12 +00:00
|
|
|
class PhysicButtonsPanel():
|
2009-10-31 19:31:45 +00:00
|
|
|
bl_space_type = 'PROPERTIES'
|
|
|
|
bl_region_type = 'WINDOW'
|
|
|
|
bl_context = "physics"
|
|
|
|
|
2010-08-09 01:37:09 +00:00
|
|
|
@classmethod
|
|
|
|
def poll(cls, context):
|
2009-10-31 19:31:45 +00:00
|
|
|
ob = context.object
|
2010-02-23 12:48:35 +00:00
|
|
|
rd = context.scene.render
|
2011-01-23 14:04:31 +00:00
|
|
|
return (ob and ob.type == 'MESH') and (not rd.use_game_engine) and (context.fluid)
|
2009-10-31 19:31:45 +00:00
|
|
|
|
2009-10-31 23:35:56 +00:00
|
|
|
|
2011-08-12 06:57:00 +00:00
|
|
|
class PHYSICS_PT_fluid(PhysicButtonsPanel, Panel):
|
2011-09-15 13:20:18 +00:00
|
|
|
bl_label = "Fluid"
|
2009-10-31 19:31:45 +00:00
|
|
|
|
|
|
|
def draw(self, context):
|
|
|
|
layout = self.layout
|
|
|
|
|
|
|
|
md = context.fluid
|
2011-11-10 19:10:23 +00:00
|
|
|
fluid = md.settings
|
|
|
|
|
2012-03-08 10:13:31 +00:00
|
|
|
col = layout.column()
|
2013-03-23 06:55:59 +00:00
|
|
|
if not bpy.app.build_options.mod_fluid:
|
2012-03-08 10:13:31 +00:00
|
|
|
col.label("Built without fluids")
|
2011-11-10 19:10:23 +00:00
|
|
|
return
|
|
|
|
|
2012-03-08 10:13:31 +00:00
|
|
|
col.prop(fluid, "type")
|
2012-04-21 22:09:09 +00:00
|
|
|
if fluid.type not in {'NONE', 'DOMAIN', 'PARTICLE', 'FLUID', 'OBSTACLE'}:
|
2012-03-08 10:13:31 +00:00
|
|
|
col.prop(fluid, "use")
|
2011-11-10 19:10:23 +00:00
|
|
|
|
|
|
|
layout = layout.column()
|
2012-04-21 22:09:09 +00:00
|
|
|
if fluid.type not in {'NONE', 'DOMAIN', 'PARTICLE', 'FLUID', 'OBSTACLE'}:
|
2011-11-10 19:10:23 +00:00
|
|
|
layout.active = fluid.use
|
|
|
|
|
|
|
|
if fluid.type == 'DOMAIN':
|
2012-01-14 06:30:27 +00:00
|
|
|
# odd formatting here so translation script can extract string
|
2013-02-10 10:29:38 +00:00
|
|
|
layout.operator("fluid.bake", text=iface_("Bake (Req. Memory: %s)") % fluid.memory_estimate,
|
2013-02-09 18:26:40 +00:00
|
|
|
translate=False, icon='MOD_FLUIDSIM')
|
2013-06-27 03:05:19 +00:00
|
|
|
|
2013-04-28 16:52:51 +00:00
|
|
|
if bpy.app.build_options.openmp:
|
|
|
|
layout.prop(fluid, "threads", text="Simulation Threads")
|
2013-06-27 03:05:19 +00:00
|
|
|
|
2011-11-10 19:10:23 +00:00
|
|
|
split = layout.split()
|
2009-10-31 19:31:45 +00:00
|
|
|
|
2011-11-10 19:10:23 +00:00
|
|
|
col = split.column()
|
|
|
|
col.label(text="Resolution:")
|
|
|
|
col.prop(fluid, "resolution", text="Final")
|
|
|
|
col.label(text="Render Display:")
|
|
|
|
col.prop(fluid, "render_display_mode", text="")
|
|
|
|
|
|
|
|
col = split.column()
|
|
|
|
col.label()
|
|
|
|
col.prop(fluid, "preview_resolution", text="Preview")
|
|
|
|
col.label(text="Viewport Display:")
|
|
|
|
col.prop(fluid, "viewport_display_mode", text="")
|
|
|
|
|
|
|
|
split = layout.split()
|
|
|
|
|
|
|
|
col = split.column()
|
|
|
|
col.label(text="Time:")
|
|
|
|
sub = col.column(align=True)
|
|
|
|
sub.prop(fluid, "start_time", text="Start")
|
|
|
|
sub.prop(fluid, "end_time", text="End")
|
2012-01-22 03:42:49 +00:00
|
|
|
col.prop(fluid, "simulation_rate", text="Speed")
|
2011-11-10 19:10:23 +00:00
|
|
|
|
|
|
|
col = split.column()
|
|
|
|
col.label()
|
2013-03-01 19:07:28 +00:00
|
|
|
sub = col.column(align=True)
|
|
|
|
sub.prop(fluid, "use_speed_vectors")
|
|
|
|
sub.prop(fluid, "use_reverse_frames")
|
2012-02-01 15:58:26 +00:00
|
|
|
col.prop(fluid, "frame_offset", text="Offset")
|
2011-11-10 19:10:23 +00:00
|
|
|
|
|
|
|
layout.prop(fluid, "filepath", text="")
|
|
|
|
|
|
|
|
elif fluid.type == 'FLUID':
|
|
|
|
split = layout.split()
|
|
|
|
|
|
|
|
col = split.column()
|
|
|
|
col.label(text="Volume Initialization:")
|
|
|
|
col.prop(fluid, "volume_initialization", text="")
|
|
|
|
col.prop(fluid, "use_animated_mesh")
|
|
|
|
|
|
|
|
col = split.column()
|
|
|
|
col.label(text="Initial Velocity:")
|
|
|
|
col.prop(fluid, "initial_velocity", text="")
|
|
|
|
|
|
|
|
elif fluid.type == 'OBSTACLE':
|
|
|
|
split = layout.split()
|
|
|
|
|
|
|
|
col = split.column()
|
|
|
|
col.label(text="Volume Initialization:")
|
|
|
|
col.prop(fluid, "volume_initialization", text="")
|
|
|
|
col.prop(fluid, "use_animated_mesh")
|
|
|
|
|
|
|
|
col = split.column()
|
2012-07-03 12:40:19 +00:00
|
|
|
subsplit = col.split()
|
|
|
|
subcol = subsplit.column()
|
|
|
|
if fluid.use_animated_mesh:
|
|
|
|
subcol.enabled = False
|
|
|
|
subcol.label(text="Slip Type:")
|
|
|
|
subcol.prop(fluid, "slip_type", text="")
|
2011-11-10 19:10:23 +00:00
|
|
|
if fluid.slip_type == 'PARTIALSLIP':
|
2012-07-03 12:40:19 +00:00
|
|
|
subcol.prop(fluid, "partial_slip_factor", slider=True, text="Amount")
|
2011-11-10 19:10:23 +00:00
|
|
|
|
|
|
|
col.label(text="Impact:")
|
|
|
|
col.prop(fluid, "impact_factor", text="Factor")
|
|
|
|
|
|
|
|
elif fluid.type == 'INFLOW':
|
|
|
|
split = layout.split()
|
|
|
|
|
|
|
|
col = split.column()
|
|
|
|
col.label(text="Volume Initialization:")
|
|
|
|
col.prop(fluid, "volume_initialization", text="")
|
|
|
|
col.prop(fluid, "use_animated_mesh")
|
|
|
|
row = col.row()
|
|
|
|
row.active = not fluid.use_animated_mesh
|
|
|
|
row.prop(fluid, "use_local_coords")
|
|
|
|
|
|
|
|
col = split.column()
|
|
|
|
col.label(text="Inflow Velocity:")
|
|
|
|
col.prop(fluid, "inflow_velocity", text="")
|
|
|
|
|
|
|
|
elif fluid.type == 'OUTFLOW':
|
2012-03-08 10:13:31 +00:00
|
|
|
col = layout.column()
|
2011-11-10 19:10:23 +00:00
|
|
|
col.label(text="Volume Initialization:")
|
|
|
|
col.prop(fluid, "volume_initialization", text="")
|
|
|
|
col.prop(fluid, "use_animated_mesh")
|
|
|
|
|
|
|
|
elif fluid.type == 'PARTICLE':
|
|
|
|
split = layout.split()
|
|
|
|
|
|
|
|
col = split.column()
|
|
|
|
col.label(text="Influence:")
|
|
|
|
col.prop(fluid, "particle_influence", text="Size")
|
|
|
|
col.prop(fluid, "alpha_influence", text="Alpha")
|
|
|
|
|
|
|
|
col = split.column()
|
|
|
|
col.label(text="Type:")
|
|
|
|
col.prop(fluid, "use_drops")
|
|
|
|
col.prop(fluid, "use_floats")
|
|
|
|
col.prop(fluid, "show_tracer")
|
|
|
|
|
|
|
|
layout.prop(fluid, "filepath", text="")
|
|
|
|
|
|
|
|
elif fluid.type == 'CONTROL':
|
|
|
|
split = layout.split()
|
|
|
|
|
|
|
|
col = split.column()
|
|
|
|
col.label(text="")
|
|
|
|
col.prop(fluid, "quality", slider=True)
|
|
|
|
col.prop(fluid, "use_reverse_frames")
|
|
|
|
|
|
|
|
col = split.column()
|
|
|
|
col.label(text="Time:")
|
|
|
|
sub = col.column(align=True)
|
|
|
|
sub.prop(fluid, "start_time", text="Start")
|
|
|
|
sub.prop(fluid, "end_time", text="End")
|
|
|
|
|
|
|
|
split = layout.split()
|
|
|
|
|
|
|
|
col = split.column()
|
|
|
|
col.label(text="Attraction Force:")
|
|
|
|
sub = col.column(align=True)
|
|
|
|
sub.prop(fluid, "attraction_strength", text="Strength")
|
|
|
|
sub.prop(fluid, "attraction_radius", text="Radius")
|
|
|
|
|
|
|
|
col = split.column()
|
|
|
|
col.label(text="Velocity Force:")
|
|
|
|
sub = col.column(align=True)
|
|
|
|
sub.prop(fluid, "velocity_strength", text="Strength")
|
|
|
|
sub.prop(fluid, "velocity_radius", text="Radius")
|
2009-07-02 19:41:31 +00:00
|
|
|
|
2009-10-31 23:35:56 +00:00
|
|
|
|
2011-08-12 06:57:00 +00:00
|
|
|
class PHYSICS_PT_domain_gravity(PhysicButtonsPanel, Panel):
|
2012-06-08 15:24:28 +00:00
|
|
|
bl_label = "Fluid World"
|
2010-08-26 01:05:37 +00:00
|
|
|
bl_options = {'DEFAULT_CLOSED'}
|
2009-10-31 19:31:45 +00:00
|
|
|
|
2010-08-09 01:37:09 +00:00
|
|
|
@classmethod
|
|
|
|
def poll(cls, context):
|
2009-10-31 19:31:45 +00:00
|
|
|
md = context.fluid
|
2012-06-08 15:24:28 +00:00
|
|
|
rd = context.scene.render
|
|
|
|
return md and md.settings and (md.settings.type == 'DOMAIN') and (not rd.use_game_engine)
|
2009-10-31 19:31:45 +00:00
|
|
|
|
|
|
|
def draw(self, context):
|
|
|
|
layout = self.layout
|
|
|
|
|
|
|
|
fluid = context.fluid.settings
|
2010-03-25 06:27:25 +00:00
|
|
|
scene = context.scene
|
2009-10-31 19:31:45 +00:00
|
|
|
|
|
|
|
split = layout.split()
|
|
|
|
|
|
|
|
col = split.column()
|
2010-03-25 06:27:25 +00:00
|
|
|
if scene.use_gravity:
|
2011-11-08 01:32:34 +00:00
|
|
|
col.label(text="Use Scene Gravity", icon='SCENE_DATA')
|
2010-03-25 06:27:25 +00:00
|
|
|
sub = col.column()
|
|
|
|
sub.enabled = False
|
|
|
|
sub.prop(fluid, "gravity", text="")
|
|
|
|
else:
|
2011-09-21 15:18:38 +00:00
|
|
|
col.label(text="Gravity:")
|
2010-03-25 06:27:25 +00:00
|
|
|
col.prop(fluid, "gravity", text="")
|
2010-04-04 14:52:15 +00:00
|
|
|
|
2010-03-25 06:27:25 +00:00
|
|
|
if scene.unit_settings.system != 'NONE':
|
2011-11-08 01:32:34 +00:00
|
|
|
col.label(text="Use Scene Size Units", icon='SCENE_DATA')
|
2010-03-25 06:27:25 +00:00
|
|
|
sub = col.column()
|
|
|
|
sub.enabled = False
|
2012-07-04 15:52:07 +00:00
|
|
|
sub.prop(fluid, "simulation_scale", text="Meters")
|
2010-03-25 06:27:25 +00:00
|
|
|
else:
|
2011-09-21 15:18:38 +00:00
|
|
|
col.label(text="Real World Size:")
|
2012-07-04 15:52:07 +00:00
|
|
|
col.prop(fluid, "simulation_scale", text="Meters")
|
2009-10-31 19:31:45 +00:00
|
|
|
|
2010-08-06 15:17:44 +00:00
|
|
|
col = split.column()
|
2011-09-21 15:18:38 +00:00
|
|
|
col.label(text="Viscosity Presets:")
|
2012-04-15 21:02:08 +00:00
|
|
|
sub = col.row(align=True)
|
|
|
|
sub.menu("FLUID_MT_presets", text=bpy.types.FLUID_MT_presets.bl_label)
|
|
|
|
sub.operator("fluid.preset_add", text="", icon='ZOOMIN')
|
|
|
|
sub.operator("fluid.preset_add", text="", icon='ZOOMOUT').remove_active = True
|
2012-04-20 18:50:18 +00:00
|
|
|
|
2013-08-23 20:41:21 +00:00
|
|
|
sub = col.column(align=True)
|
|
|
|
sub.prop(fluid, "viscosity_base", text="Base")
|
|
|
|
sub.prop(fluid, "viscosity_exponent", text="Exponent", slider=True)
|
2009-10-31 19:31:45 +00:00
|
|
|
|
2011-09-21 15:18:38 +00:00
|
|
|
col.label(text="Optimization:")
|
2009-11-23 00:27:30 +00:00
|
|
|
col.prop(fluid, "grid_levels", slider=True)
|
|
|
|
col.prop(fluid, "compressibility", slider=True)
|
2009-10-31 19:31:45 +00:00
|
|
|
|
2009-10-31 23:35:56 +00:00
|
|
|
|
2011-08-12 06:57:00 +00:00
|
|
|
class PHYSICS_PT_domain_boundary(PhysicButtonsPanel, Panel):
|
2012-06-08 15:24:28 +00:00
|
|
|
bl_label = "Fluid Boundary"
|
2010-08-26 01:05:37 +00:00
|
|
|
bl_options = {'DEFAULT_CLOSED'}
|
2009-10-31 19:31:45 +00:00
|
|
|
|
2010-08-09 01:37:09 +00:00
|
|
|
@classmethod
|
|
|
|
def poll(cls, context):
|
2009-10-31 19:31:45 +00:00
|
|
|
md = context.fluid
|
2012-06-08 15:24:28 +00:00
|
|
|
rd = context.scene.render
|
|
|
|
return md and md.settings and (md.settings.type == 'DOMAIN') and (not rd.use_game_engine)
|
2009-10-31 19:31:45 +00:00
|
|
|
|
|
|
|
def draw(self, context):
|
|
|
|
layout = self.layout
|
|
|
|
|
|
|
|
fluid = context.fluid.settings
|
|
|
|
|
|
|
|
split = layout.split()
|
|
|
|
|
|
|
|
col = split.column()
|
2011-09-21 15:18:38 +00:00
|
|
|
col.label(text="Slip Type:")
|
2009-11-23 00:27:30 +00:00
|
|
|
col.prop(fluid, "slip_type", text="")
|
2009-10-31 19:31:45 +00:00
|
|
|
if fluid.slip_type == 'PARTIALSLIP':
|
2011-09-21 15:18:38 +00:00
|
|
|
col.prop(fluid, "partial_slip_factor", slider=True, text="Amount")
|
2013-04-23 07:06:29 +00:00
|
|
|
col.prop(fluid, "use_surface_noobs")
|
2009-10-31 19:31:45 +00:00
|
|
|
|
2010-08-06 15:17:44 +00:00
|
|
|
col = split.column()
|
2011-09-21 15:18:38 +00:00
|
|
|
col.label(text="Surface:")
|
|
|
|
col.prop(fluid, "surface_smooth", text="Smoothing")
|
|
|
|
col.prop(fluid, "surface_subdivisions", text="Subdivisions")
|
2009-10-31 19:31:45 +00:00
|
|
|
|
2009-10-31 23:35:56 +00:00
|
|
|
|
2011-08-12 06:57:00 +00:00
|
|
|
class PHYSICS_PT_domain_particles(PhysicButtonsPanel, Panel):
|
2012-06-08 15:24:28 +00:00
|
|
|
bl_label = "Fluid Particles"
|
2010-08-26 01:05:37 +00:00
|
|
|
bl_options = {'DEFAULT_CLOSED'}
|
2009-10-31 19:31:45 +00:00
|
|
|
|
2010-08-09 01:37:09 +00:00
|
|
|
@classmethod
|
|
|
|
def poll(cls, context):
|
2009-10-31 19:31:45 +00:00
|
|
|
md = context.fluid
|
2012-06-08 15:24:28 +00:00
|
|
|
rd = context.scene.render
|
|
|
|
return md and md.settings and (md.settings.type == 'DOMAIN') and (not rd.use_game_engine)
|
2009-10-31 19:31:45 +00:00
|
|
|
|
|
|
|
def draw(self, context):
|
|
|
|
layout = self.layout
|
|
|
|
|
|
|
|
fluid = context.fluid.settings
|
|
|
|
|
2013-03-01 19:07:28 +00:00
|
|
|
row = layout.row()
|
|
|
|
row.prop(fluid, "tracer_particles", text="Tracer")
|
|
|
|
row.prop(fluid, "generate_particles", text="Generate")
|
2011-04-04 10:13:04 +00:00
|
|
|
|
|
|
|
if __name__ == "__main__": # only for live edit.
|
|
|
|
bpy.utils.register_module(__name__)
|