Undo steps with texture paint break across memfile steps #61263

Closed
opened 2019-02-07 00:45:45 +01:00 by Campbell Barton · 20 comments

Texture paint undo steps don't work properly when mixed with memfile undo (object mode operations).

  • Default cube.
  • Set texture paint mode, add 'Base Color' slot for painting.
  • Make one stroke.

  • Undo everything, redo everything.

  • All correct.


Now switch to object mode and undo, notice the image has been cleared.


Note that this is more of a limit in how image undo works than some mistake in the code. since 2.7x never supported this.

Image painting is an exception that needs special handling since it has undo data that exists outside global undo.

Reporting because this should be fixed before 2.8x release, or worse case we could limit texture paint undo/redo to the current painting session as 2.7x (would be a shame, but better then loosing the users work).

Texture paint undo steps don't work properly when mixed with memfile undo (object mode operations). - Default cube. - Set texture paint mode, add 'Base Color' slot for painting. - Make one stroke. --- - *Undo everything, redo everything.* - All correct. --- Now switch to object mode and undo, notice the image has been cleared. ---- Note that this is more of a limit in how image undo works than some mistake in the code. since 2.7x never supported this. Image painting is an exception that needs special handling since it has undo data that exists outside global undo. Reporting because this should be fixed before 2.8x release, or worse case we could limit texture paint undo/redo to the current painting session as 2.7x *(would be a shame, but better then loosing the users work)*.
Campbell Barton self-assigned this 2019-02-07 00:45:45 +01:00
Author
Owner

Added subscriber: @ideasman42

Added subscriber: @ideasman42

#66890 was marked as duplicate of this issue

#66890 was marked as duplicate of this issue
Campbell Barton changed title from Texture paint steps break across memfile steps to Undo steps with texture paint break across memfile steps 2019-02-07 00:47:12 +01:00

Added subscriber: @dfelinto

Added subscriber: @dfelinto

Strange that if I do UNDO again after object mode + UNDO, the image is back. For the records, tested with eff3728db9.

Strange that if I do UNDO again after object mode + UNDO, the image is back. For the records, tested with eff3728db9.
Member

Added subscriber: @DanielGrauer

Added subscriber: @DanielGrauer

Added subscriber: @ssendam

Added subscriber: @ssendam

Added subscriber: @mano-wii

Added subscriber: @mano-wii

Has this bug already been fixed? I can't reproduce with the described steps.

Has this bug already been fixed? I can't reproduce with the described steps.
Author
Owner

Looked into this recently, the painting undo stack now works across mem-file undo steps in some situations (resolved 1d7be99ba4), however there is still a problem.

Even though mem-file undo attempts to keep Image.cache between undo steps, there are still times when it's cleared.

This clears the ImBuf which is the current in-memory state of the image.

I'm not sure why this only happens in some cases, needs further investigation.

Looked into this recently, the painting undo stack now works across mem-file undo steps in some situations (resolved 1d7be99ba4), however there is still a problem. Even though mem-file undo attempts to keep `Image.cache` between undo steps, there are still times when it's cleared. This clears the `ImBuf` which is the current in-memory state of the image. I'm not sure why this only happens in some cases, needs further investigation.

Added subscriber: @jfmatheu

Added subscriber: @jfmatheu

Can't reproduce this with Blender 2.81 build from 14th August later build and with Blender 2.80 last build

Operating system: Windows-10-10.0.18362 64 Bits
Graphics card: Radeon RX 580 Series ATI Technologies Inc. 4.5.13570 Core Profile Context 19.8.1 26.20.13001.29010

Can't reproduce this with Blender 2.81 build from 14th August later build and with Blender 2.80 last build Operating system: Windows-10-10.0.18362 64 Bits Graphics card: Radeon RX 580 Series ATI Technologies Inc. 4.5.13570 Core Profile Context 19.8.1 26.20.13001.29010
Author
Owner

Thanks for checking.

This problem happens far less often then it used to, but it can still happen, so keeping this open.

Thanks for checking. This problem happens far less often then it used to, but it can still happen, so keeping this open.
Member

Added subscriber: @lichtwerk

Added subscriber: @lichtwerk
Member

@ideasman42 : I have added this to 2.81 milestone (since it was set to "High"), mind checking again?

@ideasman42 : I have added this to 2.81 milestone (since it was set to "High"), mind checking again?
Author
Owner

The issue is the image cache sometimes gets freed by memfile undo, the image then gets reloaded and the undo tiles are applied on-top of the wrong image data.

I looked into memfile undo image cache pointer map and it doesn't look like some mistake in the code causing this, in fact this works in most cases.

It turns out it's not enough just to correctly remap the images through memfile-undo - because the user can undo to a state before the image existed (which currently frees the image cache).

This test patch shows how keeping the image cache stored as part of the undo system can fix the issue, P1103. This adds ID / undo users to MovieCache. There might be better ways to keep the data around between memfile undo's though.

The issue is the image cache sometimes gets freed by memfile undo, the image then gets reloaded and the undo tiles are applied on-top of the wrong image data. I looked into memfile undo image cache pointer map and it doesn't look like some mistake in the code causing this, in fact this works in most cases. It turns out it's not enough just to correctly remap the images through memfile-undo - because the user can undo to a state before the image existed (which currently frees the image cache). This test patch shows how keeping the image cache stored as part of the undo system can fix the issue, [P1103](https://archive.blender.org/developer/P1103.txt). This adds ID / undo users to `MovieCache`. There might be better ways to keep the data around between memfile undo's though.
Author
Owner

Added subscribers: @Sergey, @brecht

Added subscribers: @Sergey, @brecht
Author
Owner

Note, talked to @brecht and @Sergey - P1103 is too fragile.

I'm working on making the undo system store all image data, since the image cache isn't reliable enough to apply changes to.

Note, talked to @brecht and @Sergey - [P1103](https://archive.blender.org/developer/P1103.txt) is too fragile. I'm working on making the undo system store all image data, since the image cache isn't reliable enough to apply changes to.

This issue was referenced by 151cc02b6f

This issue was referenced by 151cc02b6f8234c94a65618ae0437403e1aba689
Author
Owner

Changed status from 'Open' to: 'Resolved'

Changed status from 'Open' to: 'Resolved'
Author
Owner

Added subscribers: @SethTooQuick, @linosia, @Wallis

Added subscribers: @SethTooQuick, @linosia, @Wallis
Thomas Dinges added this to the 2.81 milestone 2023-02-08 16:48:11 +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
8 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#61263
No description provided.