Fix undo overreach in various paint modes for #69760 and related. #117417
No reviewers
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
3 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender#117417
Loading…
Reference in New Issue
No description provided.
Delete Branch "angavrilov/blender:pr-undo-fixes"
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?
This tries to fix undo overreach on selection of vertex groups,
shape keys, uv maps, colors and attributes in various modes.
use a sculpt undo step on entering the mode, and property changes
shouldn't write undo steps.
selection changes for some reason.
steps for property changes is simply pointless.
for property changes, except for those excluded from undo,
e.g. by
bc0a6b0400
.and vertex paint modes, immediately following property changes
to object and mesh datablocks should also push to avoid over-undo
if the immediately following scuplt step is reverted (unrelated
ones like materials or scene seem safe).
This fix addresses these cases:
(should push undo)
(should not push undo)
(should not undo the change)
Collection viewport visibility,
Active vertex group. [1]
Tool settings (e.g. Auto-Normalize)
Active shape key,
Active vertex color,
Object viewport visibility,
Collection viewport visibility,
Brush/tool settings.
Use a non-sculpt operator
(e.g. Mirror Shape Key)
Active shape key,
Active vertex color.[2]
Collection viewport visibility,
Brush/tool settings.
Use a non-sculpt operator
(e.g. Mirror Shape Key)
Note: internally Sculpt and Vertex Paint are essentially the same and only differ in the shown set of tools.
I haven't been able to do a functional code review, or try out the changes for myself. As for the code changes, there's a few trivial inline notes.
@ -837,2 +837,4 @@
ED_object_vpaintmode_enter_ex(bmain, depsgraph, scene, ob);
BKE_paint_toolslots_brush_validate(bmain, &ts->vpaint->paint);
if (ob->mode & mode_flag) {
This comparison is already stored in
is_mode_set
. Theelse
clause that contains this code is only run when!is_mode_set
, so things get confusing. Add a comment that states that vpaintmode was just entered, and thus the object flags have to be checked again.(here are just some ponderings that I wanted to share; the actual feedback on this change is above this line)
I actually think that this doubly checking and deeper nesting of the code makes things too complex. For this PR I understand you want to make a minimal change, but the resulting code IMO stretches things a bit too far. BUT, looking at the current code outside of the part that this PR touched, it was IMO already too complex, so let's not bother this PR with that.
Off-topic, this is what I'd do:
mesh = BKE_mesh_from_object()
down to where the mesh is actually used.(Mesh *)ob->data
withmesh
so that there is one consistent way to refer to the mesh.if (!is_mode_set)
andif (is_mode_set)
conditionals, so that there is just one "enter" and one "exit" code path.@ -839,0 +839,4 @@
if (ob->mode & mode_flag) {
/* Without this the memfile undo step is used,
* while it works it causes lag when undoing the first undo step, see T71564. */
This mentions an issue in the old Phabricator notation, so better to change that to
#71564
. This seems to have been copied fromsource/blender/editors/sculpt_paint/sculpt_ops.cc
, which was already changed to this notation.@ -462,0 +483,4 @@
*
* Most other property change undo pushes will be also suppressed
* by another check later unless preceeded by a memfile push;
* however these properties should always be blocked. */
👍 thanks for leaving this as a comment, it helps so much to understand this interdependency with other behaviours.
I wouldn't mind having a mention of the location in the code where this other check can be found. The downside would be that it's a non-code reference to code that could get out of date at some point, so use your own instinct to decide whether to add this or not.
PS: I think it would be good to have someone from the Sculpt/Paint/Texture module as a reviewer as well.
Thx for this.
Will honestly take me a bit of time to get up to speed again with the different
UndoType
, but seeing a refinement on4a08b974f4
is certainly nice. Again, please allow a bit of time (at least for me) to dig a little deeper (for example, I am now wondering whybc0a6b0400
was even necessary after4a08b974f4
), but I am interested for sure.So I might not be the ideal candidate to review this, maybe @ideasman42 is?
Checkout
From your project repository, check out a new branch and test the changes.