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
This commit is contained in:
@@ -622,12 +622,7 @@ static void sculpt_undo_restore_list(bContext *C, Depsgraph *depsgraph, ListBase
|
|||||||
|
|
||||||
if (lb->first) {
|
if (lb->first) {
|
||||||
unode = lb->first;
|
unode = lb->first;
|
||||||
if (unode->type == SCULPT_UNDO_GEOMETRY) {
|
if (unode->type == SCULPT_UNDO_FACE_SETS) {
|
||||||
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) {
|
|
||||||
sculpt_undo_restore_face_sets(C, unode);
|
sculpt_undo_restore_face_sets(C, unode);
|
||||||
|
|
||||||
rebuild = true;
|
rebuild = true;
|
||||||
@@ -653,11 +648,19 @@ static void sculpt_undo_restore_list(bContext *C, Depsgraph *depsgraph, ListBase
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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);
|
BKE_sculpt_update_object_for_edit(depsgraph, ob, false, need_mask);
|
||||||
|
}
|
||||||
|
|
||||||
if (lb->first && sculpt_undo_bmesh_restore(C, lb->first, ob, ss)) {
|
if (sculpt_undo_bmesh_restore(C, lb->first, ob, ss)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
char *undo_modified_grids = NULL;
|
char *undo_modified_grids = NULL;
|
||||||
bool use_multires_undo = false;
|
bool use_multires_undo = false;
|
||||||
@@ -705,13 +708,16 @@ static void sculpt_undo_restore_list(bContext *C, Depsgraph *depsgraph, ListBase
|
|||||||
case SCULPT_UNDO_FACE_SETS:
|
case SCULPT_UNDO_FACE_SETS:
|
||||||
break;
|
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_BEGIN:
|
||||||
case SCULPT_UNDO_DYNTOPO_END:
|
case SCULPT_UNDO_DYNTOPO_END:
|
||||||
case SCULPT_UNDO_DYNTOPO_SYMMETRIZE:
|
case SCULPT_UNDO_DYNTOPO_SYMMETRIZE:
|
||||||
BLI_assert(!"Dynamic topology should've already been handled");
|
BLI_assert(!"Dynamic topology should've already been handled");
|
||||||
break;
|
break;
|
||||||
case SCULPT_UNDO_GEOMETRY:
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user