From 36faf739a71624b6ca10cec7233779f9eeace0bd Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Wed, 5 Jun 2019 12:39:40 +0200 Subject: Particle system: Move runtime data to runtime field Allows it to be preserved during copy-on-write update when on-geometry related update is needed. This is a required part for T63537, where we need to preserve the entire evaluation data when object is tagged for only RECALC_COPY_ON_WRITE. Reviewers: brecht Reviewed By: brecht Differential Revision: https://developer.blender.org/D5023 --- source/blender/blenkernel/intern/particle_distribute.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'source/blender/blenkernel/intern/particle_distribute.c') diff --git a/source/blender/blenkernel/intern/particle_distribute.c b/source/blender/blenkernel/intern/particle_distribute.c index 070c3c7a566..7bb2daeab23 100644 --- a/source/blender/blenkernel/intern/particle_distribute.c +++ b/source/blender/blenkernel/intern/particle_distribute.c @@ -878,7 +878,7 @@ static int psys_thread_context_init_distribute(ParticleThreadContext *ctx, int from) { Scene *scene = sim->scene; - Mesh *final_mesh = sim->psmd->mesh_final; + Mesh *final_mesh = BKE_particle_modifier_mesh_final_get(sim->psmd); Object *ob = sim->ob; ParticleSystem *psys = sim->psys; ParticleData *pa = 0, *tpars = 0; @@ -926,8 +926,8 @@ static int psys_thread_context_init_distribute(ParticleThreadContext *ctx, if (from == PART_FROM_CHILD) { /* Simple children */ if (part->childtype != PART_CHILD_FACES) { - distribute_simple_children( - scene, ob, final_mesh, sim->psmd->mesh_original, psys, use_render_params); + Mesh *mesh_original = BKE_particle_modifier_mesh_original_get(sim->psmd); + distribute_simple_children(scene, ob, final_mesh, mesh_original, psys, use_render_params); return 0; } } @@ -1318,7 +1318,7 @@ static void distribute_particles_on_dm(ParticleSimulationData *sim, int from) TaskPool *task_pool; ParticleThreadContext ctx; ParticleTask *tasks; - Mesh *final_mesh = sim->psmd->mesh_final; + Mesh *final_mesh = BKE_particle_modifier_mesh_final_get(sim->psmd); int i, totpart, numtasks; /* create a task pool for distribution tasks */ @@ -1346,7 +1346,8 @@ static void distribute_particles_on_dm(ParticleSimulationData *sim, int from) BLI_task_pool_free(task_pool); - psys_calc_dmcache(sim->ob, final_mesh, sim->psmd->mesh_original, sim->psys); + Mesh *mesh_original = BKE_particle_modifier_mesh_original_get(sim->psmd); + psys_calc_dmcache(sim->ob, final_mesh, mesh_original, sim->psys); if (ctx.mesh != final_mesh) { BKE_id_free(NULL, ctx.mesh); @@ -1371,7 +1372,8 @@ void distribute_particles(ParticleSimulationData *sim, int from) int distr_error = 0; if (psmd) { - if (psmd->mesh_final) { + Mesh *mesh_final = BKE_particle_modifier_mesh_final_get(psmd); + if (mesh_final) { distribute_particles_on_dm(sim, from); } else { -- cgit v1.2.3