From 69d2af764354f515816ec0d187b824c325d4788d Mon Sep 17 00:00:00 2001 From: Antony Riakiotakis Date: Fri, 11 Apr 2014 02:29:37 +0300 Subject: Support logging of modified faces in dyntopo. This is meant to support undo when hiding parts of the mesh. Also avoid rebuilding the PBVH in that case as well (no nodes split) --- source/blender/editors/sculpt_paint/sculpt_undo.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) (limited to 'source/blender/editors') diff --git a/source/blender/editors/sculpt_paint/sculpt_undo.c b/source/blender/editors/sculpt_paint/sculpt_undo.c index 90e26f03b2e..673e4d90d99 100644 --- a/source/blender/editors/sculpt_paint/sculpt_undo.c +++ b/source/blender/editors/sculpt_paint/sculpt_undo.c @@ -280,7 +280,7 @@ static void sculpt_undo_bmesh_restore_generic(bContext *C, unode->applied = true; } - if (unode->type == SCULPT_UNDO_MASK) { + if (ELEM(unode->type, SCULPT_UNDO_MASK, SCULPT_UNDO_MASK)) { int i, totnode; PBVHNode **nodes; @@ -756,7 +756,6 @@ static SculptUndoNode *sculpt_undo_bmesh_push(Object *ob, if (node) { switch (type) { case SCULPT_UNDO_COORDS: - case SCULPT_UNDO_HIDDEN: case SCULPT_UNDO_MASK: /* Before any vertex values get modified, ensure their * original positions are logged */ @@ -766,6 +765,22 @@ static SculptUndoNode *sculpt_undo_bmesh_push(Object *ob, BKE_pbvh_vertex_iter_end; break; + case SCULPT_UNDO_HIDDEN: + { + GSetIterator gs_iter; + GSet *faces = BKE_pbvh_bmesh_node_faces(node); + BKE_pbvh_vertex_iter_begin(ss->pbvh, node, vd, PBVH_ITER_ALL) { + BM_log_vert_before_modified(ss->bm_log, vd.bm_vert, vd.cd_vert_mask_offset); + } + BKE_pbvh_vertex_iter_end; + + GSET_ITER (gs_iter, faces) { + BMFace *f = BLI_gsetIterator_getKey(&gs_iter); + BM_log_face_modified(ss->bm_log, f); + } + break; + } + case SCULPT_UNDO_DYNTOPO_BEGIN: case SCULPT_UNDO_DYNTOPO_END: case SCULPT_UNDO_DYNTOPO_SYMMETRIZE: -- cgit v1.2.3