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_cloth.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_cloth.c')
-rw-r--r-- | source/blender/editors/sculpt_paint/sculpt_cloth.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/source/blender/editors/sculpt_paint/sculpt_cloth.c b/source/blender/editors/sculpt_paint/sculpt_cloth.c index 6a2137b6626..115d6f665a3 100644 --- a/source/blender/editors/sculpt_paint/sculpt_cloth.c +++ b/source/blender/editors/sculpt_paint/sculpt_cloth.c @@ -639,12 +639,13 @@ void SCULPT_do_cloth_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode /* In the first brush step of each symmetry pass, build the constraints for the vertices in all * nodes inside the simulation's limits. */ - /* Brush stroke types that restore the mesh on each brush step also need the cloth sim data to be - * created on each step. */ + /* Brushes that use anchored strokes and restore the mesh can't rely on symmetry passes and steps + * count as it is always the first step, so the simulation needs to be created when it does not + * exist for this stroke. */ if (SCULPT_stroke_is_first_brush_step_of_symmetry_pass(ss->cache) || !ss->cache->cloth_sim) { /* The simulation structure only needs to be created on the first symmetry pass. */ - if (SCULPT_stroke_is_first_brush_step(ss->cache)) { + if (SCULPT_stroke_is_first_brush_step(ss->cache) || !ss->cache->cloth_sim) { ss->cache->cloth_sim = cloth_brush_simulation_create( ss, brush->cloth_mass, brush->cloth_damping); for (int i = 0; i < totverts; i++) { |