[Bf-blender-cvs] [be405495a9c] blender2.8: Fix T57477: Switching between edit mode, and particle edit mode crashes

Sergey Sharybin noreply at git.blender.org
Fri Nov 16 14:22:43 CET 2018


Commit: be405495a9cfd70b531d6ca41e3f4a7f1e0ae9be
Author: Sergey Sharybin
Date:   Fri Nov 16 14:21:57 2018 +0100
Branches: blender2.8
https://developer.blender.org/rBbe405495a9cfd70b531d6ca41e3f4a7f1e0ae9be

Fix T57477: Switching between edit mode, and particle edit mode crashes

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

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 457ff5be4de..09d3beadb2a 100644
--- a/source/blender/editors/physics/particle_edit.c
+++ b/source/blender/editors/physics/particle_edit.c
@@ -4829,10 +4829,18 @@ static int particle_edit_toggle_exec(bContext *C, wmOperator *op)
 
 		edit = PE_create_current(depsgraph, scene, ob);
 
-		/* mesh may have changed since last entering editmode.
-		 * note, this may have run before if the edit data was just created, so could avoid this and speed up a little */
-		if (edit && edit->psys)
+		/* Mesh may have changed since last entering editmode.
+		 * note, this may have run before if the edit data was just created,
+		 * so could avoid this and speed up a little. */
+		if (edit && edit->psys) {
+			/* Make sure pointer to the evaluated modifier data is up to date,
+			 * with possible changes applied when object was outside of the
+			 * edit mode. */
+			Object *object_eval = DEG_get_evaluated_object(depsgraph, ob);
+			edit->psmd_eval = (ParticleSystemModifierData *)modifiers_findByName(
+			        object_eval, edit->psmd->modifier.name);
 			recalc_emitter_field(depsgraph, ob, edit->psys);
+		}
 
 		toggle_particle_cursor(C, 1);
 		WM_event_add_notifier(C, NC_SCENE | ND_MODE | NS_MODE_PARTICLE, NULL);



More information about the Bf-blender-cvs mailing list