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:
authorAleksi Juvani <aleksijuvani>2022-01-05 18:36:34 +0300
committerPhilipp Oeser <info@graphics-engineer.com>2022-01-18 11:40:52 +0300
commita4171f48661b87b4a2e4ca66f1156c863261d759 (patch)
tree2be5cfeda6f658c6f40e0605e50828e1b158c310
parentb61a9121282937b6d56f00a63fb6c6d78a7ddd86 (diff)
Fix T54488: hair disconnect/reconnect not working with modifiers
Take the Use Modifier Stack setting into account when connecting hair, and fix wrong results results when using deforming modifiers also. Differential Revision: https://developer.blender.org/D13704
-rw-r--r--source/blender/editors/physics/particle_object.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/source/blender/editors/physics/particle_object.c b/source/blender/editors/physics/particle_object.c
index f37a20bf43e..794b59b4c8a 100644
--- a/source/blender/editors/physics/particle_object.c
+++ b/source/blender/editors/physics/particle_object.c
@@ -742,8 +742,10 @@ static bool remap_hair_emitter(Depsgraph *depsgraph,
invert_m4_m4(from_imat, from_mat);
invert_m4_m4(to_imat, to_mat);
- if (target_psmd->mesh_final->runtime.deformed_only) {
- /* we don't want to mess up target_psmd->dm when converting to global coordinates below */
+ const bool use_dm_final_indices = (target_psys->part->use_modifier_stack &&
+ !target_psmd->mesh_final->runtime.deformed_only);
+
+ if (use_dm_final_indices) {
mesh = target_psmd->mesh_final;
}
else {
@@ -823,7 +825,13 @@ static bool remap_hair_emitter(Depsgraph *depsgraph,
tpa->foffset = 0.0f;
tpa->num = nearest.index;
- tpa->num_dmcache = psys_particle_dm_face_lookup(target_mesh, mesh, tpa->num, tpa->fuv, NULL);
+ if (use_dm_final_indices) {
+ tpa->num_dmcache = DMCACHE_ISCHILD;
+ }
+ else {
+ tpa->num_dmcache = psys_particle_dm_face_lookup(
+ target_psmd->mesh_final, target_psmd->mesh_original, tpa->num, tpa->fuv, NULL);
+ }
}
else {
me = &medge[nearest.index];