diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2019-06-21 12:49:43 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2019-06-21 13:09:45 +0300 |
commit | 7070e4c15e6c57da2bd46534e654ed5f9a1e6600 (patch) | |
tree | 221ceb5195fd6d98d4485db40e78d16a379107c5 /source/blender/editors/physics/particle_object.c | |
parent | 964e319a39abfe3808fded71dcacd296401ec04d (diff) |
Revert "Particle system: Move runtime data to runtime field"
This reverts commit 36faf739a71624b6ca10cec7233779f9eeace0bd.
Somewhat annoying but this change had some unforeseen consequences,
which lead to an actual bug.
Since this change was not sufficient to get original report fixed
is easier to simply revert for now.
Fixes T65842: Hair disappears when clicking on particle system name
Diffstat (limited to 'source/blender/editors/physics/particle_object.c')
-rw-r--r-- | source/blender/editors/physics/particle_object.c | 23 |
1 files changed, 9 insertions, 14 deletions
diff --git a/source/blender/editors/physics/particle_object.c b/source/blender/editors/physics/particle_object.c index d85bf72851d..b03ec56c7e4 100644 --- a/source/blender/editors/physics/particle_object.c +++ b/source/blender/editors/physics/particle_object.c @@ -620,7 +620,6 @@ static void disconnect_hair(Depsgraph *depsgraph, Scene *scene, Object *ob, Part edit = psys->edit; point = edit ? edit->points : NULL; - Mesh *mesh_final = BKE_particle_modifier_mesh_final_get(psmd_eval); for (i = 0, pa = psys->particles; i < psys->totpart; i++, pa++) { if (point) { @@ -628,7 +627,7 @@ static void disconnect_hair(Depsgraph *depsgraph, Scene *scene, Object *ob, Part point++; } - psys_mat_hair_to_global(ob, mesh_final, psys->part->from, pa, hairmat); + psys_mat_hair_to_global(ob, psmd_eval->mesh_final, psys->part->from, pa, hairmat); for (k = 0, key = pa->hair; k < pa->totkey; k++, key++) { mul_m4_v3(hairmat, key->co); @@ -726,8 +725,7 @@ static bool remap_hair_emitter(Depsgraph *depsgraph, float from_ob_imat[4][4], to_ob_imat[4][4]; float from_imat[4][4], to_imat[4][4]; - Mesh *target_mesh_final = BKE_particle_modifier_mesh_final_get(target_psmd); - if (!target_mesh_final) { + if (!target_psmd->mesh_final) { return false; } if (!psys->part || psys->part->type != PART_HAIR) { @@ -744,14 +742,14 @@ static bool remap_hair_emitter(Depsgraph *depsgraph, invert_m4_m4(from_imat, from_mat); invert_m4_m4(to_imat, to_mat); - if (target_mesh_final->runtime.deformed_only) { + if (target_psmd->mesh_final->runtime.deformed_only) { /* we don't want to mess up target_psmd->dm when converting to global coordinates below */ - mesh = target_mesh_final; + mesh = target_psmd->mesh_final; } else { - mesh = BKE_particle_modifier_mesh_original_get(target_psmd); + mesh = target_psmd->mesh_original; } - target_mesh = target_mesh_final; + target_mesh = target_psmd->mesh_final; if (mesh == NULL) { return false; } @@ -1157,13 +1155,10 @@ static bool copy_particle_systems_to_object(const bContext *C, modifier_unique_name(&ob_to->modifiers, (ModifierData *)psmd); psmd->psys = psys; + BKE_id_copy_ex(NULL, &final_mesh->id, (ID **)&psmd->mesh_final, LIB_ID_COPY_LOCALIZE); - /* TODO(sergey): This should probably be accessing evaluated psmd. */ - ParticleSystemModifierDataRuntime *runtime = BKE_particle_modifier_runtime_ensure(psmd); - BKE_id_copy_ex(NULL, &final_mesh->id, (ID **)&runtime->mesh_final, LIB_ID_COPY_LOCALIZE); - - BKE_mesh_calc_normals(runtime->mesh_final); - BKE_mesh_tessface_ensure(runtime->mesh_final); + BKE_mesh_calc_normals(psmd->mesh_final); + BKE_mesh_tessface_ensure(psmd->mesh_final); if (psys_from->edit) { copy_particle_edit(depsgraph, scene, ob_to, psys, psys_from); |