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
path: root/source
diff options
context:
space:
mode:
authorSergey Sharybin <sergey.vfx@gmail.com>2011-04-12 14:16:00 +0400
committerSergey Sharybin <sergey.vfx@gmail.com>2011-04-12 14:16:00 +0400
commitb7269aa36e1e86dfa5142770e5f12c89f3898501 (patch)
treefa1bf6a4d15186f3f02978d0068e3259c848e178 /source
parent618690b05eff11ffccb92e3667368d4fd6a590d7 (diff)
Fix #26879: Some sculpt brushes does not work when sculpting corrective shapekeys
It was simply missed crazyspace correction for shape keys when mesh is deformed by modifiers and current tool is smooth/layer (they need special approach due to they don't use proxies)
Diffstat (limited to 'source')
-rw-r--r--source/blender/editors/sculpt_paint/sculpt.c46
1 files changed, 29 insertions, 17 deletions
diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c
index 9d9deeda604..1543cbedae9 100644
--- a/source/blender/editors/sculpt_paint/sculpt.c
+++ b/source/blender/editors/sculpt_paint/sculpt.c
@@ -2492,38 +2492,50 @@ static void sculpt_update_keyblock(Object *ob)
static void sculpt_flush_stroke_deform(Sculpt *sd, Object *ob)
{
SculptSession *ss = ob->sculpt;
-
- if(!ss->kb) {
+ 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;
Mesh *me= (Mesh*)ob->data;
- Brush *brush= paint_brush(&sd->paint);
+ PBVHNode** nodes;
+ float (*vertCos)[3]= NULL;
- 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 */
+ if(ss->kb)
+ vertCos= MEM_callocN(sizeof(*vertCos)*me->totvert, "flushStrokeDeofrm keyVerts");
- int n, totnode;
- PBVHNode** nodes;
+ BLI_pbvh_search_gather(ss->pbvh, NULL, NULL, &nodes, &totnode);
- 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++) {
+ PBVHVertexIter vd;
- #pragma omp parallel for schedule(guided) if (sd->flags & SCULPT_USE_OPENMP)
- for (n= 0; n < totnode; n++) {
- PBVHVertexIter vd;
+ BLI_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE) {
+ sculpt_flush_pbvhvert_deform(ob, &vd);
- BLI_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE) {
- sculpt_flush_pbvhvert_deform(ob, &vd);
+ if(vertCos) {
+ int index= vd.vert_indices[vd.i];
+ copy_v3_v3(vertCos[index], ss->orig_cos[index]);
}
- BLI_pbvh_vertex_iter_end;
}
+ BLI_pbvh_vertex_iter_end;
+ }
- MEM_freeN(nodes);
+ if(vertCos) {
+ sculpt_vertcos_to_key(ob, ss->kb, vertCos);
+ MEM_freeN(vertCos);
}
+ 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
after applying coords from keyblock on base mesh */
mesh_calc_normals(me->mvert, me->totvert, me->mface, me->totface, NULL);
- } else sculpt_update_keyblock(ob);
+ } else if (ss->kb)
+ sculpt_update_keyblock(ob);
}
//static int max_overlap_count(Sculpt *sd)