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
|
|
|
|
|
2009-10-31 23:35:56 +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
|
|
|
|
2010-08-02 02:55:12 +00:00
|
|
|
class PHYSICS_PT_fluid(PhysicButtonsPanel, bpy.types.Panel):
|
2009-10-31 19:31:45 +00:00
|
|
|
bl_label = "Fluid"
|
|
|
|
|
|
|
|
def draw(self, context):
|
|
|
|
layout = self.layout
|
|
|
|
|
|
|
|
md = context.fluid
|
|
|
|
|
|
|
|
if md:
|
|
|
|
fluid = md.settings
|
2011-02-10 14:59:17 +00:00
|
|
|
|
2010-08-06 15:17:44 +00:00
|
|
|
row = layout.row()
|
2010-09-21 16:31:37 +00:00
|
|
|
if fluid is None:
|
|
|
|
row.label("built without fluids")
|
|
|
|
return
|
|
|
|
|
2010-08-06 15:17:44 +00:00
|
|
|
row.prop(fluid, "type")
|
2011-03-07 13:23:45 +00:00
|
|
|
if fluid.type not in {'NONE', 'DOMAIN', 'PARTICLE', 'FLUID'}:
|
2010-08-18 07:14:10 +00:00
|
|
|
row.prop(fluid, "use", text="")
|
2010-04-04 14:52:15 +00:00
|
|
|
|
2010-03-25 06:27:25 +00:00
|
|
|
layout = layout.column()
|
2011-03-07 13:23:45 +00:00
|
|
|
if fluid.type not in {'NONE', 'DOMAIN', 'PARTICLE', 'FLUID'}:
|
2010-08-19 10:16:30 +00:00
|
|
|
layout.active = fluid.use
|
2010-04-04 14:52:15 +00:00
|
|
|
|
2009-10-31 19:31:45 +00:00
|
|
|
if fluid.type == 'DOMAIN':
|
2010-08-31 12:54:17 +00:00
|
|
|
layout.operator("fluid.bake", text="Bake (Req. Memory: %s)" % fluid.memory_estimate, icon='MOD_FLUIDSIM')
|
2009-10-31 19:31:45 +00:00
|
|
|
split = layout.split()
|
|
|
|
|
|
|
|
col = split.column()
|
2009-11-23 00:27:30 +00:00
|
|
|
col.label(text="Resolution:")
|
|
|
|
col.prop(fluid, "resolution", text="Final")
|
|
|
|
col.label(text="Render Display:")
|
|
|
|
col.prop(fluid, "render_display_mode", text="")
|
2009-10-31 19:31:45 +00:00
|
|
|
|
2010-08-06 15:17:44 +00:00
|
|
|
col = split.column()
|
2010-08-31 12:54:17 +00:00
|
|
|
col.label()
|
2009-11-23 00:27:30 +00:00
|
|
|
col.prop(fluid, "preview_resolution", text="Preview")
|
|
|
|
col.label(text="Viewport Display:")
|
|
|
|
col.prop(fluid, "viewport_display_mode", text="")
|
2009-11-19 12:58:19 +00:00
|
|
|
|
|
|
|
split = layout.split()
|
|
|
|
|
|
|
|
col = split.column()
|
2009-11-23 00:27:30 +00:00
|
|
|
col.label(text="Time:")
|
2009-11-19 12:58:19 +00:00
|
|
|
sub = col.column(align=True)
|
2009-11-23 00:27:30 +00:00
|
|
|
sub.prop(fluid, "start_time", text="Start")
|
|
|
|
sub.prop(fluid, "end_time", text="End")
|
2009-11-19 12:58:19 +00:00
|
|
|
|
2010-08-06 15:17:44 +00:00
|
|
|
col = split.column()
|
|
|
|
col.label()
|
2010-08-20 06:09:58 +00:00
|
|
|
col.prop(fluid, "use_speed_vectors")
|
|
|
|
col.prop(fluid, "use_reverse_frames")
|
2009-10-31 19:31:45 +00:00
|
|
|
|
2010-08-19 15:49:30 +00:00
|
|
|
layout.prop(fluid, "filepath", text="")
|
2009-10-31 19:31:45 +00:00
|
|
|
|
|
|
|
elif fluid.type == 'FLUID':
|
|
|
|
split = layout.split()
|
|
|
|
|
|
|
|
col = split.column()
|
2009-11-23 00:27:30 +00:00
|
|
|
col.label(text="Volume Initialization:")
|
|
|
|
col.prop(fluid, "volume_initialization", text="")
|
2010-08-20 06:09:58 +00:00
|
|
|
col.prop(fluid, "use_animated_mesh")
|
2009-11-21 00:05:43 +00:00
|
|
|
|
2010-08-06 15:17:44 +00:00
|
|
|
col = split.column()
|
2009-11-23 00:27:30 +00:00
|
|
|
col.label(text="Initial Velocity:")
|
|
|
|
col.prop(fluid, "initial_velocity", text="")
|
2009-10-31 19:31:45 +00:00
|
|
|
|
|
|
|
elif fluid.type == 'OBSTACLE':
|
|
|
|
split = layout.split()
|
|
|
|
|
|
|
|
col = split.column()
|
2009-11-23 00:27:30 +00:00
|
|
|
col.label(text="Volume Initialization:")
|
|
|
|
col.prop(fluid, "volume_initialization", text="")
|
2010-08-20 06:09:58 +00:00
|
|
|
col.prop(fluid, "use_animated_mesh")
|
2009-10-31 19:31:45 +00:00
|
|
|
|
2010-08-06 15:17:44 +00:00
|
|
|
col = split.column()
|
2009-11-23 00:27:30 +00:00
|
|
|
col.label(text="Slip Type:")
|
|
|
|
col.prop(fluid, "slip_type", text="")
|
2009-10-31 19:31:45 +00:00
|
|
|
if fluid.slip_type == 'PARTIALSLIP':
|
2009-11-23 00:27:30 +00:00
|
|
|
col.prop(fluid, "partial_slip_factor", slider=True, text="Amount")
|
2009-10-31 19:31:45 +00:00
|
|
|
|
2009-11-23 00:27:30 +00:00
|
|
|
col.label(text="Impact:")
|
|
|
|
col.prop(fluid, "impact_factor", text="Factor")
|
2009-10-31 19:31:45 +00:00
|
|
|
|
|
|
|
elif fluid.type == 'INFLOW':
|
|
|
|
split = layout.split()
|
|
|
|
|
|
|
|
col = split.column()
|
2009-11-23 00:27:30 +00:00
|
|
|
col.label(text="Volume Initialization:")
|
|
|
|
col.prop(fluid, "volume_initialization", text="")
|
2010-08-20 06:09:58 +00:00
|
|
|
col.prop(fluid, "use_animated_mesh")
|
2011-03-24 17:17:44 +00:00
|
|
|
row = col.row()
|
|
|
|
row.active = not fluid.use_animated_mesh
|
|
|
|
row.prop(fluid, "use_local_coords")
|
2009-10-31 19:31:45 +00:00
|
|
|
|
2010-08-06 15:17:44 +00:00
|
|
|
col = split.column()
|
2009-11-23 00:27:30 +00:00
|
|
|
col.label(text="Inflow Velocity:")
|
|
|
|
col.prop(fluid, "inflow_velocity", text="")
|
2009-10-31 19:31:45 +00:00
|
|
|
|
|
|
|
elif fluid.type == 'OUTFLOW':
|
|
|
|
split = layout.split()
|
|
|
|
|
|
|
|
col = split.column()
|
2009-11-23 00:27:30 +00:00
|
|
|
col.label(text="Volume Initialization:")
|
|
|
|
col.prop(fluid, "volume_initialization", text="")
|
2010-08-20 06:09:58 +00:00
|
|
|
col.prop(fluid, "use_animated_mesh")
|
2009-10-31 19:31:45 +00:00
|
|
|
|
2010-08-06 15:17:44 +00:00
|
|
|
split.column()
|
2009-10-31 19:31:45 +00:00
|
|
|
|
|
|
|
elif fluid.type == 'PARTICLE':
|
2009-11-19 12:58:19 +00:00
|
|
|
split = layout.split()
|
2009-10-31 19:31:45 +00:00
|
|
|
|
|
|
|
col = split.column()
|
2009-11-23 00:27:30 +00:00
|
|
|
col.label(text="Influence:")
|
|
|
|
col.prop(fluid, "particle_influence", text="Size")
|
|
|
|
col.prop(fluid, "alpha_influence", text="Alpha")
|
2009-10-31 19:31:45 +00:00
|
|
|
|
2010-08-06 15:17:44 +00:00
|
|
|
col = split.column()
|
2009-11-23 00:27:30 +00:00
|
|
|
col.label(text="Type:")
|
2010-08-20 06:09:58 +00:00
|
|
|
col.prop(fluid, "use_drops")
|
|
|
|
col.prop(fluid, "use_floats")
|
2010-08-17 17:03:52 +00:00
|
|
|
col.prop(fluid, "show_tracer")
|
2009-10-31 19:31:45 +00:00
|
|
|
|
2010-08-19 15:49:30 +00:00
|
|
|
layout.prop(fluid, "filepath", text="")
|
2009-10-31 19:31:45 +00:00
|
|
|
|
|
|
|
elif fluid.type == 'CONTROL':
|
|
|
|
split = layout.split()
|
|
|
|
|
|
|
|
col = split.column()
|
2009-11-23 00:27:30 +00:00
|
|
|
col.label(text="")
|
|
|
|
col.prop(fluid, "quality", slider=True)
|
2010-08-20 06:09:58 +00:00
|
|
|
col.prop(fluid, "use_reverse_frames")
|
2009-10-31 19:31:45 +00:00
|
|
|
|
2010-08-06 15:17:44 +00:00
|
|
|
col = split.column()
|
2009-11-23 00:27:30 +00:00
|
|
|
col.label(text="Time:")
|
2009-10-31 19:31:45 +00:00
|
|
|
sub = col.column(align=True)
|
2009-11-23 00:27:30 +00:00
|
|
|
sub.prop(fluid, "start_time", text="Start")
|
|
|
|
sub.prop(fluid, "end_time", text="End")
|
2009-10-31 19:31:45 +00:00
|
|
|
|
|
|
|
split = layout.split()
|
|
|
|
|
|
|
|
col = split.column()
|
2009-11-23 00:27:30 +00:00
|
|
|
col.label(text="Attraction Force:")
|
2009-10-31 19:31:45 +00:00
|
|
|
sub = col.column(align=True)
|
2009-11-23 00:27:30 +00:00
|
|
|
sub.prop(fluid, "attraction_strength", text="Strength")
|
|
|
|
sub.prop(fluid, "attraction_radius", text="Radius")
|
2009-10-31 19:31:45 +00:00
|
|
|
|
2010-08-06 15:17:44 +00:00
|
|
|
col = split.column()
|
2009-11-23 00:27:30 +00:00
|
|
|
col.label(text="Velocity Force:")
|
2009-10-31 19:31:45 +00:00
|
|
|
sub = col.column(align=True)
|
2009-11-23 00:27:30 +00:00
|
|
|
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
|
|
|
|
2010-08-02 02:55:12 +00:00
|
|
|
class PHYSICS_PT_domain_gravity(PhysicButtonsPanel, bpy.types.Panel):
|
2009-10-31 19:31:45 +00:00
|
|
|
bl_label = "Domain 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
|
2010-08-05 16:05:30 +00:00
|
|
|
return md and md.settings and (md.settings.type == 'DOMAIN')
|
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:
|
|
|
|
col.label(text="Using Scene Gravity", icon="SCENE_DATA")
|
|
|
|
sub = col.column()
|
|
|
|
sub.enabled = False
|
|
|
|
sub.prop(fluid, "gravity", text="")
|
|
|
|
else:
|
|
|
|
col.label(text="Gravity:")
|
|
|
|
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':
|
|
|
|
col.label(text="Using Scene Size Units", icon="SCENE_DATA")
|
|
|
|
sub = col.column()
|
|
|
|
sub.enabled = False
|
2010-08-20 06:09:58 +00:00
|
|
|
sub.prop(fluid, "simulation_scale", text="Metres")
|
2010-03-25 06:27:25 +00:00
|
|
|
else:
|
|
|
|
col.label(text="Real World Size:")
|
2010-08-20 06:09:58 +00:00
|
|
|
col.prop(fluid, "simulation_scale", text="Metres")
|
2009-10-31 19:31:45 +00:00
|
|
|
|
2010-08-06 15:17:44 +00:00
|
|
|
col = split.column()
|
2009-11-23 00:27:30 +00:00
|
|
|
col.label(text="Viscosity Presets:")
|
2009-10-31 19:31:45 +00:00
|
|
|
sub = col.column(align=True)
|
2009-11-23 00:27:30 +00:00
|
|
|
sub.prop(fluid, "viscosity_preset", text="")
|
2009-10-31 19:31:45 +00:00
|
|
|
|
|
|
|
if fluid.viscosity_preset == 'MANUAL':
|
2009-11-23 00:27:30 +00:00
|
|
|
sub.prop(fluid, "viscosity_base", text="Base")
|
|
|
|
sub.prop(fluid, "viscosity_exponent", text="Exponent", slider=True)
|
2009-10-31 19:31:45 +00:00
|
|
|
|
2009-11-23 00:27:30 +00:00
|
|
|
col.label(text="Optimization:")
|
|
|
|
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
|
|
|
|
2010-08-02 02:55:12 +00:00
|
|
|
class PHYSICS_PT_domain_boundary(PhysicButtonsPanel, bpy.types.Panel):
|
2009-10-31 19:31:45 +00:00
|
|
|
bl_label = "Domain 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
|
2010-08-05 16:05:30 +00:00
|
|
|
return md and md.settings and (md.settings.type == 'DOMAIN')
|
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()
|
2009-11-23 00:27:30 +00:00
|
|
|
col.label(text="Slip Type:")
|
|
|
|
col.prop(fluid, "slip_type", text="")
|
2009-10-31 19:31:45 +00:00
|
|
|
if fluid.slip_type == 'PARTIALSLIP':
|
2009-11-23 00:27:30 +00:00
|
|
|
col.prop(fluid, "partial_slip_factor", slider=True, text="Amount")
|
2009-10-31 19:31:45 +00:00
|
|
|
|
2010-08-06 15:17:44 +00:00
|
|
|
col = split.column()
|
2009-11-23 00:27:30 +00:00
|
|
|
col.label(text="Surface:")
|
2010-08-20 06:09:58 +00:00
|
|
|
col.prop(fluid, "surface_smooth", text="Smoothing")
|
2009-11-23 00:27:30 +00:00
|
|
|
col.prop(fluid, "surface_subdivisions", text="Subdivisions")
|
2009-10-31 19:31:45 +00:00
|
|
|
|
2009-10-31 23:35:56 +00:00
|
|
|
|
2010-08-02 02:55:12 +00:00
|
|
|
class PHYSICS_PT_domain_particles(PhysicButtonsPanel, bpy.types.Panel):
|
2009-10-31 19:31:45 +00:00
|
|
|
bl_label = "Domain 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
|
2010-08-05 16:05:30 +00:00
|
|
|
return md and md.settings and (md.settings.type == 'DOMAIN')
|
2009-10-31 19:31:45 +00:00
|
|
|
|
|
|
|
def draw(self, context):
|
|
|
|
layout = self.layout
|
|
|
|
|
|
|
|
fluid = context.fluid.settings
|
|
|
|
|
|
|
|
col = layout.column(align=True)
|
2009-11-23 00:27:30 +00:00
|
|
|
col.prop(fluid, "tracer_particles")
|
|
|
|
col.prop(fluid, "generate_particles")
|
2011-04-04 10:13:04 +00:00
|
|
|
|
|
|
|
if __name__ == "__main__": # only for live edit.
|
|
|
|
bpy.utils.register_module(__name__)
|