Regression: Sculpt mode undo: Broken when undoing to a Global/memfile undo step after rB4c7b1766a7f1 #82388
Labels
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
7 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender#82388
Loading…
Reference in New Issue
No description provided.
Delete Branch "%!s(<nil>)"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
System Information
Operating system: Win 10
Blender Version
Broken: blender-2.92.0-564f3be20a6f-windows64
Caused by
4c7b1766a7
Short description of error
In the sculpting template, the Undo (ctrl+z) function doesn't undo the first stroke.
However, if you then click "Redo" (shift+ctrl+z), it will actually undo the first stroke...This is a separated issue, see {#82532}Same issue cause a slightly different bug when one switch from Object mode to Sculpt mode, draws a stroke, then undo twice: the object does not go back to Object mode as expected.
Exact steps for others to reproduce the error
Undo (ctrl+z) - It should undo the brush stroke, but nothing happens.
Redo (shift+ctrl+z) - Now it will undo the brush stroke.OR
Undo twice.
2020-11-04_04-03-24.mp4
Even not using the sculpting template, you can still replicate this erratic behavior in sculpt mode, if you load a texture/perform a brush stroke and try to undo... the undo won't work, but the Redo will undo the brush stroke...
2020-11-04_16-25-45.mp4
Added subscriber: @TheRedWaxPolice
#82480 was marked as duplicate of this issue
Added subscriber: @lichtwerk
Changed status from 'Needs Triage' to: 'Confirmed'
Sculpt mode: Unexpected undo behaviorto Sculpt mode: Unexpected undo behavior in Sculpting TemplateAdded subscriber: @mont29
Caused by
4c7b1766a7
CC @mont29
Ah thanks for the report, actually discovered that yesterday, and have been trying to understand what exactly is going on with it (part of the issue also comes from
1cb07530a9
, but reverting this does not fully fix it either).Added subscribers: @brecht, @dfelinto, @ideasman42
Note that another symptom of the same issue is that from startup file, if you switch to Sculpt mode, undo will stay in sculpt mode (instead of going back to Object mode).
This is actually fairly involved to fix... Summoning some more brains here.
Root of the issue: Since initial memfile undo step is the only one existing, none of its IDs are flagged as 'changed', so when undoing we just fully re-use current IDs, hence the lack of undoing of the first sculpt action. Other modes like Paint ones are not affected because they do store a memfile undo step on entering, but for sculpt this was changed to a sculpt undo step in
1cb07530a9
.Only quick solution I can see is to revert
4c7b1766a7
, but this will break most of the work done for 'preserving tool settings across undos' (since it relies on re-using existing data-blocks). So I'm not sure which issue would be considered the more critical right now?For the more long term solution, we can try to be smart, and e.g 'remove' modes that are not supported by memfile undo when reading one of those steps. We already do it for Edit mode, this snippets adds Sculpt to the party. It solves part of the issue, but not all (especially when already starting in Sculpt mode, we still have a memfile undo step at the beginning in sculpt mode, so this is not working here).
P1751: (An Untitled Masterwork)
We can also make all those 'editing' modes to actually go into last memfile undo step, find the memchunks for the data-block(s) they will be editing, and set their
is_identical_future
to false. I think this is the 'proper' solution, but not sure how involved it will be to implement it.Actually, even not using the sculpting template, you can still replicate this erratic behavior in sculpt mode, if you load a texture/perform a brush stroke and try to undo... the undo won't work, but the Redo will undo the brush stroke...
2020-11-04_16-25-45.mp4
True ^^
Sculpt mode: Unexpected undo behavior in Sculpting Templateto Sculpt mode: Unexpected undo behavior@mont29, I don't really understand how the bug report and your description relate. Why would undoing the first stroke be affected by memfile undo or mode switching undo at all? Why doesn't it just undo the stroke with sculpt mode undo and nothing else?
I can imagine that if switching sculpt mode bypasses memfile undo for performance, some additional code would be needed to ensure the sculpt session is initialized properly. But I guess the steps to reproduce that issue are different than what is in the bug report description.
When a file is opened in sculpt mode as in the sculpting template, I would not expect there to be an undo step to go from sculpt to object mode that the user can actually do.
1cb07530a9
is also strange. It callsSCULPT_undo_push_begin
, but that is supposed to go along with a call toSCULPT_undo_push_end
once the operator is done. I don't know what it means to call justbegin
, maybe that indirectly does something useful, but it's not how this is supposed to be used.Those both have the same cause, symptoms are different because when doing
new -> sculpting
, the initial memfile undo step stored is already in sculpt mode, so we do not have an initial, unchanged sculpt mode undo step, unlike when starting default blender and then switching to sculpt mode.Here is the undo stack after opening default blender and switching to sculpt and doing one stroke:
And here is the undo stack after doing
new -> sculpting
and doing one stroke:Yes, it is strange, and I'm not sure I understand it properly either, but think that that
SCULPT_undo_push_begin
simply ensures that the undo step stored at the end of thissculpt_mode_toggle_exec
operator (by generic code in WM area) is actually a SCULPT undo step, and not a global, memfile one?Right, but I'm not sure why such an initial, unchanged sculpt mode undo step would be needed. As far as I know the 'Draw Brush' undo step should contain the old vertex coordinates to be restored, and that should be sufficient to perform undo.
That would be the case, if the mesh ID's memchunks were properly tagged with
is_identical_future
being set to True.But currently, that flag is only set when writing the next memfile undo step, and a difference is detected. So we'd need the first Sculpt undo step to do that as well I think.
Added subscriber: @Pasang
It seems we are talking past each other. I don't know why you are talking about memchunks when my point was that for this bug report, no memfile or memchunks should be relevant. If they are relevant, please explain why.
If there is some other sequence of steps that you are doing a bugfix for, please explain what those steps are.
As already said, memfile/memchunks are the issue, since in both cases they are the first initial undo step, the ones that fail to apply properly:
Anyway, will be at the office tomorrow, easier to sort this in person (and also hope to have a working proper fix by then to review)
Sculpt mode: Unexpected undo behaviorto Regression: Sculpt mode undo: Broken when undoing to a Global/memfile undo step after rB4c7b1766a7f1This issue was referenced by
bc090387ac
Changed status from 'Confirmed' to: 'Resolved'
Hi @mont29 not sure where to post this, but I just found another situation where this undo issue is still happening , this time involving the multires.... But it's easy to reproduce....
(blender-2.92.0-3e325c35f870-windows64)
@TheRedWaxPolice, this issue is the same as #82532 & #82851. Now fixed.