sculpt-dev: fix hide bugs and a compiler error
This commit is contained in:
parent
4dad98a6ae
commit
cb22eae31b
|
@ -2794,7 +2794,7 @@ static void init_sculptvert_layer_faces(SculptSession *ss, PBVH *pbvh, int totve
|
|||
MV_ADD_FLAG(mv, SCULPTVERT_NEED_VALENCE | SCULPTVERT_NEED_DISK_SORT);
|
||||
mv->stroke_id = -1;
|
||||
|
||||
PBVHVertRef vertex = {.i = i};
|
||||
PBVHVertRef vertex = {i};
|
||||
|
||||
BKE_sculpt_boundary_flag_update(ss, vertex);
|
||||
|
||||
|
@ -2826,7 +2826,7 @@ static void init_sculptvert_layer_grids(SculptSession *ss, PBVH *pbvh, int totve
|
|||
MV_ADD_FLAG(mv, SCULPTVERT_NEED_VALENCE | SCULPTVERT_NEED_DISK_SORT);
|
||||
mv->stroke_id = -1;
|
||||
|
||||
PBVHVertRef vertex = {.i = i};
|
||||
PBVHVertRef vertex = {i};
|
||||
|
||||
BKE_sculpt_boundary_flag_update(ss, vertex);
|
||||
BKE_pbvh_update_vert_boundary_grids(pbvh, ss->subdiv_ccg, vertex);
|
||||
|
|
|
@ -223,17 +223,13 @@ static void partialvis_update_bmesh_verts(BMesh *bm,
|
|||
TGSET_ITER_END
|
||||
}
|
||||
|
||||
static void partialvis_update_bmesh_faces(TableGSet *faces)
|
||||
static void partialvis_update_bmesh_faces(TableGSet *faces, int cd_hide_poly)
|
||||
{
|
||||
BMFace *f;
|
||||
|
||||
|
||||
TGSET_ITER (f, faces) {
|
||||
if (paint_is_bmesh_face_hidden(f)) {
|
||||
BM_elem_flag_enable(f, BM_ELEM_HIDDEN);
|
||||
}
|
||||
else {
|
||||
BM_elem_flag_disable(f, BM_ELEM_HIDDEN);
|
||||
}
|
||||
bool hidden = paint_is_bmesh_face_hidden(f);
|
||||
BM_ELEM_CD_SET_BOOL(f, cd_hide_poly, hidden);
|
||||
}
|
||||
TGSET_ITER_END
|
||||
}
|
||||
|
@ -261,7 +257,7 @@ static void partialvis_update_bmesh(Object *ob,
|
|||
partialvis_update_bmesh_verts(bm, other, action, area, planes, &any_changed, &any_visible);
|
||||
|
||||
/* Finally loop over node faces and tag the ones that are fully hidden. */
|
||||
partialvis_update_bmesh_faces(faces);
|
||||
partialvis_update_bmesh_faces(faces, ob->sculpt->attrs.hide_poly->bmesh_cd_offset);
|
||||
|
||||
if (any_changed) {
|
||||
BKE_pbvh_node_mark_rebuild_draw(node);
|
||||
|
@ -340,6 +336,8 @@ static int hide_show_exec(bContext *C, wmOperator *op)
|
|||
clip_planes_from_rect(C, depsgraph, clip_planes, &rect);
|
||||
|
||||
pbvh = BKE_sculpt_object_pbvh_ensure(depsgraph, ob);
|
||||
BKE_sculpt_hide_poly_ensure(ob);
|
||||
|
||||
BLI_assert(ob->sculpt->pbvh == pbvh);
|
||||
|
||||
get_pbvh_nodes(pbvh, &nodes, &totnode, clip_planes, area);
|
||||
|
|
|
@ -810,6 +810,11 @@ void SCULPT_face_visibility_all_invert(SculptSession *ss)
|
|||
|
||||
void SCULPT_face_visibility_all_set(SculptSession *ss, bool visible)
|
||||
{
|
||||
if (visible && !ss->attrs.hide_poly) {
|
||||
/* This case is allowed. */
|
||||
return;
|
||||
}
|
||||
|
||||
switch (BKE_pbvh_type(ss->pbvh)) {
|
||||
case PBVH_FACES:
|
||||
case PBVH_GRIDS:
|
||||
|
@ -822,7 +827,7 @@ void SCULPT_face_visibility_all_set(SculptSession *ss, bool visible)
|
|||
for (int i = 0; i < ss->totfaces; i++) {
|
||||
PBVHFaceRef face = BKE_pbvh_index_to_face(ss->pbvh, i);
|
||||
|
||||
*(bool *)BKE_sculpt_face_attr_get(face, ss->attrs.hide_poly) = visible;
|
||||
*(bool *)BKE_sculpt_face_attr_get(face, ss->attrs.hide_poly) = !visible;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1202,6 +1207,8 @@ void SCULPT_visibility_sync_all_from_faces(Object *ob)
|
|||
|
||||
if (!ss->attrs.hide_poly) {
|
||||
BM_ITER_MESH (f, &iter, ss->bm, BM_FACES_OF_MESH) {
|
||||
BM_elem_flag_disable(f, BM_ELEM_HIDDEN);
|
||||
|
||||
BMLoop *l = f->l_first;
|
||||
do {
|
||||
BM_elem_flag_disable(l->v, BM_ELEM_HIDDEN);
|
||||
|
@ -1226,9 +1233,12 @@ void SCULPT_visibility_sync_all_from_faces(Object *ob)
|
|||
/* Unhide verts and edges attached to visible faces. */
|
||||
BM_ITER_MESH (f, &iter, ss->bm, BM_FACES_OF_MESH) {
|
||||
if (BM_ELEM_CD_GET_BOOL(f, cd_hide_poly)) {
|
||||
BM_elem_flag_enable(f, BM_ELEM_HIDDEN);
|
||||
continue;
|
||||
}
|
||||
|
||||
BM_elem_flag_disable(f, BM_ELEM_HIDDEN);
|
||||
|
||||
BMLoop *l = f->l_first;
|
||||
do {
|
||||
BM_elem_flag_disable(l->v, BM_ELEM_HIDDEN);
|
||||
|
|
Loading…
Reference in New Issue