diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2018-05-08 18:10:42 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2018-05-09 11:34:45 +0300 |
commit | afdc5c148bc16191be612a0a7770ee167196c039 (patch) | |
tree | 01cb0d709d5526d689e5ff16d7fc898c2d76439f /source/blender/editors | |
parent | 43c6ba9eeddc7fbe3875b73e4ae74920f4afd10b (diff) |
Draw manager: Use utility function to get particle edit mode
Makes it more local where we have to do all the tricky checks.
Diffstat (limited to 'source/blender/editors')
-rw-r--r-- | source/blender/editors/include/ED_particle.h | 2 | ||||
-rw-r--r-- | source/blender/editors/physics/particle_edit.c | 17 |
2 files changed, 19 insertions, 0 deletions
diff --git a/source/blender/editors/include/ED_particle.h b/source/blender/editors/include/ED_particle.h index f84015c53ee..8b522c91188 100644 --- a/source/blender/editors/include/ED_particle.h +++ b/source/blender/editors/include/ED_particle.h @@ -34,6 +34,7 @@ struct bContext; struct Object; +struct ParticleSystem; struct ParticleEditSettings; struct rcti; struct PTCacheEdit; @@ -46,6 +47,7 @@ void PE_free_ptcache_edit(struct PTCacheEdit *edit); int PE_start_edit(struct PTCacheEdit *edit); /* access */ +struct PTCacheEdit *PE_get_current_from_psys(struct ParticleSystem *psys); struct PTCacheEdit *PE_get_current(struct Scene *scene, struct Object *ob); struct PTCacheEdit *PE_create_current(struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob); void PE_current_changed(struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob); diff --git a/source/blender/editors/physics/particle_edit.c b/source/blender/editors/physics/particle_edit.c index d343264c2c9..78ee8939de5 100644 --- a/source/blender/editors/physics/particle_edit.c +++ b/source/blender/editors/physics/particle_edit.c @@ -189,6 +189,23 @@ 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 * |