[Bf-blender-cvs] [f868d51bdd3] master: Sculpt Undo: Allow Geometry undo step to be non-exclusive
Sergey Sharybin
noreply at git.blender.org
Thu Apr 2 16:37:16 CEST 2020
Commit: f868d51bdd3ed56cbf4ec74846b54caa8fe1fa1d
Author: Sergey Sharybin
Date: Fri Mar 27 16:42:24 2020 +0100
Branches: master
https://developer.blender.org/rBf868d51bdd3ed56cbf4ec74846b54caa8fe1fa1d
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
===================================================================
M source/blender/editors/sculpt_paint/sculpt_undo.c
===================================================================
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;
}
}
More information about the Bf-blender-cvs
mailing list