Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/editors/physics/particle_edit_undo.c')
-rw-r--r--source/blender/editors/physics/particle_edit_undo.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/source/blender/editors/physics/particle_edit_undo.c b/source/blender/editors/physics/particle_edit_undo.c
index 5d2e0e5b6ef..c764a5fd80f 100644
--- a/source/blender/editors/physics/particle_edit_undo.c
+++ b/source/blender/editors/physics/particle_edit_undo.c
@@ -27,6 +27,8 @@
#include "MEM_guardedalloc.h"
+#include "CLG_log.h"
+
#include "DNA_meshdata_types.h"
#include "DNA_scene_types.h"
#include "DNA_windowmanager_types.h"
@@ -44,11 +46,15 @@
#include "ED_object.h"
#include "ED_particle.h"
#include "ED_physics.h"
+#include "ED_undo.h"
#include "particle_edit_utildefines.h"
#include "physics_intern.h"
+/** Only needed this locally. */
+static CLG_LogRef LOG = {"ed.undo.particle_edit"};
+
/* -------------------------------------------------------------------- */
/** \name Undo Conversion
* \{ */
@@ -251,13 +257,13 @@ static void particle_undosys_step_decode(struct bContext *C,
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_ex(C, OB_MODE_PARTICLE_EDIT, false, NULL);
- BLI_assert(particle_undosys_poll(C));
ParticleUndoStep *us = (ParticleUndoStep *)us_p;
Scene *scene = us->scene_ref.ptr;
Object *ob = us->object_ref.ptr;
+
+ ED_object_particle_edit_mode_enter_ex(depsgraph, scene, ob);
+
PTCacheEdit *edit = PE_get_current(depsgraph, scene, ob);
if (edit) {
undoptcache_to_editcache(&us->data, edit);
@@ -267,6 +273,10 @@ static void particle_undosys_step_decode(struct bContext *C,
BKE_particle_batch_cache_dirty_tag(edit->psys, BKE_PARTICLE_BATCH_DIRTY_ALL);
}
DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY);
+
+ ED_undo_object_set_active_or_warn(scene, CTX_data_view_layer(C), ob, us_p->name, &LOG);
+
+ BLI_assert(particle_undosys_poll(C));
}
else {
BLI_assert(0);