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 /source/blender | |
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 'source/blender')
-rw-r--r-- | source/blender/blenkernel/BKE_blender.h | 2 | ||||
-rw-r--r-- | source/blender/blenloader/intern/readfile.c | 24 | ||||
-rw-r--r-- | source/blender/editors/physics/physics_fluid.c | 14 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_object_fluidsim.h | 3 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_fluidsim.c | 13 | ||||
-rw-r--r-- | source/blender/modifiers/intern/MOD_fluidsim_util.c | 1 |
6 files changed, 28 insertions, 29 deletions
diff --git a/source/blender/blenkernel/BKE_blender.h b/source/blender/blenkernel/BKE_blender.h index ffabbcf32f0..296461e61c8 100644 --- a/source/blender/blenkernel/BKE_blender.h +++ b/source/blender/blenkernel/BKE_blender.h @@ -42,7 +42,7 @@ extern "C" { * and keep comment above the defines. * Use STRINGIFY() rather than defining with quotes */ #define BLENDER_VERSION 262 -#define BLENDER_SUBVERSION 3 +#define BLENDER_SUBVERSION 4 #define BLENDER_MINVERSION 250 #define BLENDER_MINSUBVERSION 0 diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 55f0ccebf95..6a40e1ebf43 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -13323,6 +13323,30 @@ static void do_versions(FileData *fd, Library *lib, Main *main) } } + if (main->versionfile < 262 || (main->versionfile == 262 && main->subversionfile < 4)) + { + /* Read Viscosity presets from older files */ + Object *ob; + + for (ob = main->object.first; ob; ob = ob->id.next) { + ModifierData *md; + for (md = ob->modifiers.first; md; md = md->next) { + if (md->type == eModifierType_Fluidsim) { + FluidsimModifierData *fmd = (FluidsimModifierData *)md; + if(fmd->fss->viscosityMode == 3) { + fmd->fss->viscosityValue = 5.0; + fmd->fss->viscosityExponent = 5; + } + else if(fmd->fss->viscosityMode == 4) { + fmd->fss->viscosityValue = 2.0; + fmd->fss->viscosityExponent = 3; + } + } + } + } + } + + { /* Default for old files is to save particle rotations to pointcache */ diff --git a/source/blender/editors/physics/physics_fluid.c b/source/blender/editors/physics/physics_fluid.c index 6a074a542c3..20fa4c5753f 100644 --- a/source/blender/editors/physics/physics_fluid.c +++ b/source/blender/editors/physics/physics_fluid.c @@ -98,19 +98,7 @@ static float get_fluid_viscosity(FluidsimSettings *settings) { - switch (settings->viscosityMode) { - case 0: /* unused */ - return -1.0; - case 2: /* water */ - return 1.0e-6; - case 3: /* some (thick) oil */ - return 5.0e-5; - case 4: /* ca. honey */ - return 2.0e-3; - case 1: /* manual */ - default: - return (1.0f/powf(10.0f, settings->viscosityExponent)) * settings->viscosityValue; - } + return (1.0f/powf(10.0f, settings->viscosityExponent)) * settings->viscosityValue; } static float get_fluid_rate(FluidsimSettings *settings) diff --git a/source/blender/makesdna/DNA_object_fluidsim.h b/source/blender/makesdna/DNA_object_fluidsim.h index 751d420daa7..a55b7b17a22 100644 --- a/source/blender/makesdna/DNA_object_fluidsim.h +++ b/source/blender/makesdna/DNA_object_fluidsim.h @@ -35,6 +35,7 @@ #define __DNA_OBJECT_FLUIDSIM_H__ #include "DNA_ID.h" +#include "DNA_defs.h" #ifdef __cplusplus extern "C" { @@ -66,7 +67,7 @@ typedef struct FluidsimSettings { /* fluid properties */ float viscosityValue; - short viscosityMode; + short viscosityMode DNA_DEPRECATED; short viscosityExponent; /* gravity strength */ float grav[3]; diff --git a/source/blender/makesrna/intern/rna_fluidsim.c b/source/blender/makesrna/intern/rna_fluidsim.c index b5770650cb8..a4aac6f345c 100644 --- a/source/blender/makesrna/intern/rna_fluidsim.c +++ b/source/blender/makesrna/intern/rna_fluidsim.c @@ -269,13 +269,6 @@ static void rna_def_fluidsim_domain(BlenderRNA *brna) {OB_FSDOM_FINAL, "FINAL", 0, "Final", "Display final quality results"}, {0, NULL, 0, NULL, NULL}}; - static EnumPropertyItem viscosity_items[] = { - {1, "MANUAL", 0, "Manual", "Manual viscosity settings"}, - {2, "WATER", 0, "Water", "Viscosity of 1.0 * 10^-6"}, - {3, "OIL", 0, "Oil", "Viscosity of 5.0 * 10^-5"}, - {4, "HONEY", 0, "Honey", "Viscosity of 2.0 * 10^-3"}, - {0, NULL, 0, NULL, NULL}}; - srna = RNA_def_struct(brna, "DomainFluidSettings", "FluidSettings"); RNA_def_struct_sdna(srna, "FluidsimSettings"); RNA_def_struct_ui_text(srna, "Domain Fluid Simulation Settings", @@ -360,12 +353,6 @@ static void rna_def_fluidsim_domain(BlenderRNA *brna) RNA_def_property_float_sdna(prop, NULL, "animRate"); RNA_def_property_range(prop, 0.0, 100.0); RNA_def_property_ui_text(prop, "Simulation Speed", "Fluid motion rate (0 = stationary, 1 = normal speed)"); - - prop = RNA_def_property(srna, "viscosity_preset", PROP_ENUM, PROP_NONE); - RNA_def_property_enum_sdna(prop, NULL, "viscosityMode"); - RNA_def_property_enum_items(prop, viscosity_items); - RNA_def_property_ui_text(prop, "Viscosity Preset", - "Set viscosity of the fluid to a preset value, or use manual input"); prop = RNA_def_property(srna, "viscosity_base", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "viscosityValue"); diff --git a/source/blender/modifiers/intern/MOD_fluidsim_util.c b/source/blender/modifiers/intern/MOD_fluidsim_util.c index 9cd656c3621..fe0cb2e650f 100644 --- a/source/blender/modifiers/intern/MOD_fluidsim_util.c +++ b/source/blender/modifiers/intern/MOD_fluidsim_util.c @@ -85,7 +85,6 @@ void fluidsim_init(FluidsimModifierData *fluidmd) fss->guiDisplayMode = 2; // preview fss->renderDisplayMode = 3; // render - fss->viscosityMode = 2; // default to water fss->viscosityValue = 1.0; fss->viscosityExponent = 6; |