[Bf-blender-cvs] [368414efacc] master: Fix T53823: Particle weight brush crash
Campbell Barton
noreply at git.blender.org
Fri Jan 19 02:17:28 CET 2018
Commit: 368414efacc2b7260c02b0cb77a7b24c1e054f39
Author: Campbell Barton
Date: Fri Jan 19 12:25:09 2018 +1100
Branches: master
https://developer.blender.org/rB368414efacc2b7260c02b0cb77a7b24c1e054f39
Fix T53823: Particle weight brush crash
Entering particle edit mode w/ the weight brush enabled crashed
on non-hair particle systems.
===================================================================
M source/blender/blenkernel/intern/particle.c
===================================================================
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);
}
More information about the Bf-blender-cvs
mailing list