Last undo in undo history reverting multiple actions #73180

Closed
opened 2020-01-17 10:42:18 +01:00 by Dominik Kosík · 7 comments

Version:
Tested with version 8.32 alpha, windows x64 self compiled (master branch, date 2020-01-16, commit 2cd3298fde)
(present in stable release, possibly since rework of undo)

Bug description:
When going on last undo in undo history (assuming enough actions were done to start overwriting undo stack) going one step further (ctrl+z) makes Blender skip several actions back.

Replication:
Creating cube, subdividing and removing faces till the maximum capacity of undo stack is reached (and a bit more after).
After doing undo till possible. Last undo will be large skip of actions (mentioned bug)
Alternatively selecting last undo from undo history and then making one more undo with undo button (or ctrl+z)
PS: The easy way is to set undo steps to a minimum to faster reach overwriting of undo stack.

Possible cause:
This bug is caused by leaving at least one undo record with type 'BKE_UNDOSYS_TYPE_MEMFILE' (function BKE_undosys_stack_init_or_active_with_type(...), specifically code below line 435 in undo_system.c).
This kept undo record will often stay at the bottom of the stack and contains very old undo and thus skipping a lot of actions that were made (that can lead to accidental lose work).

Possible fix:
Ignore this always kept undo record when doing undo. (Not sure about inner working and might be bad fix):

(after line 670 in BKE_undosys_step_undo_with_data_ex(...) in undo_system.c)
inserting this snippet:

while (us != NULL && us->type->name == "Global Undo") {
  us = us->prev;
}

Referred files:
source/blender/blenkernel/intern/undo_system.c

**Version:** Tested with version 8.32 alpha, windows x64 self compiled (master branch, date 2020-01-16, commit 2cd3298fde496b1632dac5cb7e9ff21d22e9bad3) (present in stable release, possibly since rework of undo) **Bug description:** When going on last undo in undo history (assuming enough actions were done to start overwriting undo stack) going one step further (ctrl+z) makes Blender skip several actions back. **Replication:** Creating cube, subdividing and removing faces till the maximum capacity of undo stack is reached (and a bit more after). After doing undo till possible. Last undo will be large skip of actions (mentioned bug) Alternatively selecting last undo from undo history and then making one more undo with undo button (or ctrl+z) PS: The easy way is to set undo steps to a minimum to faster reach overwriting of undo stack. **Possible cause:** This bug is caused by leaving at least one undo record with type 'BKE_UNDOSYS_TYPE_MEMFILE' (function BKE_undosys_stack_init_or_active_with_type(...), specifically code below line 435 in undo_system.c). This kept undo record will often stay at the bottom of the stack and contains very old undo and thus skipping a lot of actions that were made (that can lead to accidental lose work). **Possible fix:** Ignore this always kept undo record when doing undo. (Not sure about inner working and might be bad fix): (after line 670 in BKE_undosys_step_undo_with_data_ex(...) in undo_system.c) inserting this snippet: ``` while (us != NULL && us->type->name == "Global Undo") { us = us->prev; } ``` **Referred files:** source/blender/blenkernel/intern/undo_system.c
Author

Added subscriber: @Rengyr

Added subscriber: @Rengyr

Changed status from 'Needs Triage' to: 'Confirmed'

Changed status from 'Needs Triage' to: 'Confirmed'

Added subscribers: @ideasman42, @mano-wii

Added subscribers: @ideasman42, @mano-wii

I tried to reproduce the problem.
The cube ended up like this:
image.png

Blender skipped to the action of entering edit mode and skipped the first edits.
In fact, it kept (internally) one last undo of the type BKE_UNDOSYS_TYPE_MEMFILE.

I suppose it was expected to have stopped in edit mode.

@ideasman42, is this somehow working as designed or is it a bug?

I tried to reproduce the problem. The cube ended up like this: ![image.png](https://archive.blender.org/developer/F8289530/image.png) Blender skipped to the action of entering edit mode and skipped the first edits. In fact, it kept (internally) one last undo of the type `BKE_UNDOSYS_TYPE_MEMFILE`. I suppose it was expected to have stopped in edit mode. @ideasman42, is this somehow working as designed or is it a bug?

Added subscriber: @mont29

Added subscriber: @mont29

Closed as duplicate of #76642

Closed as duplicate of #76642

Changed status from 'Duplicate' to: 'Resolved'

Changed status from 'Duplicate' to: 'Resolved'
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
5 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#73180
No description provided.