[Bf-blender-cvs] [ff7a30d9288] blender-v2.83-release: Fix sculpt mask interpolation in subdivisions

Pablo Dobarro noreply at git.blender.org
Tue May 19 01:32:39 CEST 2020


Commit: ff7a30d92884e6333f455d2ea209cc2f60b53424
Author: Pablo Dobarro
Date:   Tue May 19 01:31:26 2020 +0200
Branches: blender-v2.83-release
https://developer.blender.org/rBff7a30d92884e6333f455d2ea209cc2f60b53424

Fix sculpt mask interpolation in subdivisions

The interpolation function of the datalayer was misssing so the sculpt
mask data was corrupted every time a subdivision surface modifier was
applied.

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D7640

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

M	source/blender/blenkernel/intern/customdata.c

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

diff --git a/source/blender/blenkernel/intern/customdata.c b/source/blender/blenkernel/intern/customdata.c
index eb5a90a7c4a..14f090f7825 100644
--- a/source/blender/blenkernel/intern/customdata.c
+++ b/source/blender/blenkernel/intern/customdata.c
@@ -699,6 +699,24 @@ static size_t layerFilesize_mdisps(CDataFile *UNUSED(cdf), const void *data, int
 
   return size;
 }
+static void layerInterp_paint_mask(
+    const void **sources, const float *weights, const float *sub_weights, int count, void *dest)
+{
+  float mask = 0.0f;
+  const float *sub_weight = sub_weights;
+  for (int i = 0; i < count; i++) {
+    float weight = weights ? weights[i] : 1.0f;
+    const float *src = sources[i];
+    if (sub_weights) {
+      mask += (*src) * (*sub_weight) * weight;
+      sub_weight++;
+    }
+    else {
+      mask += (*src) * weight;
+    }
+  }
+  *(float *)dest = mask;
+}
 
 static void layerCopy_grid_paint_mask(const void *source, void *dest, int count)
 {
@@ -1595,7 +1613,7 @@ static const LayerTypeInfo LAYERTYPEINFO[CD_NUMTYPES] = {
     /* END BMESH ONLY */
 
     /* 34: CD_PAINT_MASK */
-    {sizeof(float), "", 0, NULL, NULL, NULL, NULL, NULL, NULL},
+    {sizeof(float), "", 0, NULL, NULL, NULL, layerInterp_paint_mask, NULL, NULL},
     /* 35: CD_GRID_PAINT_MASK */
     {sizeof(GridPaintMask),
      "GridPaintMask",



More information about the Bf-blender-cvs mailing list