Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPablo Dobarro <pablodp606@gmail.com>2020-04-25 22:44:44 +0300
committerPablo Dobarro <pablodp606@gmail.com>2020-05-27 18:35:54 +0300
commit7e80aa7ca60e36e2bfc9ddff3c08a9f46a477e16 (patch)
treed95758fd03b0868385db66080a77acaedd5abd64 /source/blender/editors/sculpt_paint/sculpt_face_set.c
parent49c295813ba9fd9de3209e50a11e55647c1de654 (diff)
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
Diffstat (limited to 'source/blender/editors/sculpt_paint/sculpt_face_set.c')
-rw-r--r--source/blender/editors/sculpt_paint/sculpt_face_set.c19
1 files changed, 19 insertions, 0 deletions
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);