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:
authorCampbell Barton <ideasman42@gmail.com>2019-01-31 08:02:23 +0300
committerCampbell Barton <ideasman42@gmail.com>2019-01-31 08:06:28 +0300
commit6df68efcbb97207f93abce7bc8abde2220444e79 (patch)
treebc56c4ba0c1a1c2c095470404cf31e13a521eea3 /source/blender/editors/mesh/editmesh_undo.c
parent293f4d88dac4919371e3e9c375f7c4cde803b078 (diff)
Fix edit-mesh undo using the current selection
Any meshes selected would be added to the mode when reading undo.
Diffstat (limited to 'source/blender/editors/mesh/editmesh_undo.c')
-rw-r--r--source/blender/editors/mesh/editmesh_undo.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/source/blender/editors/mesh/editmesh_undo.c b/source/blender/editors/mesh/editmesh_undo.c
index 97a411cba54..1a57fe49d39 100644
--- a/source/blender/editors/mesh/editmesh_undo.c
+++ b/source/blender/editors/mesh/editmesh_undo.c
@@ -723,14 +723,19 @@ static bool mesh_undosys_step_encode(struct bContext *C, struct Main *UNUSED(bma
return true;
}
-static void mesh_undosys_step_decode(struct bContext *C, struct Main *UNUSED(bmain), UndoStep *us_p, int UNUSED(dir))
+static void mesh_undosys_step_decode(struct bContext *C, struct Main *bmain, UndoStep *us_p, int UNUSED(dir))
{
- /* TODO(campbell): undo_system: use low-level API to set mode. */
- ED_object_mode_set(C, OB_MODE_EDIT);
- BLI_assert(mesh_undosys_poll(C));
-
MeshUndoStep *us = (MeshUndoStep *)us_p;
+ Scene *scene = CTX_data_scene(C);
+ for (uint i = 0; i < us->elems_len; i++) {
+ MeshUndoStep_Elem *elem = &us->elems[i];
+ Object *obedit = elem->obedit_ref.ptr;
+ ED_object_editmode_enter_ex(bmain, scene, obedit, EM_NO_CONTEXT);
+ }
+
+ BLI_assert(mesh_undosys_poll(C));
+
for (uint i = 0; i < us->elems_len; i++) {
MeshUndoStep_Elem *elem = &us->elems[i];
Object *obedit = elem->obedit_ref.ptr;