diff --git a/source/blender/editors/physics/particle_edit.c b/source/blender/editors/physics/particle_edit.c index 7f8f08beaac..3df934a8dca 100644 --- a/source/blender/editors/physics/particle_edit.c +++ b/source/blender/editors/physics/particle_edit.c @@ -1101,10 +1101,12 @@ void recalc_lengths(PTCacheEdit *edit) } /* calculate a tree for finding nearest emitter's vertice */ -void recalc_emitter_field(Object *ob, ParticleSystem *psys) +void recalc_emitter_field(Depsgraph *depsgraph, Object *ob, ParticleSystem *psys) { - DerivedMesh *dm=psys_get_modifier(ob, psys)->dm_final; - PTCacheEdit *edit= psys->edit; + Object *object_eval = DEG_get_evaluated_object(depsgraph, ob); + ParticleSystem *psys_eval = psys_eval_get(depsgraph, ob, psys); + DerivedMesh *dm = psys_get_modifier(object_eval, psys_eval)->dm_final; + PTCacheEdit *edit = psys->edit; float *vec, *nor; int i, totface /*, totvert*/; @@ -4451,7 +4453,7 @@ void PE_create_particle_edit( recalc_lengths(edit); if (psys && !cache) - recalc_emitter_field(ob, psys); + recalc_emitter_field(depsgraph, ob, psys); PE_update_object(depsgraph, scene, ob, 1); } @@ -4497,7 +4499,7 @@ static int particle_edit_toggle_exec(bContext *C, wmOperator *op) /* mesh may have changed since last entering editmode. * note, this may have run before if the edit data was just created, so could avoid this and speed up a little */ if (edit && edit->psys) - recalc_emitter_field(ob, edit->psys); + recalc_emitter_field(depsgraph, ob, edit->psys); toggle_particle_cursor(C, 1); WM_event_add_notifier(C, NC_SCENE|ND_MODE|NS_MODE_PARTICLE, NULL); diff --git a/source/blender/editors/physics/particle_object.c b/source/blender/editors/physics/particle_object.c index 76308fe1fd7..79d52abb32d 100644 --- a/source/blender/editors/physics/particle_object.c +++ b/source/blender/editors/physics/particle_object.c @@ -952,7 +952,7 @@ static void copy_particle_edit( UI_GetThemeColor3ubv(TH_WIRE, edit->nosel_col); recalc_lengths(edit); - recalc_emitter_field(ob, psys); + recalc_emitter_field(depsgraph, ob, psys); PE_update_object(depsgraph, scene, ob, true); } diff --git a/source/blender/editors/physics/physics_intern.h b/source/blender/editors/physics/physics_intern.h index 108c033a87c..e94f582141b 100644 --- a/source/blender/editors/physics/physics_intern.h +++ b/source/blender/editors/physics/physics_intern.h @@ -74,7 +74,7 @@ void PE_create_particle_edit( struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob, struct PointCache *cache, struct ParticleSystem *psys); void recalc_lengths(struct PTCacheEdit *edit); -void recalc_emitter_field(struct Object *ob, struct ParticleSystem *psys); +void recalc_emitter_field(struct Depsgraph *depsgraph, struct Object *ob, struct ParticleSystem *psys); void update_world_cos(struct Depsgraph *depsgraph, struct Object *ob, struct PTCacheEdit *edit); /* particle_object.c */