diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2018-05-11 15:54:50 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2018-05-11 15:55:58 +0300 |
commit | aefd181b0b19403eaa6643e63901ff1cd740f881 (patch) | |
tree | 28317d013fe44a1911fc3a6b2cc9111f69646d95 /source/blender/editors/physics | |
parent | af5428aa2b4d4c6255c98cc0c22e618ec0d43ff8 (diff) |
Fix crash going to edit mode of particles with copy on write
We can not rely on edit->psys, it is not set for particle edit,
and there is some logic deeper inside which does different things
dependent on that.
We need to replace those checks with some some HAIR vs. PARTICLES
flag and always set psys pointer.
Diffstat (limited to 'source/blender/editors/physics')
-rw-r--r-- | source/blender/editors/physics/particle_edit.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/source/blender/editors/physics/particle_edit.c b/source/blender/editors/physics/particle_edit.c index d42989424be..f65e598e204 100644 --- a/source/blender/editors/physics/particle_edit.c +++ b/source/blender/editors/physics/particle_edit.c @@ -191,6 +191,24 @@ static float pe_brush_size_get(const Scene *UNUSED(scene), ParticleBrushData *br return brush->size * U.pixelsize; } +PTCacheEdit *PE_get_current_from_psys(ParticleSystem *psys) +{ + if (psys->part && psys->part->type == PART_HAIR) { + if ((psys->flag & PSYS_HAIR_DYNAMICS) != 0 && + (psys->pointcache->flag & PTCACHE_BAKED) != 0) + { + return psys->pointcache->edit; + } + else { + return psys->edit; + } + } + else if (psys->pointcache->flag & PTCACHE_BAKED) { + return psys->pointcache->edit; + } + return NULL; +} + /* always gets at least the first particlesystem even if PSYS_CURRENT flag is not set * * note: this function runs on poll, therefor it can runs many times a second |