diff options
author | Nicholas Bishop <nicholasbishop@gmail.com> | 2012-12-30 22:26:11 +0400 |
---|---|---|
committer | Nicholas Bishop <nicholasbishop@gmail.com> | 2012-12-30 22:26:11 +0400 |
commit | 31f978c8efdfd88d2cf2b5d9ae7c5d91c81e13d3 (patch) | |
tree | 64203b4b8e556adfa7a77998cbd8d45e36796d4d /source/blender/editors/sculpt_paint | |
parent | ec258542e2b537c4292fd9214d898fa5d3864ef9 (diff) |
Move layer displacements from SculptUndoNode to PBVHNode
* This doesn't make much difference for regular mesh/multires
sculpting, but for dynamic topology sculpting the undo stack isn't
split up by PBVH nodes, so it's more convenient to store the layer
data in PBVH nodes.
* Note that the life cycle of the layer displacement data is
unchanged -- it's only valid during a stroke with the layer brush,
gets free'd when the undo step ends.
Diffstat (limited to 'source/blender/editors/sculpt_paint')
-rw-r--r-- | source/blender/editors/sculpt_paint/sculpt.c | 11 | ||||
-rw-r--r-- | source/blender/editors/sculpt_paint/sculpt_intern.h | 3 | ||||
-rw-r--r-- | source/blender/editors/sculpt_paint/sculpt_undo.c | 8 |
3 files changed, 7 insertions, 15 deletions
diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c index 8325b47beab..2f0d69bfd98 100644 --- a/source/blender/editors/sculpt_paint/sculpt.c +++ b/source/blender/editors/sculpt_paint/sculpt.c @@ -1908,13 +1908,12 @@ static void do_layer_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode unode = sculpt_undo_push_node(ob, nodes[n], SCULPT_UNDO_COORDS); origco = unode->co; - if (!unode->layer_disp) { - #pragma omp critical - unode->layer_disp = MEM_callocN(sizeof(float) * unode->totvert, "layer disp"); - } - - layer_disp = unode->layer_disp; + #pragma omp critical + { + layer_disp = BLI_pbvh_node_layer_disp_get(ss->pbvh, nodes[n]); + } + sculpt_brush_test_init(ss, &test); BLI_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE) diff --git a/source/blender/editors/sculpt_paint/sculpt_intern.h b/source/blender/editors/sculpt_paint/sculpt_intern.h index 44068122b89..cfc908bf453 100644 --- a/source/blender/editors/sculpt_paint/sculpt_intern.h +++ b/source/blender/editors/sculpt_paint/sculpt_intern.h @@ -101,9 +101,6 @@ typedef struct SculptUndoNode { int *grids; /* to restore into right location */ BLI_bitmap *grid_hidden; - /* layer brush */ - float *layer_disp; - /* shape keys */ char shapeName[sizeof(((KeyBlock *)0))->name]; } SculptUndoNode; diff --git a/source/blender/editors/sculpt_paint/sculpt_undo.c b/source/blender/editors/sculpt_paint/sculpt_undo.c index 1b3fd24ae22..053e17cde07 100644 --- a/source/blender/editors/sculpt_paint/sculpt_undo.c +++ b/source/blender/editors/sculpt_paint/sculpt_undo.c @@ -374,8 +374,6 @@ static void sculpt_undo_free(ListBase *lb) MEM_freeN(unode->index); if (unode->grids) MEM_freeN(unode->grids); - if (unode->layer_disp) - MEM_freeN(unode->layer_disp); if (unode->orig_co) MEM_freeN(unode->orig_co); if (unode->vert_hidden) @@ -612,10 +610,8 @@ void sculpt_undo_push_end(void) unode->no = NULL; } - if (unode->layer_disp) { - MEM_freeN(unode->layer_disp); - unode->layer_disp = NULL; - } + if (unode->node) + BLI_pbvh_node_layer_disp_free(unode->node); } undo_paint_push_end(UNDO_PAINT_MESH); |