From 169f8313940e826587fc50b3c4e3b082d15b51e5 Mon Sep 17 00:00:00 2001 From: Antony Riakiotakis Date: Thu, 17 Apr 2014 20:53:20 +0300 Subject: Make sure we invalidate the node ID layer each time the PBVH is reset. It makes code more tidy (avoids having to call invalidation on a myriad places). Also makes sure other invalidation cases (some mesh change, e.g.) work as expected. --- source/blender/editors/sculpt_paint/sculpt.c | 23 ---------------------- .../blender/editors/sculpt_paint/sculpt_intern.h | 2 -- source/blender/editors/sculpt_paint/sculpt_undo.c | 7 ------- 3 files changed, 32 deletions(-) (limited to 'source/blender/editors/sculpt_paint') diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c index f5bdbfa974d..16c0f9bc4fb 100644 --- a/source/blender/editors/sculpt_paint/sculpt.c +++ b/source/blender/editors/sculpt_paint/sculpt.c @@ -4793,25 +4793,6 @@ void sculpt_pbvh_clear(Object *ob) BKE_object_free_derived_caches(ob); } -void sculpt_dyntopo_node_layers_reset(SculptSession *ss) -{ - BMFace *f; - BMVert *v; - BMIter iter; - BMesh *bm = ss->bm; - int cd_vert_node_offset = ss->cd_vert_node_offset; - int cd_face_node_offset = ss->cd_face_node_offset; - - /* clear the elements of the node information */ - BM_ITER_MESH(v, &iter, bm, BM_VERTS_OF_MESH) { - BM_ELEM_CD_SET_INT(v, cd_vert_node_offset, DYNTOPO_NODE_NONE); - } - - BM_ITER_MESH(f, &iter, bm, BM_FACES_OF_MESH) { - BM_ELEM_CD_SET_INT(f, cd_face_node_offset, DYNTOPO_NODE_NONE); - } -} - void sculpt_dyntopo_node_layers_add(SculptSession *ss) { int cd_node_layer_index; @@ -4874,7 +4855,6 @@ void sculpt_dynamic_topology_enable(bContext *C) BM_data_layer_add(ss->bm, &ss->bm->vdata, CD_PAINT_MASK); sculpt_dyntopo_node_layers_add(ss); /* make sure the data for existing faces are initialized */ - sculpt_dyntopo_node_layers_reset(ss); BM_mesh_normals_update(ss->bm); /* Enable dynamic topology */ @@ -5013,7 +4993,6 @@ static int sculpt_optimize_exec(bContext *C, wmOperator *UNUSED(op)) Object *ob = CTX_data_active_object(C); sculpt_pbvh_clear(ob); - sculpt_dyntopo_node_layers_reset(ob->sculpt); WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, ob); return OPERATOR_FINISHED; @@ -5072,7 +5051,6 @@ static int sculpt_symmetrize_exec(bContext *C, wmOperator *UNUSED(op)) /* Redraw */ sculpt_pbvh_clear(ob); - sculpt_dyntopo_node_layers_reset(ss); WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, ob); return OPERATOR_FINISHED; @@ -5333,7 +5311,6 @@ static int sculpt_detail_flood_fill_exec(bContext *C, wmOperator *UNUSED(op)) /* force rebuild of pbvh for better BB placement */ sculpt_pbvh_clear(ob); - sculpt_dyntopo_node_layers_reset(ss); /* Redraw */ WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, ob); diff --git a/source/blender/editors/sculpt_paint/sculpt_intern.h b/source/blender/editors/sculpt_paint/sculpt_intern.h index 8cf5bf88bcc..a4d2f0dc057 100644 --- a/source/blender/editors/sculpt_paint/sculpt_intern.h +++ b/source/blender/editors/sculpt_paint/sculpt_intern.h @@ -48,7 +48,6 @@ struct MultiresModifierData; struct Object; struct Scene; struct Sculpt; -struct SculptSession; struct SculptStroke; struct SculptUndoNode; @@ -68,7 +67,6 @@ bool sculpt_stroke_get_location(bContext *C, float out[3], const float mouse[2]) /* Dynamic topology */ void sculpt_pbvh_clear(Object *ob); -void sculpt_dyntopo_node_layers_reset(struct SculptSession *ss); void sculpt_dyntopo_node_layers_add(struct SculptSession *ss); void sculpt_update_after_dynamic_topology_toggle(bContext *C); void sculpt_dynamic_topology_enable(struct bContext *C); diff --git a/source/blender/editors/sculpt_paint/sculpt_undo.c b/source/blender/editors/sculpt_paint/sculpt_undo.c index 39df15bd985..6ac65e431ea 100644 --- a/source/blender/editors/sculpt_paint/sculpt_undo.c +++ b/source/blender/editors/sculpt_paint/sculpt_undo.c @@ -301,7 +301,6 @@ static void sculpt_undo_bmesh_restore_generic(bContext *C, MEM_freeN(nodes); } else { - sculpt_dyntopo_node_layers_reset(ss); sculpt_pbvh_clear(ob); } } @@ -341,9 +340,6 @@ static void sculpt_undo_bmesh_restore_begin(bContext *C, /* Restore the mesh from the first log entry */ BM_log_redo(ss->bm, ss->bm_log); - /* reset layers for all bmesh data */ - sculpt_dyntopo_node_layers_reset(ss); - unode->applied = true; } } @@ -359,9 +355,6 @@ static void sculpt_undo_bmesh_restore_end(bContext *C, /* Restore the mesh from the last log entry */ BM_log_undo(ss->bm, ss->bm_log); - /* reset layers for all bmesh data */ - sculpt_dyntopo_node_layers_reset(ss); - unode->applied = false; } else { -- cgit v1.2.3