[Bf-blender-cvs] [4123e507ef9] temp-face-set-fixes: Fix T74761: Reimplement vertex to face sets visibility sync
Pablo Dobarro
noreply at git.blender.org
Wed Mar 25 15:31:32 CET 2020
Commit: 4123e507ef99a671a509c6a075991c97adf1f605
Author: Pablo Dobarro
Date: Wed Mar 25 15:30:08 2020 +0100
Branches: temp-face-set-fixes
https://developer.blender.org/rB4123e507ef99a671a509c6a075991c97adf1f605
Fix T74761: Reimplement vertex to face sets visibility sync
This fixes multiple issues:
- Adds tag to update shading when changing vertex visibiliyt. This makes the mesh visibility update when the operator ends.
- Sync vertex to face sets no longer requires the pmap, so it does not crash. (Maybe we can initialize the pmap on undo to avoid these problems in the future).
- Sync vertex to face sets now works in a coherent way with the rest of visibility operations. Hide Box and Hide mask now sync the visibility changes to the face sets, so the all the operations are now getting a correct visibility state.
Maniphest Tasks: T74761
Differential Revision: https://developer.blender.org/D7187
===================================================================
M source/blender/editors/sculpt_paint/paint_hide.c
M source/blender/editors/sculpt_paint/sculpt.c
===================================================================
diff --git a/source/blender/editors/sculpt_paint/paint_hide.c b/source/blender/editors/sculpt_paint/paint_hide.c
index ce5a80585b0..69ca86efa9d 100644
--- a/source/blender/editors/sculpt_paint/paint_hide.c
+++ b/source/blender/editors/sculpt_paint/paint_hide.c
@@ -403,6 +403,9 @@ static int hide_show_exec(bContext *C, wmOperator *op)
BKE_mesh_flush_hidden_from_verts(me);
}
+ SCULPT_visibility_sync_all_vertex_to_face_sets(ob->sculpt);
+
+ DEG_id_tag_update(&ob->id, ID_RECALC_SHADING);
ED_region_tag_redraw(region);
return OPERATOR_FINISHED;
diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c
index 3e6c36730df..e87be70e382 100644
--- a/source/blender/editors/sculpt_paint/sculpt.c
+++ b/source/blender/editors/sculpt_paint/sculpt.c
@@ -440,8 +440,23 @@ static void sculpt_visibility_sync_vertex_to_face_sets(SculptSession *ss, int in
void SCULPT_visibility_sync_all_vertex_to_face_sets(SculptSession *ss)
{
- for (int i = 0; i < ss->totvert; i++) {
- sculpt_visibility_sync_vertex_to_face_sets(ss, i);
+ if (BKE_pbvh_type(ss->pbvh) == PBVH_FACES) {
+ for (int i = 0; i < ss->totpoly; i++) {
+ MPoly *poly = &ss->mpoly[i];
+ bool poly_visible = true;
+ for (int l = 0; l < poly->totloop; l++) {
+ MLoop *loop = &ss->mloop[poly->loopstart + l];
+ if (!SCULPT_vertex_visible_get(ss, (int)loop->v)) {
+ poly_visible = false;
+ }
+ }
+ if (poly_visible) {
+ ss->face_sets[i] = abs(ss->face_sets[i]);
+ }
+ else {
+ ss->face_sets[i] = -abs(ss->face_sets[i]);
+ }
+ }
}
}
More information about the Bf-blender-cvs
mailing list