diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2020-03-27 18:42:24 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2020-04-02 17:29:51 +0300 |
commit | f868d51bdd3ed56cbf4ec74846b54caa8fe1fa1d (patch) | |
tree | 65272d85ccaf37023a831da5882cdb800dd4c7b9 /source/blender/editors/sculpt_paint/sculpt_undo.c | |
parent | 009dde69cde0030ab3048f17a55a826d1aeb8423 (diff) |
Sculpt Undo: Allow Geometry undo step to be non-exclusive
Before this change it was not possible to have base geometry
and grid coordinates to be stored in the same undo step.
Differential Revision: https://developer.blender.org/D7298
Diffstat (limited to 'source/blender/editors/sculpt_paint/sculpt_undo.c')
-rw-r--r-- | source/blender/editors/sculpt_paint/sculpt_undo.c | 28 |
1 files changed, 17 insertions, 11 deletions
diff --git a/source/blender/editors/sculpt_paint/sculpt_undo.c b/source/blender/editors/sculpt_paint/sculpt_undo.c index cccc5e29ba7..f6ed4fa21e0 100644 --- a/source/blender/editors/sculpt_paint/sculpt_undo.c +++ b/source/blender/editors/sculpt_paint/sculpt_undo.c @@ -622,12 +622,7 @@ static void sculpt_undo_restore_list(bContext *C, Depsgraph *depsgraph, ListBase if (lb->first) { unode = lb->first; - if (unode->type == SCULPT_UNDO_GEOMETRY) { - sculpt_undo_geometry_restore(unode, ob); - BKE_sculpt_update_object_for_edit(depsgraph, ob, false, need_mask); - return; - } - else if (unode->type == SCULPT_UNDO_FACE_SETS) { + if (unode->type == SCULPT_UNDO_FACE_SETS) { sculpt_undo_restore_face_sets(C, unode); rebuild = true; @@ -653,10 +648,18 @@ static void sculpt_undo_restore_list(bContext *C, Depsgraph *depsgraph, ListBase } } - BKE_sculpt_update_object_for_edit(depsgraph, ob, false, need_mask); + if (lb->first != NULL) { + /* Only do early object update for edits if first node needs this. + * Undo steps like geometry does not need object to be updated before they run and will + * ensure object is updated after the node is handled. */ + const SculptUndoNode *first_unode = (const SculptUndoNode *)lb->first; + if (first_unode->type != SCULPT_UNDO_GEOMETRY) { + BKE_sculpt_update_object_for_edit(depsgraph, ob, false, need_mask); + } - if (lb->first && sculpt_undo_bmesh_restore(C, lb->first, ob, ss)) { - return; + if (sculpt_undo_bmesh_restore(C, lb->first, ob, ss)) { + return; + } } char *undo_modified_grids = NULL; @@ -705,13 +708,16 @@ static void sculpt_undo_restore_list(bContext *C, Depsgraph *depsgraph, ListBase case SCULPT_UNDO_FACE_SETS: break; + case SCULPT_UNDO_GEOMETRY: + sculpt_undo_geometry_restore(unode, ob); + BKE_sculpt_update_object_for_edit(depsgraph, ob, false, need_mask); + break; + case SCULPT_UNDO_DYNTOPO_BEGIN: case SCULPT_UNDO_DYNTOPO_END: case SCULPT_UNDO_DYNTOPO_SYMMETRIZE: BLI_assert(!"Dynamic topology should've already been handled"); break; - case SCULPT_UNDO_GEOMETRY: - break; } } |