[Bf-blender-cvs] [0647232ac54] master: Fix particle editmode undo not doing proper updates when child particles are visible

Philipp Oeser noreply at git.blender.org
Thu Dec 19 21:05:00 CET 2019


Commit: 0647232ac545a7c56f6d5abd7700143fc4455024
Author: Philipp Oeser
Date:   Fri Sep 27 14:48:35 2019 +0200
Branches: master
https://developer.blender.org/rB0647232ac545a7c56f6d5abd7700143fc4455024

Fix particle editmode undo not doing proper updates when child particles
are visible

Not freeing PTCacheEdit and tagging batch cache dirty on undo will have
a couple of consequences. This patch fixes:
- crash deleting a particle, then undo
- basically any edit (combing, ...), then undo will leave child hairs
untouched
- adding hairs (through mirror, add tool, ...), then undo will leave
'orphaned' child hairs

See also D5755 for a related discussion

Fixes the crasher mentioned in T69000

Might move this to a utility function later [since it is used in more
places], but that is for after going over some more reports...

Reviewers: sergey

Differential Revision: https://developer.blender.org/D5912

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

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

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

diff --git a/source/blender/editors/physics/particle_edit_undo.c b/source/blender/editors/physics/particle_edit_undo.c
index aee79523c87..e85b025e28e 100644
--- a/source/blender/editors/physics/particle_edit_undo.c
+++ b/source/blender/editors/physics/particle_edit_undo.c
@@ -262,6 +262,11 @@ static void particle_undosys_step_decode(struct bContext *C,
   PTCacheEdit *edit = PE_get_current(depsgraph, scene, ob);
   if (edit) {
     undoptcache_to_editcache(&us->data, edit);
+    ParticleEditSettings *pset = &scene->toolsettings->particle;
+    if ((pset->flag & PE_DRAW_PART) != 0) {
+      psys_free_path_cache(NULL, edit);
+      BKE_particle_batch_cache_dirty_tag(edit->psys, BKE_PARTICLE_BATCH_DIRTY_ALL);
+    }
     DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY);
   }
   else {



More information about the Bf-blender-cvs mailing list