diff options
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r-- | source/blender/blenkernel/BKE_particle.h | 1 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/particle.c | 22 |
2 files changed, 10 insertions, 13 deletions
diff --git a/source/blender/blenkernel/BKE_particle.h b/source/blender/blenkernel/BKE_particle.h index 0c8d00e16a3..c2217969c98 100644 --- a/source/blender/blenkernel/BKE_particle.h +++ b/source/blender/blenkernel/BKE_particle.h @@ -302,6 +302,7 @@ void psys_set_current_num(Object *ob, int index); struct LatticeDeformData *psys_create_lattice_deform_data(struct ParticleSimulationData *sim); +struct ParticleSystem *psys_original_get(struct ParticleSystem *psys); bool psys_in_edit_mode(struct Depsgraph *depsgraph, struct ParticleSystem *psys); bool psys_check_enabled(struct Object *ob, struct ParticleSystem *psys, const bool use_render_params); bool psys_check_edited(struct ParticleSystem *psys); diff --git a/source/blender/blenkernel/intern/particle.c b/source/blender/blenkernel/intern/particle.c index d740963cde8..0f23fc1deea 100644 --- a/source/blender/blenkernel/intern/particle.c +++ b/source/blender/blenkernel/intern/particle.c @@ -289,6 +289,14 @@ void psys_enable_all(Object *ob) psys->flag &= ~PSYS_DISABLED; } +ParticleSystem *psys_original_get(ParticleSystem *psys) +{ + if (psys->orig_psys == NULL) { + return psys; + } + return psys->orig_psys; +} + bool psys_in_edit_mode(Depsgraph *depsgraph, ParticleSystem *psys) { const ViewLayer *view_layer = DEG_get_input_view_layer(depsgraph); @@ -301,19 +309,7 @@ bool psys_in_edit_mode(Depsgraph *depsgraph, ParticleSystem *psys) if (object->mode != OB_MODE_PARTICLE_EDIT) { return false; } - /* TODO(sergey): Find a faster way to switch to an original psys. */ - /*const*/ Object *object_orig = DEG_get_original_object(view_layer->basact->object); - ParticleSystem *psys_orig = object_orig->particlesystem.first; - while (psys_orig != NULL) { - if (STREQ(psys_orig->name, psys->name)) { - break; - } - psys = psys->next; - psys_orig = psys_orig->next; - } - if (psys_orig != psys_get_current(object_orig)) { - return false; - } + ParticleSystem *psys_orig = psys_original_get(psys); return (psys_orig->edit || psys->pointcache->edit) && (use_render_params == false); } |