Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Sharybin <sergey.vfx@gmail.com>2019-06-05 13:39:40 +0300
committerSergey Sharybin <sergey.vfx@gmail.com>2019-06-13 12:34:01 +0300
commit36faf739a71624b6ca10cec7233779f9eeace0bd (patch)
treead57fbc75b6bce4bdc590384a3fdf4eeb5fdbaf0 /source/blender/blenkernel/intern/particle_system.c
parent27537daee1b62aab0fb0d01b89b7d2c044e796cd (diff)
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
Diffstat (limited to 'source/blender/blenkernel/intern/particle_system.c')
-rw-r--r--source/blender/blenkernel/intern/particle_system.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/source/blender/blenkernel/intern/particle_system.c b/source/blender/blenkernel/intern/particle_system.c
index 27722aab2d9..1b0655c6734 100644
--- a/source/blender/blenkernel/intern/particle_system.c
+++ b/source/blender/blenkernel/intern/particle_system.c
@@ -467,7 +467,7 @@ void psys_thread_context_init(ParticleThreadContext *ctx, ParticleSimulationData
{
memset(ctx, 0, sizeof(ParticleThreadContext));
ctx->sim = *sim;
- ctx->mesh = ctx->sim.psmd->mesh_final;
+ ctx->mesh = BKE_particle_modifier_mesh_final_get(ctx->sim.psmd);
ctx->ma = give_current_material(sim->ob, sim->psys->part->omat);
}
@@ -3348,6 +3348,7 @@ static void hair_create_input_mesh(ParticleSimulationData *sim,
/* make vgroup for pin roots etc.. */
hair_index = 1;
+ Mesh *mesh_final = BKE_particle_modifier_mesh_final_get(sim->psmd);
LOOP_PARTICLES
{
if (!(pa->flag & PARS_UNEXIST)) {
@@ -3358,7 +3359,7 @@ static void hair_create_input_mesh(ParticleSimulationData *sim,
pa->hair_index = hair_index;
use_hair = psys_hair_use_simulation(pa, max_length);
- psys_mat_hair_to_object(sim->ob, sim->psmd->mesh_final, psys->part->from, pa, hairmat);
+ psys_mat_hair_to_object(sim->ob, mesh_final, psys->part->from, pa, hairmat);
mul_m4_m4m4(root_mat, sim->ob->obmat, hairmat);
normalize_m4(root_mat);
@@ -3524,7 +3525,9 @@ static void hair_step(ParticleSimulationData *sim, float cfra, const bool use_re
if (psys->recalc & ID_RECALC_PSYS_RESET) {
/* need this for changing subsurf levels */
- psys_calc_dmcache(sim->ob, sim->psmd->mesh_final, sim->psmd->mesh_original, psys);
+ Mesh *mesh_final = BKE_particle_modifier_mesh_final_get(sim->psmd);
+ Mesh *mesh_original = BKE_particle_modifier_mesh_original_get(sim->psmd);
+ psys_calc_dmcache(sim->ob, mesh_final, mesh_original, psys);
if (psys->clmd) {
cloth_free_modifier(psys->clmd);
@@ -3576,7 +3579,8 @@ static void save_hair(ParticleSimulationData *sim, float UNUSED(cfra))
if (pa->totkey) {
sub_v3_v3(key->co, root->co);
- psys_vec_rot_to_face(sim->psmd->mesh_final, pa, key->co);
+ Mesh *mesh_final = BKE_particle_modifier_mesh_final_get(sim->psmd);
+ psys_vec_rot_to_face(mesh_final, pa, key->co);
}
key->time = pa->state.time;
@@ -4610,12 +4614,13 @@ void particle_system_update(struct Depsgraph *depsgraph,
}
}
- if (!sim.psmd->mesh_final) {
+ Mesh *mesh_final = BKE_particle_modifier_mesh_final_get(sim.psmd);
+ if (!mesh_final) {
return;
}
if (part->from != PART_FROM_VERT) {
- BKE_mesh_tessface_ensure(sim.psmd->mesh_final);
+ BKE_mesh_tessface_ensure(mesh_final);
}
/* to verify if we need to restore object afterwards */