diff options
author | Campbell Barton <ideasman42@gmail.com> | 2018-01-19 04:25:09 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2018-01-19 04:25:09 +0300 |
commit | 368414efacc2b7260c02b0cb77a7b24c1e054f39 (patch) | |
tree | eeff047007d07065c2d109ef604f29d9fed3be2f /source/blender/blenkernel/intern/particle.c | |
parent | 2b9fb723edc2eba3f408c64b07291dc72434b680 (diff) |
Fix T53823: Particle weight brush crash
Entering particle edit mode w/ the weight brush enabled crashed
on non-hair particle systems.
Diffstat (limited to 'source/blender/blenkernel/intern/particle.c')
-rw-r--r-- | source/blender/blenkernel/intern/particle.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/source/blender/blenkernel/intern/particle.c b/source/blender/blenkernel/intern/particle.c index ba75760c07a..26e7562590d 100644 --- a/source/blender/blenkernel/intern/particle.c +++ b/source/blender/blenkernel/intern/particle.c @@ -2794,7 +2794,9 @@ void psys_cache_edit_paths(Scene *scene, Object *ob, PTCacheEdit *edit, float cf /* frs_sec = (psys || edit->pid.flag & PTCACHE_VEL_PER_SEC) ? 25.0f : 1.0f; */ /* UNUSED */ - if (pset->brushtype == PE_BRUSH_WEIGHT) { + const bool use_weight = (pset->brushtype == PE_BRUSH_WEIGHT) && (psys != NULL) && (psys->particles != NULL); + + if (use_weight) { ; /* use weight painting colors now... */ } else { @@ -2824,7 +2826,7 @@ void psys_cache_edit_paths(Scene *scene, Object *ob, PTCacheEdit *edit, float cf /* should init_particle_interpolation set this ? */ - if (pset->brushtype == PE_BRUSH_WEIGHT) { + if (use_weight) { pind.hkey[0] = NULL; /* pa != NULL since the weight brush is only available for hair */ pind.hkey[0] = pa->hair; @@ -2885,7 +2887,7 @@ void psys_cache_edit_paths(Scene *scene, Object *ob, PTCacheEdit *edit, float cf } /* selection coloring in edit mode */ - if (pset->brushtype == PE_BRUSH_WEIGHT) { + if (use_weight) { if (k == 0) { weight_to_rgb(ca->col, pind.hkey[1]->weight); } |