[Bf-blender-cvs] [57e0e520e89] master: Fix (unreported) 'smooth vertex colors' operator not respecting vertex paint mask selection

Philipp Oeser noreply at git.blender.org
Fri Sep 13 22:33:42 CEST 2019


Commit: 57e0e520e89b1de8fec424a2be4f90a59d7557dc
Author: Philipp Oeser
Date:   Fri Sep 13 15:17:03 2019 +0200
Branches: master
https://developer.blender.org/rB57e0e520e89b1de8fec424a2be4f90a59d7557dc

Fix (unreported) 'smooth vertex colors' operator not respecting vertex
paint mask selection

followup to rBr27bbe7cbd9b, might as well make this consistent across
all the color operations [with the exception of 'Dirty Vertex Colors'
which is python]

Reviewers: brecht

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

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

M	source/blender/editors/sculpt_paint/paint_vertex_color_ops.c

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

diff --git a/source/blender/editors/sculpt_paint/paint_vertex_color_ops.c b/source/blender/editors/sculpt_paint/paint_vertex_color_ops.c
index 9a6251e2f98..266c130d12a 100644
--- a/source/blender/editors/sculpt_paint/paint_vertex_color_ops.c
+++ b/source/blender/editors/sculpt_paint/paint_vertex_color_ops.c
@@ -272,7 +272,6 @@ static bool vertex_color_smooth(Object *ob)
 {
   Mesh *me;
   const MPoly *mp;
-
   int i, j;
 
   bool *mlooptag;
@@ -282,6 +281,7 @@ static bool vertex_color_smooth(Object *ob)
   }
 
   const bool use_face_sel = (me->editflag & ME_EDIT_PAINT_FACE_SEL) != 0;
+  const bool use_vert_sel = (me->editflag & ME_EDIT_PAINT_VERT_SEL) != 0;
 
   mlooptag = MEM_callocN(sizeof(bool) * me->totloop, "VPaintData mlooptag");
 
@@ -289,15 +289,19 @@ static bool vertex_color_smooth(Object *ob)
   mp = me->mpoly;
   for (i = 0; i < me->totpoly; i++, mp++) {
     const MLoop *ml = me->mloop + mp->loopstart;
-    int ml_index = mp->loopstart;
 
     if (use_face_sel && !(mp->flag & ME_FACE_SEL)) {
       continue;
     }
 
-    for (j = 0; j < mp->totloop; j++, ml_index++, ml++) {
-      mlooptag[ml_index] = true;
-    }
+    j = 0;
+    do {
+      if (!(use_vert_sel && !(me->mvert[ml->v].flag & SELECT))) {
+        mlooptag[mp->loopstart + j] = true;
+      }
+      ml++;
+      j++;
+    } while (j < mp->totloop);
   }
 
   /* remove stale me->mcol, will be added later */



More information about the Bf-blender-cvs mailing list