diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2010-01-04 19:53:32 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2010-01-04 19:53:32 +0300 |
commit | 5dd7b4d4907c11315654cd788ce24fa7faaa5231 (patch) | |
tree | d6aee85ebe6cd149b23c07fcadb3a7d21b541e31 /source/blender/editors/sculpt_paint | |
parent | e67df065b8895ad0da15df1326f82051488f72fb (diff) |
Sculpt:
* Fix #20482: grab brush + size pressure sensitivity don't work
together, disabled the pressure sensitivty for that case now.
* Fix for smooth brush messing up mesh sometimes, smooth factor
is now clamped to reasonable range.
* Fix #20449: smooth brush + mirror modifier could crash.
Diffstat (limited to 'source/blender/editors/sculpt_paint')
-rw-r--r-- | source/blender/editors/sculpt_paint/sculpt.c | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c index 75cc927cf0e..cfcd0d90e2c 100644 --- a/source/blender/editors/sculpt_paint/sculpt.c +++ b/source/blender/editors/sculpt_paint/sculpt.c @@ -914,6 +914,8 @@ static void do_mesh_smooth_brush(Sculpt *sd, SculptSession *ss, PBVHNode *node) if(sculpt_brush_test(&test, vd.co)) { float fade = tex_strength(ss, brush, vd.co, test.dist)*bstrength; float avg[3], val[3]; + + CLAMP(fade, 0.0f, 1.0f); neighbor_average(ss, avg, vd.vert_indices[vd.i]); val[0] = vd.co[0]+(avg[0]-vd.co[0])*fade; @@ -990,6 +992,8 @@ static void do_multires_smooth_brush(Sculpt *sd, SculptSession *ss, PBVHNode *no if(y == 0 || y == gridsize - 1) mul_v3_fl(avg, 2.0f); + CLAMP(fade, 0.0f, 1.0f); + val[0] = co[0]+(avg[0]-co[0])*fade; val[1] = co[1]+(avg[1]-co[1])*fade; val[2] = co[2]+(avg[2]-co[2])*fade; @@ -1013,15 +1017,15 @@ static void do_smooth_brush(Sculpt *sd, SculptSession *ss, PBVHNode **nodes, int for(n=0; n<totnode; n++) { sculpt_undo_push_node(ss, nodes[n]); - if(ss->fmap) - do_mesh_smooth_brush(sd, ss, nodes[n]); - else + if(ss->multires) do_multires_smooth_brush(sd, ss, nodes[n]); + else if(ss->fmap) + do_mesh_smooth_brush(sd, ss, nodes[n]); BLI_pbvh_node_mark_update(nodes[n]); } - if(!ss->fmap) + if(ss->multires) multires_stitch_grids(ss->ob); } } @@ -1544,7 +1548,7 @@ void sculpt_update_mesh_elements(Scene *scene, Object *ob, int need_fmap) } ss->tree = dm->getPBVH(ob, dm); - ss->fmap = (need_fmap && dm->getFaceMap)? dm->getFaceMap(dm): NULL; + ss->fmap = (need_fmap && dm->getFaceMap)? dm->getFaceMap(ob, dm): NULL; } static int sculpt_mode_poll(bContext *C) @@ -1743,7 +1747,7 @@ static void sculpt_update_cache_variants(Sculpt *sd, SculptSession *ss, struct P if(cache->first_time) cache->initial_radius = unproject_brush_radius(ss->ob, cache->vc, cache->true_location, brush->size); - if(brush->flag & BRUSH_SIZE_PRESSURE) { + if(brush->flag & BRUSH_SIZE_PRESSURE && brush->sculpt_tool != SCULPT_TOOL_GRAB) { cache->pixel_radius *= cache->pressure; cache->radius = cache->initial_radius * cache->pressure; } @@ -1797,8 +1801,12 @@ static void sculpt_update_cache_variants(Sculpt *sd, SculptSession *ss, struct P static void sculpt_stroke_modifiers_check(bContext *C, SculptSession *ss) { - if(sculpt_modifiers_active(ss->ob)) - sculpt_update_mesh_elements(CTX_data_scene(C), ss->ob, 0); // XXX brush->sculpt_tool == SCULPT_TOOL_SMOOTH); + if(sculpt_modifiers_active(ss->ob)) { + Sculpt *sd = CTX_data_tool_settings(C)->sculpt; + Brush *brush = paint_brush(&sd->paint); + + sculpt_update_mesh_elements(CTX_data_scene(C), ss->ob, brush->sculpt_tool == SCULPT_TOOL_SMOOTH); + } } typedef struct { |