[Bf-blender-cvs] [7e80aa7ca60] master: Update the default Face Set when creating Face Sets from visible

Pablo Dobarro noreply at git.blender.org
Wed May 27 17:36:09 CEST 2020


Commit: 7e80aa7ca60e36e2bfc9ddff3c08a9f46a477e16
Author: Pablo Dobarro
Date:   Sat Apr 25 21:44:44 2020 +0200
Branches: master
https://developer.blender.org/rB7e80aa7ca60e36e2bfc9ddff3c08a9f46a477e16

Update the default Face Set when creating Face Sets from visible

If all vertices in the sculpt are visible create the new face set and
update the default face set. This is the same as disabling the overlay,
so it will not have the extra performance cost of rendering a colored
face set twice that gives no information.

Reviewed By: jbakker

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

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

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

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

diff --git a/source/blender/editors/sculpt_paint/sculpt_face_set.c b/source/blender/editors/sculpt_paint/sculpt_face_set.c
index f96f08e3244..72180ce23d1 100644
--- a/source/blender/editors/sculpt_paint/sculpt_face_set.c
+++ b/source/blender/editors/sculpt_paint/sculpt_face_set.c
@@ -297,6 +297,25 @@ static int sculpt_face_set_create_exec(bContext *C, wmOperator *op)
   }
 
   if (mode == SCULPT_FACE_SET_VISIBLE) {
+
+    /* If all vertices in the sculpt are visible, create the new face set and update the default
+     * color. This way the new face set will be white, which is a quick way of disabling all face
+     * sets and the performance hit of rendering the overlay. */
+    bool all_visible = true;
+    for (int i = 0; i < tot_vert; i++) {
+      if (!SCULPT_vertex_visible_get(ss, i)) {
+        all_visible = false;
+        break;
+      }
+    }
+
+    if (all_visible) {
+      Mesh *mesh = ob->data;
+      mesh->face_sets_color_default = next_face_set;
+      BKE_pbvh_face_sets_color_set(
+          ss->pbvh, mesh->face_sets_color_seed, mesh->face_sets_color_default);
+    }
+
     for (int i = 0; i < tot_vert; i++) {
       if (SCULPT_vertex_visible_get(ss, i)) {
         SCULPT_vertex_face_set_set(ss, i, next_face_set);



More information about the Bf-blender-cvs mailing list