Fixing undo overreach after RNA property changes done through UI. #104582

Closed
opened 2023-02-10 18:30:13 +01:00 by Alexander Gavrilov · 8 comments

Currently changing RNA properties of undo-able datablocks through the UI rather than operators does not create undo stack entries. As a result, undoing the first operator done after such changes will also revert the values.

This can be extremely annoying in some workflows and render the use of the redo panel impossible without extra steps to push an anchoring undo entry via harmless but unnecessary actions like selection.

Since I have only very vague understanding of the undo system, my only idea is some brute force solution like any RNA property changes to 'undo-able' datablocks done outside an operator setting a global flag, which would cause the next undo-able operator to make an extra undo push at the start of execution.

@brecht @mont29 @BClark


Some major cases of this is changing the active vertex group or shape key and then doing painting or editing actions on it.

Currently changing RNA properties of undo-able datablocks through the UI rather than operators does not create undo stack entries. As a result, undoing the first operator done after such changes will also revert the values. This can be extremely annoying in some workflows and render the use of the redo panel impossible without extra steps to push an anchoring undo entry via harmless but unnecessary actions like selection. Since I have only very vague understanding of the undo system, my only idea is some brute force solution like any RNA property changes to 'undo-able' datablocks done outside an operator setting a global flag, which would cause the next undo-able operator to make an extra undo push at the start of execution. @brecht @mont29 @BClark ------- Some major cases of this is changing the active vertex group or shape key and then doing painting or editing actions on it.
Alexander Gavrilov added the
Type
Design
label 2023-02-10 18:30:13 +01:00
Brecht Van Lommel added the
Module
Core
label 2023-02-10 18:35:15 +01:00

Am not sure I follow you here... In the UI, undoable data changes do generate an undo step (e.g. changing location of an object in the property editor)?

Non-UI RNA editing (e.g. through python script) indeed do not generate undo steps, but this is on purpose, python code can create these undo steps when it needs to.

Am not sure I follow you here... In the UI, undoable data changes do generate an undo step (e.g. changing location of an object in the property editor)? Non-UI RNA editing (e.g. through python script) indeed do not generate undo steps, but this is on purpose, python code can create these undo steps when it needs to.
Bastien Montagne added the
Interest
Undo
label 2023-02-10 18:41:20 +01:00
Author
Member

@mont29 Is the active vertex group or shape key 'undoable data'? The most recent case of this that I remember is related to them. I also have vague recollection about the issue happening to maybe brush settings in paint/sculpt mode?..

If they are not 'undoable data', then either they should not be undone, or they should be undoable.

If they are marked 'not undoable' to avoid unnecessary undo pushes, I think my solution could be the correct approach - since in reality the value is undoable, and the goal is to coalesce all changes to such weakly undoable properties into the smallest number of pushes.

@mont29 Is the active vertex group or shape key 'undoable data'? The most recent case of this that I remember is related to them. I also have vague recollection about the issue happening to maybe brush settings in paint/sculpt mode?.. If they are not 'undoable data', then either they should not be undone, or they should be undoable. If they are marked 'not undoable' to avoid unnecessary undo pushes, I think my solution could be the correct approach - since in reality the value is undoable, and the goal is to coalesce all changes to such weakly undoable properties into the smallest number of pushes.

Reacting to your edit: This is totally unrelated issue to RNA, it's due to the fact that Undo systems for non-Object modes are different, and are not always cooperating well with Object mode undo (aka memfile undo). We already have many reports about this, see e.g #97700, #90291, and so on.

Reacting to your edit: This is totally unrelated issue to RNA, it's due to the fact that Undo systems for non-Object modes are different, and are not always cooperating well with Object mode undo (aka memfile undo). We already have many reports about this, see e.g #97700, #90291, and so on.

Think @ideasman42 will be your best source of info on these topics.

Think @ideasman42 will be your best source of info on these topics.
Member

Code that changes scene data should always do an undo push when done. If the undo doesn't behave as expected, that is bug or limitation. It needs to be investigated what happens in the specific case. I know that there were indeed cases with brush settings getting reset wrongly, but this again is a bug then. Typically they are caused by either forgetting to enable undo or because of a fuzzy distinction between scene (undoable) and UI (not undoable) data. This needs special treatment then.
A hack like the proposed global flag would just hide the symptoms without looking at the root of the issue.

For when many undo pushes could be an issue, there's now "undo groups", so for example changing the active vertex group multiple times could result in a single merged undo push.

Code that changes scene data should always do an undo push when done. If the undo doesn't behave as expected, that is bug or limitation. It needs to be investigated what happens in the specific case. I know that there were indeed cases with brush settings getting reset wrongly, but this again is a bug then. Typically they are caused by either forgetting to enable undo or because of a fuzzy distinction between scene (undoable) and UI (not undoable) data. This needs special treatment then. A hack like the proposed global flag would just hide the symptoms without looking at the root of the issue. For when many undo pushes could be an issue, there's now "undo groups", so for example changing the active vertex group multiple times *could* result in a single merged undo push.
Author
Member

@JulianEisel Apparently in some cases undo is disabled deliberately?.. #101728 (comment)

@JulianEisel Apparently in some cases undo is disabled deliberately?.. https://projects.blender.org/blender/blender/issues/101728#issuecomment-98614
Author
Member

So today I tried debugging property undo (specifically targeting various active layer selections), and came up with a bunch of proposed fixes for the paint modes e8805a1a3ff.

In particular, I found that for some reason some specific code by @JosephEagar is directly doing over-undo for the active color layer selection in sculpt undo - I wonder what was the logic for that.

Edit: There also seems to be a major conceptual issue that if a sculpt step follows a memfile step for whatever reason, and a property change is done in between, the interface code won't save a step for the change because it's in sculpt mode, but since the preceeding step is memfile the change will actually be undone. This should either be fixed somehow, or the interface code should push property steps anyway if the current step on the stack is memfile.

So today I tried debugging property undo (specifically targeting various active layer selections), and came up with a bunch of proposed fixes for the paint modes e8805a1a3ff. In particular, I found that for some reason some [specific code](https://projects.blender.org/blender/blender/commit/e8805a1a3ff977018882fc37b083c4d5f1f96a6e#diff-ba6c72638d638cdf50f74fcf4590a2b08b51886c) by @JosephEagar is directly doing over-undo for the active color layer selection in sculpt undo - I wonder what was the logic for that. Edit: There also seems to be a major conceptual issue that if a sculpt step follows a memfile step for whatever reason, and a property change is done in between, the interface code won't save a step for the change because it's in sculpt mode, but since the preceeding step is memfile the change will actually be undone. This should either be fixed somehow, or the interface code should push property steps anyway if the current step on the stack is memfile.

We already have many (many) bug reports about that generic issue (transitions between undo steps of different types), and this is not a design task at all. So will archive it for now.

Note that a proper design task regarding how to fix this issue, and how to improve readability and maintainability of the undo system would be much welcome. Would suggest you talk with the current owner of this area first, though (@ideasman42).

We already have many (many) bug reports about that generic issue (transitions between undo steps of different types), and this is not a design task at all. So will archive it for now. Note that a proper design task regarding how to fix this issue, and how to improve readability and maintainability of the undo system would be much welcome. Would suggest you talk with the current owner of this area first, though (@ideasman42).
Blender Bot added the
Status
Archived
label 2023-02-17 18:22:41 +01:00
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
3 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#104582
No description provided.