Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Sharybin <sergey.vfx@gmail.com>2011-02-14 19:54:52 +0300
committerSergey Sharybin <sergey.vfx@gmail.com>2011-02-14 19:54:52 +0300
commit8ee0c96f4b31df92f4a5e2887fbb4910cc79d75d (patch)
treeee0ddc0ba5a0a77f10908d92873b10281142d0c9 /source/blender/editors/sculpt_paint
parent2b9c9e3ad91340389cecae35d68b8f95d084da80 (diff)
Previous commit to small optimization of sculpting broke smooth and layer
brushes. They aren't using proxies, so deformation wouldn't be propagated in sculpt_combine_proxies(). So, maye idea of getting rid of "extra" memory allocaiton/disposing was not such cool due to it lead to such exception ways?
Diffstat (limited to 'source/blender/editors/sculpt_paint')
-rw-r--r--source/blender/editors/sculpt_paint/sculpt.c27
1 files changed, 25 insertions, 2 deletions
diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c
index 69e42d87148..b15381f5e1a 100644
--- a/source/blender/editors/sculpt_paint/sculpt.c
+++ b/source/blender/editors/sculpt_paint/sculpt.c
@@ -2446,11 +2446,34 @@ static void sculpt_update_keyblock(SculptSession *ss)
}
/* flush displacement from deformed PBVH to original layer */
-static void sculpt_flush_stroke_deform(SculptSession *ss)
+static void sculpt_flush_stroke_deform(Sculpt *sd, SculptSession *ss)
{
if(!ss->kb) {
Object *ob= ss->ob;
Mesh *me= (Mesh*)ob->data;
+ Brush *brush= paint_brush(&sd->paint);
+
+ if(ELEM(brush->sculpt_tool, SCULPT_TOOL_SMOOTH, SCULPT_TOOL_LAYER)) {
+ /* this brushes aren't using proxies, so sculpt_combine_proxies() wouldn't
+ propagate needed deformation to original base */
+
+ int n, totnode;
+ PBVHNode** nodes;
+ PBVHVertexIter vd;
+
+ BLI_pbvh_search_gather(ss->pbvh, NULL, NULL, &nodes, &totnode);
+
+ #pragma omp parallel for schedule(guided) if (sd->flags & SCULPT_USE_OPENMP)
+ for (n= 0; n < totnode; n++) {
+
+ BLI_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE) {
+ sculpt_flush_pbvhvert_deform(ss, &vd);
+ }
+ BLI_pbvh_vertex_iter_end;
+ }
+
+ MEM_freeN(nodes);
+ }
/* Modifiers could depend on mesh normals, so we should update them/
Note, then if sculpting happens on locked key, normals should be re-calculated
@@ -2568,7 +2591,7 @@ static void do_symmetrical_brush_actions(Sculpt *sd, SculptSession *ss)
sculpt_fix_noise_tear(sd, ss);
if (ss->modifiers_active)
- sculpt_flush_stroke_deform(ss);
+ sculpt_flush_stroke_deform(sd, ss);
cache->first_time= 0;
}