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
This commit is contained in:
Pablo Dobarro 2020-04-25 21:44:44 +02:00
parent 49c295813b
commit 7e80aa7ca6
1 changed files with 19 additions and 0 deletions

View File

@ -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);