diff options
author | Thomas Dinges <blender@dingto.org> | 2012-04-16 01:02:08 +0400 |
---|---|---|
committer | Thomas Dinges <blender@dingto.org> | 2012-04-16 01:02:08 +0400 |
commit | 5496e87eee5951345ecb2d3f503342246fd8581e (patch) | |
tree | 296cf327a299682d45dae08f5cba69506d02cd21 /release/scripts | |
parent | 86508076d8190a374bcd9c17785eb0802dd4c1ca (diff) |
Fluid Simulation:
* Replaced the hard coded viscosity presets with Python ones.
* Added version check, so older files load fine.
Loading new files into 2.62 also works fine.
Diffstat (limited to 'release/scripts')
-rw-r--r-- | release/scripts/presets/fluid/honey.py | 3 | ||||
-rw-r--r-- | release/scripts/presets/fluid/oil.py | 3 | ||||
-rw-r--r-- | release/scripts/presets/fluid/water.py | 3 | ||||
-rw-r--r-- | release/scripts/startup/bl_operators/presets.py | 17 | ||||
-rw-r--r-- | release/scripts/startup/bl_ui/properties_physics_fluid.py | 26 |
5 files changed, 41 insertions, 11 deletions
diff --git a/release/scripts/presets/fluid/honey.py b/release/scripts/presets/fluid/honey.py new file mode 100644 index 00000000000..fbeb7f2b286 --- /dev/null +++ b/release/scripts/presets/fluid/honey.py @@ -0,0 +1,3 @@ +import bpy +bpy.context.fluid.settings.viscosity_base = 2.0 +bpy.context.fluid.settings.viscosity_exponent = 3 diff --git a/release/scripts/presets/fluid/oil.py b/release/scripts/presets/fluid/oil.py new file mode 100644 index 00000000000..3d73de9303a --- /dev/null +++ b/release/scripts/presets/fluid/oil.py @@ -0,0 +1,3 @@ +import bpy +bpy.context.fluid.settings.viscosity_base = 5.0 +bpy.context.fluid.settings.viscosity_exponent = 5 diff --git a/release/scripts/presets/fluid/water.py b/release/scripts/presets/fluid/water.py new file mode 100644 index 00000000000..0b68ad28c98 --- /dev/null +++ b/release/scripts/presets/fluid/water.py @@ -0,0 +1,3 @@ +import bpy +bpy.context.fluid.settings.viscosity_base = 1.0 +bpy.context.fluid.settings.viscosity_exponent = 6 diff --git a/release/scripts/startup/bl_operators/presets.py b/release/scripts/startup/bl_operators/presets.py index da6ef7483f2..2c92fccf3b4 100644 --- a/release/scripts/startup/bl_operators/presets.py +++ b/release/scripts/startup/bl_operators/presets.py @@ -294,6 +294,23 @@ class AddPresetCloth(AddPresetBase, Operator): preset_subdir = "cloth" +class AddPresetFluid(AddPresetBase, Operator): + '''Add a Fluid Preset''' + bl_idname = "fluid.preset_add" + bl_label = "Add Fluid Preset" + preset_menu = "FLUID_MT_presets" + + preset_defines = [ + "fluid = bpy.context.fluid" + ] + + preset_values = [ + "fluid.settings.viscosity_base", + "fluid.settings.viscosity_exponent", + ] + + preset_subdir = "fluid" + class AddPresetSunSky(AddPresetBase, Operator): '''Add a Sky & Atmosphere Preset''' diff --git a/release/scripts/startup/bl_ui/properties_physics_fluid.py b/release/scripts/startup/bl_ui/properties_physics_fluid.py index d334671292a..23b7a12753f 100644 --- a/release/scripts/startup/bl_ui/properties_physics_fluid.py +++ b/release/scripts/startup/bl_ui/properties_physics_fluid.py @@ -18,7 +18,13 @@ # <pep8 compliant> import bpy -from bpy.types import Panel +from bpy.types import Panel, Menu + +class FLUID_MT_presets(Menu): + bl_label = "Fluid Presets" + preset_subdir = "fluid" + preset_operator = "script.execute_preset" + draw = Menu.draw_preset class PhysicButtonsPanel(): @@ -222,16 +228,14 @@ class PHYSICS_PT_domain_gravity(PhysicButtonsPanel, Panel): col = split.column() col.label(text="Viscosity Presets:") - sub = col.column(align=True) - sub.prop(fluid, "viscosity_preset", text="") - - if fluid.viscosity_preset == 'MANUAL': - sub.prop(fluid, "viscosity_base", text="Base") - sub.prop(fluid, "viscosity_exponent", text="Exponent", slider=True) - else: - # just for padding to prevent jumping around - sub.separator() - sub.separator() + 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 + + subsub = col.column(align=True) + subsub.prop(fluid, "viscosity_base", text="Base") + subsub.prop(fluid, "viscosity_exponent", text="Exponent", slider=True) col.label(text="Optimization:") col.prop(fluid, "grid_levels", slider=True) |