[Bf-blender-cvs] [8e54ef69c66] master: Fix T62700: Disconnect hair bug

Sergey Sharybin noreply at git.blender.org
Mon Mar 18 17:50:32 CET 2019


Commit: 8e54ef69c66ff2458a508e5119a52fb17ad81515
Author: Sergey Sharybin
Date:   Mon Mar 18 17:49:53 2019 +0100
Branches: master
https://developer.blender.org/rB8e54ef69c66ff2458a508e5119a52fb17ad81515

Fix T62700: Disconnect hair bug

Need to use evaluated mesh from evaluated modifier data.

===================================================================

M	source/blender/editors/physics/particle_object.c

===================================================================

diff --git a/source/blender/editors/physics/particle_object.c b/source/blender/editors/physics/particle_object.c
index ac304f1aeec..2287659ef03 100644
--- a/source/blender/editors/physics/particle_object.c
+++ b/source/blender/editors/physics/particle_object.c
@@ -52,6 +52,7 @@
 
 #include "DEG_depsgraph.h"
 #include "DEG_depsgraph_build.h"
+#include "DEG_depsgraph_query.h"
 
 #include "RNA_access.h"
 #include "RNA_define.h"
@@ -580,7 +581,10 @@ static void disconnect_hair(
         Depsgraph *depsgraph, Scene *scene,
         Object *ob, ParticleSystem *psys)
 {
-	ParticleSystemModifierData *psmd = psys_get_modifier(ob, psys);
+	Object *object_eval = DEG_get_evaluated_object(depsgraph, ob);
+	ParticleSystem *psys_eval = psys_eval_get(depsgraph, ob, psys);
+	ParticleSystemModifierData *psmd_eval =
+	        psys_get_modifier(object_eval, psys_eval);
 	ParticleEditSettings *pset = PE_settings(scene);
 	ParticleData *pa;
 	PTCacheEdit *edit;
@@ -605,7 +609,8 @@ static void disconnect_hair(
 			point++;
 		}
 
-		psys_mat_hair_to_global(ob, psmd->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);
@@ -678,7 +683,10 @@ static bool remap_hair_emitter(
         Object *target_ob, ParticleSystem *target_psys, PTCacheEdit *target_edit,
         float from_mat[4][4], float to_mat[4][4], bool from_global, bool to_global)
 {
-	ParticleSystemModifierData *target_psmd = psys_get_modifier(target_ob, target_psys);
+	Object *object_eval = DEG_get_evaluated_object(depsgraph, ob);
+	ParticleSystem *psys_eval = psys_eval_get(depsgraph, ob, psys);
+	ParticleSystemModifierData *target_psmd =
+	        psys_get_modifier(object_eval, psys_eval);
 	ParticleData *pa, *tpa;
 	PTCacheEditPoint *edit_point;
 	PTCacheEditKey *ekey;



More information about the Bf-blender-cvs mailing list