diff options
author | Sebastián Barschkis <sebbas@sebbas.org> | 2020-10-20 15:06:33 +0300 |
---|---|---|
committer | Sebastián Barschkis <sebbas@sebbas.org> | 2020-10-20 15:06:43 +0300 |
commit | 5bd7eda093b9b420cccc02f9aeb10ef6ba6f05f6 (patch) | |
tree | 2f92af1ff9186d41f8a45f19b85014983b72bb06 | |
parent | 14c0897671105b31adfbbc2f1ba8fb7af06b1ce8 (diff) |
Fluid: Add missing versioning for new options in 'Viewport Display' panel
Files created before D8705 was merged need to get initial values for the new viewport display fields.
-rw-r--r-- | source/blender/blenloader/intern/versioning_290.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/source/blender/blenloader/intern/versioning_290.c b/source/blender/blenloader/intern/versioning_290.c index c6760adfd3f..d93a6d57565 100644 --- a/source/blender/blenloader/intern/versioning_290.c +++ b/source/blender/blenloader/intern/versioning_290.c @@ -30,6 +30,7 @@ #include "DNA_brush_types.h" #include "DNA_cachefile_types.h" #include "DNA_constraint_types.h" +#include "DNA_fluid_types.h" #include "DNA_genfile.h" #include "DNA_gpencil_modifier_types.h" #include "DNA_gpencil_types.h" @@ -768,6 +769,25 @@ void blo_do_versions_290(FileData *fd, Library *UNUSED(lib), Main *bmain) } } } + + /* Ensure that new viewport display fields are initialized correctly. */ + LISTBASE_FOREACH (Object *, ob, &bmain->objects) { + LISTBASE_FOREACH (ModifierData *, md, &ob->modifiers) { + if (md->type == eModifierType_Fluid) { + FluidModifierData *fmd = (FluidModifierData *)md; + if (fmd->domain != NULL) { + if (!fmd->domain->coba_field && fmd->domain->type == FLUID_DOMAIN_TYPE_LIQUID) { + fmd->domain->coba_field = FLUID_DOMAIN_FIELD_PHI; + } + fmd->domain->grid_scale = 1.0; + fmd->domain->gridlines_upper_bound = 1.0; + fmd->domain->vector_scale_with_magnitude = true; + const float grid_lines[4] = {1.0, 0.0, 0.0, 1.0}; + copy_v4_v4(fmd->domain->gridlines_range_color, grid_lines); + } + } + } + } } if (!MAIN_VERSION_ATLEAST(bmain, 291, 6)) { |