diff options
-rw-r--r-- | source/blender/blenkernel/intern/particle.c | 31 |
1 files changed, 24 insertions, 7 deletions
diff --git a/source/blender/blenkernel/intern/particle.c b/source/blender/blenkernel/intern/particle.c index 37607de9c36..d740963cde8 100644 --- a/source/blender/blenkernel/intern/particle.c +++ b/source/blender/blenkernel/intern/particle.c @@ -291,14 +291,31 @@ void psys_enable_all(Object *ob) bool psys_in_edit_mode(Depsgraph *depsgraph, ParticleSystem *psys) { - ViewLayer *view_layer = DEG_get_evaluated_view_layer(depsgraph); + const ViewLayer *view_layer = DEG_get_input_view_layer(depsgraph); + if (view_layer->basact == NULL) { + /* TODO(sergey): Needs double-check with multi-object edit. */ + return false; + } const bool use_render_params = (DEG_get_mode(depsgraph) == DAG_EVAL_RENDER); - - return (view_layer->basact && - (view_layer->basact->object->mode & OB_MODE_PARTICLE_EDIT) && - psys == psys_get_current((view_layer->basact)->object) && - (psys->edit || psys->pointcache->edit) && - !use_render_params); + const Object *object = view_layer->basact->object; + 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; + } + return (psys_orig->edit || psys->pointcache->edit) && + (use_render_params == false); } bool psys_check_enabled(Object *ob, ParticleSystem *psys, const bool use_render_params) |