[Bf-blender-cvs] [56ba339cd8e] temp_bmesh_multires: Fix a few bugs in lat commit
Joseph Eagar
noreply at git.blender.org
Sun Aug 29 00:00:04 CEST 2021
Commit: 56ba339cd8e9bd8c31fcb7056fc95986504a7497
Author: Joseph Eagar
Date: Sat Aug 28 14:59:54 2021 -0700
Branches: temp_bmesh_multires
https://developer.blender.org/rB56ba339cd8e9bd8c31fcb7056fc95986504a7497
Fix a few bugs in lat commit
===================================================================
M source/blender/blenkernel/BKE_pbvh.h
M source/blender/blenkernel/intern/pbvh_bmesh.c
M source/blender/editors/sculpt_paint/sculpt.c
M source/blender/editors/sculpt_paint/sculpt_smooth.c
===================================================================
diff --git a/source/blender/blenkernel/BKE_pbvh.h b/source/blender/blenkernel/BKE_pbvh.h
index b4299ab54b1..4cc4e0b1704 100644
--- a/source/blender/blenkernel/BKE_pbvh.h
+++ b/source/blender/blenkernel/BKE_pbvh.h
@@ -883,6 +883,8 @@ typedef struct SculptLayerEntry {
#endif
+int BKE_pbvh_do_fset_symmetry(int fset, const int symflag, const float *co);
+
#ifdef __cplusplus
}
#endif
diff --git a/source/blender/blenkernel/intern/pbvh_bmesh.c b/source/blender/blenkernel/intern/pbvh_bmesh.c
index 78b686436db..8f04581f981 100644
--- a/source/blender/blenkernel/intern/pbvh_bmesh.c
+++ b/source/blender/blenkernel/intern/pbvh_bmesh.c
@@ -1362,7 +1362,7 @@ typedef struct FSetTemp {
bool boundary;
} FSetTemp;
-static int do_fset_sym(int fset, const int symflag, const float *co)
+int BKE_pbvh_do_fset_symmetry(int fset, const int symflag, const float *co)
{
fset = abs(fset);
@@ -1445,7 +1445,7 @@ void bke_pbvh_update_vert_boundary(int cd_dyn_vert,
}
if (e->l) {
- int fset = do_fset_sym(
+ int fset = BKE_pbvh_do_fset_symmetry(
BM_ELEM_CD_GET_INT(e->l->f, cd_faceset_offset), bound_symmetry, v2->co);
if (e->l->f->len > 3) {
@@ -1488,7 +1488,7 @@ void bke_pbvh_update_vert_boundary(int cd_dyn_vert,
// which can mess up the loop order
if (e->l->radial_next != e->l) {
// fset = abs(BM_ELEM_CD_GET_INT(e->l->radial_next->f, cd_faceset_offset));
- fset = do_fset_sym(
+ fset = BKE_pbvh_do_fset_symmetry(
BM_ELEM_CD_GET_INT(e->l->radial_next->f, cd_faceset_offset), bound_symmetry, v2->co);
if (e->l->radial_next->f->len > 3) {
diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c
index 98075c7b7e7..1e6510a430f 100644
--- a/source/blender/editors/sculpt_paint/sculpt.c
+++ b/source/blender/editors/sculpt_paint/sculpt.c
@@ -1632,13 +1632,23 @@ SculptBoundaryType SCULPT_edge_is_boundary(const SculptSession *ss,
}
if ((typemask & SCULPT_BOUNDARY_FACE_SET) && e->l && e->l != e->l->radial_next) {
- int fset1 = BM_ELEM_CD_GET_INT(e->l->f, ss->cd_faceset_offset);
- int fset2 = BM_ELEM_CD_GET_INT(e->l->f, ss->cd_faceset_offset);
+ if (ss->boundary_symmetry) {
+ // TODO: calc and cache this properly
+ MDynTopoVert *mv1 = BKE_PBVH_DYNVERT(ss->cd_dyn_vert, e->v1);
+ MDynTopoVert *mv2 = BKE_PBVH_DYNVERT(ss->cd_dyn_vert, e->v2);
- bool ok = (fset1 < 0) != (fset2 < 0);
- ok = ok || fset1 != fset2;
+ return (mv1->flag & DYNVERT_FSET_BOUNDARY) && (mv2->flag & DYNVERT_FSET_BOUNDARY);
+ }
+ else {
+ int fset1 = BM_ELEM_CD_GET_INT(e->l->f, ss->cd_faceset_offset);
+ int fset2 = BM_ELEM_CD_GET_INT(e->l->radial_next->f, ss->cd_faceset_offset);
+
+ bool ok = (fset1 < 0) != (fset2 < 0);
- ret |= ok ? SCULPT_BOUNDARY_FACE_SET : 0;
+ ok = ok || fset1 != fset2;
+
+ ret |= ok ? SCULPT_BOUNDARY_FACE_SET : 0;
+ }
}
if (typemask & SCULPT_BOUNDARY_SHARP) {
diff --git a/source/blender/editors/sculpt_paint/sculpt_smooth.c b/source/blender/editors/sculpt_paint/sculpt_smooth.c
index 4b430d9ca0c..12e50cb9e09 100644
--- a/source/blender/editors/sculpt_paint/sculpt_smooth.c
+++ b/source/blender/editors/sculpt_paint/sculpt_smooth.c
@@ -137,6 +137,8 @@ void SCULPT_neighbor_coords_average_interior(SculptSession *ss,
w = 1.0f;
}
+ bool do_diffuse = false;
+
/*use the new edge api if edges are available, if not estimate boundary
from verts*/
if (is_boundary || ni.has_edge) {
@@ -154,7 +156,7 @@ void SCULPT_neighbor_coords_average_interior(SculptSession *ss,
copy_v3_v3(tmp, SCULPT_vertex_co_get(ss, ni.vertex));
ok = true;
}
- else {
+ else if (bound_scl) {
float t[3];
w *= bound_smooth;
@@ -162,9 +164,15 @@ void SCULPT_neighbor_coords_average_interior(SculptSession *ss,
sub_v3_v3v3(t, SCULPT_vertex_co_get(ss, ni.vertex), co);
madd_v3_v3v3fl(tmp, co, no, dot_v3v3(t, no));
ok = true;
+
+ do_diffuse = true;
+ }
+ else {
+ ok = false;
}
}
- else if (bound_scl) {
+
+ if (do_diffuse && bound_scl) {
/*
simple boundary inflator using an ad-hoc diffusion-based pseudo-geodesic field
@@ -213,11 +221,6 @@ void SCULPT_neighbor_coords_average_interior(SculptSession *ss,
add_v3_v3(tmp, co);
}
}
- else {
- /* Interior vertices use all neighbors. */
- copy_v3_v3(tmp, SCULPT_vertex_co_get(ss, ni.vertex));
- ok = true;
- }
if (!ok) {
continue;
More information about the Bf-blender-cvs
mailing list