diff options
author | Philipp Oeser <info@graphics-engineer.com> | 2019-09-26 18:24:29 +0300 |
---|---|---|
committer | Philipp Oeser <info@graphics-engineer.com> | 2019-09-26 18:27:43 +0300 |
commit | cf2c09002fae1e5b11acc0f21b67ffb29212ad7a (patch) | |
tree | 5b8b93171e8c9b838a504563888cc48bc91024e3 /source/blender/editors/physics/particle_edit_undo.c | |
parent | 6a33e3b990f39f20ae075fecf29aaa968932c989 (diff) |
Fix T69488: Hair particles: rekey disolves the hair then crashes
Caused by rB914427afd512.
Since above commit 'pe_get_current' checks for an active depsgraph. This
caused the skipping of handling
`PT_CACHE_EDIT_UPDATE_PARTICLE_FROM_EVAL`for everything calling
`PE_get_current` (this passes a NULL depsgraph as opposed to
`PE_create_current`). So we now pass a depsgraph here as well...
Note there are two RNA cases where we pass NULL, namely
- rna_ParticleEdit_editable_get
- rna_ParticleEdit_hair_get
I guess these should be fine though (no functional change to current
master)
Reviewers: sergey
Maniphest Tasks: T69488
Differential Revision: https://developer.blender.org/D5752
Diffstat (limited to 'source/blender/editors/physics/particle_edit_undo.c')
-rw-r--r-- | source/blender/editors/physics/particle_edit_undo.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/source/blender/editors/physics/particle_edit_undo.c b/source/blender/editors/physics/particle_edit_undo.c index 40d90676487..914250259c6 100644 --- a/source/blender/editors/physics/particle_edit_undo.c +++ b/source/blender/editors/physics/particle_edit_undo.c @@ -228,10 +228,11 @@ typedef struct ParticleUndoStep { static bool particle_undosys_poll(struct bContext *C) { + Depsgraph *depsgraph = CTX_data_depsgraph_pointer(C); Scene *scene = CTX_data_scene(C); ViewLayer *view_layer = CTX_data_view_layer(C); Object *ob = OBACT(view_layer); - PTCacheEdit *edit = PE_get_current(scene, ob); + PTCacheEdit *edit = PE_get_current(depsgraph, scene, ob); return (edit != NULL); } @@ -240,11 +241,12 @@ static bool particle_undosys_step_encode(struct bContext *C, struct Main *UNUSED(bmain), UndoStep *us_p) { + Depsgraph *depsgraph = CTX_data_depsgraph_pointer(C); ParticleUndoStep *us = (ParticleUndoStep *)us_p; ViewLayer *view_layer = CTX_data_view_layer(C); us->scene_ref.ptr = CTX_data_scene(C); us->object_ref.ptr = OBACT(view_layer); - PTCacheEdit *edit = PE_get_current(us->scene_ref.ptr, us->object_ref.ptr); + PTCacheEdit *edit = PE_get_current(depsgraph, us->scene_ref.ptr, us->object_ref.ptr); undoptcache_from_editcache(&us->data, edit); return true; } @@ -255,6 +257,7 @@ static void particle_undosys_step_decode(struct bContext *C, int UNUSED(dir), bool UNUSED(is_final)) { + Depsgraph *depsgraph = CTX_data_depsgraph_pointer(C); /* TODO(campbell): undo_system: use low-level API to set mode. */ ED_object_mode_set(C, OB_MODE_PARTICLE_EDIT); BLI_assert(particle_undosys_poll(C)); @@ -262,7 +265,7 @@ static void particle_undosys_step_decode(struct bContext *C, ParticleUndoStep *us = (ParticleUndoStep *)us_p; Scene *scene = us->scene_ref.ptr; Object *ob = us->object_ref.ptr; - PTCacheEdit *edit = PE_get_current(scene, ob); + PTCacheEdit *edit = PE_get_current(depsgraph, scene, ob); if (edit) { undoptcache_to_editcache(&us->data, edit); DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY); |