diff options
6 files changed, 26 insertions, 13 deletions
diff --git a/source/blender/blenkernel/BKE_particle.h b/source/blender/blenkernel/BKE_particle.h index c23aa2f709c..72170da4ea2 100644 --- a/source/blender/blenkernel/BKE_particle.h +++ b/source/blender/blenkernel/BKE_particle.h @@ -418,6 +418,9 @@ typedef void (*ParticleSystemIDFunc)(struct ParticleSystem *psys, struct ID **id void BKE_particlesystem_id_loop(struct ParticleSystem *psys, ParticleSystemIDFunc func, void *userdata); +/* Reset all particle systems in the given object. */ +void BKE_particlesystem_reset_all(struct Object *object); + /* ----------- functions needed only inside particlesystem ------------ */ /* particle.c */ void psys_disable_all(struct Object *ob); diff --git a/source/blender/blenkernel/intern/particle_system.c b/source/blender/blenkernel/intern/particle_system.c index 458aec77379..f61786903f8 100644 --- a/source/blender/blenkernel/intern/particle_system.c +++ b/source/blender/blenkernel/intern/particle_system.c @@ -4414,6 +4414,18 @@ void BKE_particlesystem_id_loop(ParticleSystem *psys, ParticleSystemIDFunc func, } } +void BKE_particlesystem_reset_all(struct Object *object) +{ + for (ModifierData *md = object->modifiers.first; md != NULL; md = md->next) { + if (md->type != eModifierType_ParticleSystem) { + continue; + } + ParticleSystemModifierData *psmd = (ParticleSystemModifierData *)md; + ParticleSystem *psys = psmd->psys; + psys->recalc |= ID_RECALC_PSYS_RESET; + } +} + /* **** Depsgraph evaluation **** */ void BKE_particle_settings_eval_reset( diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc index 0ca1222f5ba..a27507954fb 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc @@ -1705,7 +1705,10 @@ void DepsgraphRelationBuilder::build_particle_systems(Object *object) ComponentKey eval_key(&object->id, NodeType::PARTICLE_SYSTEM); if (BKE_ptcache_object_has(scene_, object, 0)) { ComponentKey point_cache_key(&object->id, NodeType::POINT_CACHE); - add_relation(eval_key, point_cache_key, "Particle Point Cache"); + add_relation(eval_key, + point_cache_key, + "Particle Point Cache", + RELATION_FLAG_FLUSH_USER_EDIT_ONLY); } /* Particle systems. */ LISTBASE_FOREACH (ParticleSystem *, psys, &object->particlesystem) { diff --git a/source/blender/editors/object/object_edit.c b/source/blender/editors/object/object_edit.c index dff78d15692..958d9c08814 100644 --- a/source/blender/editors/object/object_edit.c +++ b/source/blender/editors/object/object_edit.c @@ -78,6 +78,7 @@ #include "BKE_modifier.h" #include "BKE_object.h" #include "BKE_paint.h" +#include "BKE_particle.h" #include "BKE_pointcache.h" #include "BKE_softbody.h" #include "BKE_editmesh.h" @@ -537,6 +538,7 @@ bool ED_object_editmode_exit_ex(Main *bmain, Scene *scene, Object *obedit, int f } BLI_freelistN(&pidlist); + BKE_particlesystem_reset_all(obedit); BKE_ptcache_object_reset(scene, obedit, PTCACHE_RESET_OUTDATED); /* also flush ob recalc, doesn't take much overhead, but used for particles */ diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c index d7ecfadcfc5..f3a06988f1b 100644 --- a/source/blender/editors/sculpt_paint/sculpt.c +++ b/source/blender/editors/sculpt_paint/sculpt.c @@ -67,7 +67,9 @@ #include "BKE_node.h" #include "BKE_object.h" #include "BKE_paint.h" +#include "BKE_particle.h" #include "BKE_pbvh.h" +#include "BKE_pointcache.h" #include "BKE_report.h" #include "BKE_screen.h" #include "BKE_subsurf.h" @@ -5569,6 +5571,9 @@ void sculpt_dynamic_topology_disable_ex( ss->bm_log = NULL; } + BKE_particlesystem_reset_all(ob); + BKE_ptcache_object_reset(scene, ob, PTCACHE_RESET_OUTDATED); + /* Refresh */ sculpt_update_after_dynamic_topology_toggle(depsgraph, scene, ob); } diff --git a/source/blender/modifiers/intern/MOD_particlesystem.c b/source/blender/modifiers/intern/MOD_particlesystem.c index bc1fb300cac..2c541c52919 100644 --- a/source/blender/modifiers/intern/MOD_particlesystem.c +++ b/source/blender/modifiers/intern/MOD_particlesystem.c @@ -187,18 +187,6 @@ static void deformVerts( BKE_id_free(NULL, mesh_src); } - /* report change in mesh structure */ - if (psmd->mesh_final->totvert != psmd->totdmvert || - psmd->mesh_final->totedge != psmd->totdmedge || - psmd->mesh_final->totface != psmd->totdmface) - { - psys->recalc |= ID_RECALC_PSYS_RESET; - - psmd->totdmvert = psmd->mesh_final->totvert; - psmd->totdmedge = psmd->mesh_final->totedge; - psmd->totdmface = psmd->mesh_final->totface; - } - if (!(ctx->object->transflag & OB_NO_PSYS_UPDATE)) { struct Scene *scene = DEG_get_evaluated_scene(ctx->depsgraph); psmd->flag &= ~eParticleSystemFlag_psys_updated; |