[Bf-blender-cvs] [f785fb299a0] blender2.8: Particle edit: Use proper modifier to get evaluated derived mesh from

Sergey Sharybin noreply at git.blender.org
Wed May 16 17:45:54 CEST 2018


Commit: f785fb299a058b1dec333657b77bdad5daf6a32e
Author: Sergey Sharybin
Date:   Wed May 16 17:45:21 2018 +0200
Branches: blender2.8
https://developer.blender.org/rBf785fb299a058b1dec333657b77bdad5daf6a32e

Particle edit: Use proper modifier to get evaluated derived mesh from

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

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

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

diff --git a/source/blender/editors/physics/particle_edit.c b/source/blender/editors/physics/particle_edit.c
index 164001b6150..e0427b4797c 100644
--- a/source/blender/editors/physics/particle_edit.c
+++ b/source/blender/editors/physics/particle_edit.c
@@ -642,9 +642,11 @@ static void foreach_mouse_hit_point(PEData *data, ForPointFunc func, int selecte
 
 static void foreach_mouse_hit_key(PEData *data, ForKeyMatFunc func, int selected)
 {
+	Object *ob_eval = DEG_get_evaluated_object(data->depsgraph, data->ob);
 	PTCacheEdit *edit = data->edit;
 	ParticleSystem *psys = edit->psys;
 	ParticleSystemModifierData *psmd = NULL;
+	ParticleSystemModifierData *psmd_eval = NULL;
 	ParticleEditSettings *pset= PE_settings(data->scene);
 	POINT_P; KEY_K;
 	float mat[4][4], imat[4][4];
@@ -655,6 +657,10 @@ static void foreach_mouse_hit_key(PEData *data, ForKeyMatFunc func, int selected
 	if (edit->psys)
 		psmd= psys_get_modifier(data->ob, edit->psys);
 
+	if (psmd != NULL) {
+		psmd_eval = (ParticleSystemModifierData *)modifiers_findByName(ob_eval, psmd->modifier.name);
+	}
+
 	/* all is selected in path mode */
 	if (pset->selectmode==SCE_SELECT_PATH)
 		selected= 0;
@@ -668,7 +674,7 @@ static void foreach_mouse_hit_key(PEData *data, ForKeyMatFunc func, int selected
 				if (selected==0 || key->flag & PEK_SELECT) {
 					if (key_inside_circle(data, data->rad, KEY_WCO, &data->dist)) {
 						if (edit->psys && !(edit->psys->flag & PSYS_GLOBAL_HAIR)) {
-							psys_mat_hair_to_global(data->ob, psmd->mesh_final, psys->part->from, psys->particles + p, mat);
+							psys_mat_hair_to_global(data->ob, psmd_eval->mesh_final, psys->part->from, psys->particles + p, mat);
 							invert_m4_m4(imat, mat);
 						}
 
@@ -683,7 +689,7 @@ static void foreach_mouse_hit_key(PEData *data, ForKeyMatFunc func, int selected
 				if (selected==0 || key->flag & PEK_SELECT) {
 					if (key_inside_circle(data, data->rad, KEY_WCO, &data->dist)) {
 						if (edit->psys && !(edit->psys->flag & PSYS_GLOBAL_HAIR)) {
-							psys_mat_hair_to_global(data->ob, psmd->mesh_final, psys->part->from, psys->particles + p, mat);
+							psys_mat_hair_to_global(data->ob, psmd_eval->mesh_final, psys->part->from, psys->particles + p, mat);
 							invert_m4_m4(imat, mat);
 						}



More information about the Bf-blender-cvs mailing list