Merge branch 'blender-v2.83-release'

This commit is contained in:
Sergey Sharybin 2020-05-11 15:32:50 +02:00
commit 8c6391a9b3
2 changed files with 35 additions and 20 deletions

View File

@ -427,10 +427,6 @@ void BKE_undosys_stack_limit_steps_and_memory(UndoStack *ustack, int steps, size
}
if (us) {
if (us->prev && us->prev->prev) {
us = us->prev;
}
#ifdef WITH_GLOBAL_UNDO_KEEP_ONE
/* Hack, we need to keep at least one BKE_UNDOSYS_TYPE_MEMFILE. */
if (us->type != BKE_UNDOSYS_TYPE_MEMFILE) {
@ -438,6 +434,12 @@ void BKE_undosys_stack_limit_steps_and_memory(UndoStack *ustack, int steps, size
while (us_exclude && us_exclude->type != BKE_UNDOSYS_TYPE_MEMFILE) {
us_exclude = us_exclude->prev;
}
/* Once this is outside the given number of 'steps', undoing onto this state
* may skip past many undo steps which is confusing, instead,
* disallow stepping onto this state entirely. */
if (us_exclude) {
us_exclude->skip = true;
}
}
#endif
/* Free from first to last, free functions may update de-duplication info
@ -672,7 +674,15 @@ bool BKE_undosys_step_undo_with_data_ex(UndoStack *ustack,
us = us_prev;
}
if (us != NULL) {
/* This will be active once complete. */
UndoStep *us_active = us_prev;
if (use_skip) {
while (us_active && us_active->skip) {
us_active = us_active->prev;
}
}
if ((us != NULL) && (us_active != NULL)) {
CLOG_INFO(&LOG, 1, "addr=%p, name='%s', type='%s'", us, us->name, us->type->name);
/* Handle accumulate steps. */
@ -689,13 +699,6 @@ bool BKE_undosys_step_undo_with_data_ex(UndoStack *ustack,
}
}
UndoStep *us_active = us_prev;
if (use_skip) {
while (us_active->skip && us_active->prev) {
us_active = us_active->prev;
}
}
{
UndoStep *us_iter = us_prev;
do {
@ -744,7 +747,15 @@ bool BKE_undosys_step_redo_with_data_ex(UndoStack *ustack,
/* Unlike undo accumulate, we always use the next. */
us = us_next;
if (us != NULL) {
/* This will be active once complete. */
UndoStep *us_active = us_next;
if (use_skip) {
while (us_active && us_active->skip) {
us_active = us_active->next;
}
}
if ((us != NULL) && (us_active != NULL)) {
CLOG_INFO(&LOG, 1, "addr=%p, name='%s', type='%s'", us, us->name, us->type->name);
/* Handle accumulate steps. */
@ -756,13 +767,6 @@ bool BKE_undosys_step_redo_with_data_ex(UndoStack *ustack,
}
}
UndoStep *us_active = us_next;
if (use_skip) {
while (us_active->skip && us_active->prev) {
us_active = us_active->next;
}
}
{
UndoStep *us_iter = us_next;
do {

View File

@ -1565,6 +1565,17 @@ static bool sculpt_undo_use_multires_mesh(bContext *C)
static void sculpt_undo_push_all_grids(Object *object)
{
SculptSession *ss = object->sculpt;
/* It is possible that undo push is done from an object state where there is no PBVH. This
* happens, for example, when an operation which tagged for geometry update was performed prior
* to the current operation without making any stroke inbetween.
*
* Skip pushing nodes based on the following logic: on redo SCULPT_UNDO_COORDS will ensure
* PBVH for the new base geometry, which will have same coordinates as if we create PBVH here. */
if (ss->pbvh == NULL) {
return;
}
PBVHNode **nodes;
int totnodes;