diff options
author | Pablo Dobarro <pablodp606@gmail.com> | 2020-07-28 00:19:47 +0300 |
---|---|---|
committer | Pablo Dobarro <pablodp606@gmail.com> | 2020-07-29 18:19:10 +0300 |
commit | 6e5278c3dacaf35650fbe0550a87399fc8459f53 (patch) | |
tree | fef21072cc25598fbb879a5631851a47ec316c0a /source/blender/editors/sculpt_paint/sculpt.c | |
parent | 83f01db7a96c6e86b22b1b28e9873b1c18f0a66a (diff) |
Fix T79054: Crash with Cloth Brush and anchored stroke
As the comment says, anchored stroke can't rely on the first stroke
iteration for creating the simulation data. Probably lost in a cleanup.
I also made that anchored stroke doesn't restore the mesh state in the
cloth brush, so it can create the simulation effect.
Reviewed By: sergey
Maniphest Tasks: T79054
Differential Revision: https://developer.blender.org/D8348
Diffstat (limited to 'source/blender/editors/sculpt_paint/sculpt.c')
-rw-r--r-- | source/blender/editors/sculpt_paint/sculpt.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c index 590d04bed3d..92beb396629 100644 --- a/source/blender/editors/sculpt_paint/sculpt.c +++ b/source/blender/editors/sculpt_paint/sculpt.c @@ -5516,7 +5516,7 @@ static void do_brush_action(Sculpt *sd, Object *ob, Brush *brush, UnifiedPaintSe SculptSearchSphereData data = { .ss = ss, .sd = sd, - .radius_squared = square_f(ss->cache->radius * (1.0 + brush->cloth_sim_limit)), + .radius_squared = square_f(ss->cache->initial_radius * (1.0 + brush->cloth_sim_limit)), .original = false, .ignore_fully_ineffective = false, .center = ss->cache->initial_location, @@ -7208,11 +7208,16 @@ static void sculpt_restore_mesh(Sculpt *sd, Object *ob) SculptSession *ss = ob->sculpt; Brush *brush = BKE_paint_brush(&sd->paint); + /* For the cloth brush it makes more sense to not restore the mesh state to keep running the + * simulation from the previous state. */ + if (brush->sculpt_tool == SCULPT_TOOL_CLOTH) { + return; + } + /* Restore the mesh before continuing with anchored stroke. */ if ((brush->flag & BRUSH_ANCHORED) || ((brush->sculpt_tool == SCULPT_TOOL_GRAB || - brush->sculpt_tool == SCULPT_TOOL_ELASTIC_DEFORM || - brush->sculpt_tool == SCULPT_TOOL_CLOTH) && + brush->sculpt_tool == SCULPT_TOOL_ELASTIC_DEFORM) && BKE_brush_use_size_pressure(brush)) || (brush->flag & BRUSH_DRAG_DOT)) { |