[Bf-blender-cvs] [5bd7eda093b] master: Fluid: Add missing versioning for new options in 'Viewport Display' panel

Sebastián Barschkis noreply at git.blender.org
Tue Oct 20 14:06:54 CEST 2020


Commit: 5bd7eda093b9b420cccc02f9aeb10ef6ba6f05f6
Author: Sebastián Barschkis
Date:   Tue Oct 20 14:06:33 2020 +0200
Branches: master
https://developer.blender.org/rB5bd7eda093b9b420cccc02f9aeb10ef6ba6f05f6

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.

===================================================================

M	source/blender/blenloader/intern/versioning_290.c

===================================================================

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)) {



More information about the Bf-blender-cvs mailing list