autosave doesn't save like normal save #48929

Closed
opened 2016-07-22 21:10:10 +02:00 by mathieu menuet · 8 comments

System Information
Win7 x64

Blender Version
Broken: 08e1bba

Short description of error
Auto saves don't save the edit mode changes unlike the normal save.

Exact steps for others to reproduce the error
Can't provide file. Set autosave to 1 min, save the default cube somewhere to activate autosave. Rotate or scale the cube in edit mode, validate and do nothing else but wait that the autosave file appear in your temp folder. Save the file again and load the autosave in Blender: Edit mode changes are not saved. Load the manually saved file, changes are saved there.

**System Information** Win7 x64 **Blender Version** Broken: 08e1bba **Short description of error** Auto saves don't save the edit mode changes unlike the normal save. **Exact steps for others to reproduce the error** Can't provide file. Set autosave to 1 min, save the default cube somewhere to activate autosave. Rotate or scale the cube in edit mode, validate and do nothing else but wait that the autosave file appear in your temp folder. Save the file again and load the autosave in Blender: Edit mode changes are not saved. Load the manually saved file, changes are saved there.
Author

Changed status to: 'Open'

Changed status to: 'Open'
Author

Added subscriber: @bliblubli

Added subscriber: @bliblubli

Added subscribers: @ideasman42, @mont29

Added subscribers: @ideasman42, @mont29

Easy to confirm, caused by the fact we use global undo buffer to speed autosave - but this cannot work in Edit (or sculpt) modes, which have their own undo system.

Patch below seems to do the job, @ideasman42 what do you think?

P378: #48929.diff

diff --git a/source/blender/windowmanager/intern/wm_files.c b/source/blender/windowmanager/intern/wm_files.c
index fe257cc..89da7f2 100644
--- a/source/blender/windowmanager/intern/wm_files.c
+++ b/source/blender/windowmanager/intern/wm_files.c
@@ -1136,6 +1136,7 @@ void wm_autosave_timer(const bContext *C, wmWindowManager *wm, wmTimer *UNUSED(w
 	wmWindow *win;
 	wmEventHandler *handler;
 	char filepath[FILE_MAX];
+	bool use_undobuffer = (U.uiflag & USER_GLOBALUNDO) != 0;
 	
 	WM_event_remove_timer(wm, NULL, wm->autosavetimer);
 
@@ -1151,8 +1152,19 @@ void wm_autosave_timer(const bContext *C, wmWindowManager *wm, wmTimer *UNUSED(w
 
 	wm_autosave_location(filepath);
 
-	if (U.uiflag & USER_GLOBALUNDO) {
-		/* fast save of last undobuffer, now with UI */
+	if (use_undobuffer) {
+		/* fast save of last undobuffer, now with UI - does not work in case some object is in Edit (or Sculpt) mode */
+		Main *bmain = CTX_data_main(C);
+
+		for (Object *ob = bmain->object.first; ob; ob = ob->id.next) {
+			if (ob->mode & (OB_MODE_SCULPT | OB_MODE_EDIT)) {
+			    use_undobuffer = false;
+				break;
+			}
+		}
+	}
+
+	if (use_undobuffer) {
 		BKE_undo_save_file(filepath);
 	}
 	else {

Easy to confirm, caused by the fact we use **global** undo buffer to speed autosave - but this cannot work in Edit (or sculpt) modes, which have their own undo system. Patch below seems to do the job, @ideasman42 what do you think? [P378: #48929.diff](https://archive.blender.org/developer/P378.txt) ``` diff --git a/source/blender/windowmanager/intern/wm_files.c b/source/blender/windowmanager/intern/wm_files.c index fe257cc..89da7f2 100644 --- a/source/blender/windowmanager/intern/wm_files.c +++ b/source/blender/windowmanager/intern/wm_files.c @@ -1136,6 +1136,7 @@ void wm_autosave_timer(const bContext *C, wmWindowManager *wm, wmTimer *UNUSED(w wmWindow *win; wmEventHandler *handler; char filepath[FILE_MAX]; + bool use_undobuffer = (U.uiflag & USER_GLOBALUNDO) != 0; WM_event_remove_timer(wm, NULL, wm->autosavetimer); @@ -1151,8 +1152,19 @@ void wm_autosave_timer(const bContext *C, wmWindowManager *wm, wmTimer *UNUSED(w wm_autosave_location(filepath); - if (U.uiflag & USER_GLOBALUNDO) { - /* fast save of last undobuffer, now with UI */ + if (use_undobuffer) { + /* fast save of last undobuffer, now with UI - does not work in case some object is in Edit (or Sculpt) mode */ + Main *bmain = CTX_data_main(C); + + for (Object *ob = bmain->object.first; ob; ob = ob->id.next) { + if (ob->mode & (OB_MODE_SCULPT | OB_MODE_EDIT)) { + use_undobuffer = false; + break; + } + } + } + + if (use_undobuffer) { BKE_undo_save_file(filepath); } else { ```

Added subscriber: @Sergey

Added subscriber: @Sergey

Changed status from 'Open' to: 'Archived'

Changed status from 'Open' to: 'Archived'
Sergey Sharybin self-assigned this 2016-07-26 17:35:38 +02:00

This is an intention of autosave to ignore sculpting, since trying to support that would cause really measurable hiccups during sculpt. See #32209 for more related changes and discussion.

Will consider this a TODO since it's something which is currently designed to work this way. Improvements arr possible, but are to be handled outside of the bug tracker. Thanks for the report anyway.

This is an intention of autosave to ignore sculpting, since trying to support that would cause really measurable hiccups during sculpt. See #32209 for more related changes and discussion. Will consider this a TODO since it's something which is currently designed to work this way. Improvements arr possible, but are to be handled outside of the bug tracker. Thanks for the report anyway.
Author

Trying new versions in production greatly help to find bugs fast in complex, real world use cases. It would help a lot if you could add an option to make our work easier and give us an option for the auto save (with or without edit changes). It would:

  1. Help us quickly get a version of the blend file just before the crash, making it easier to reproduce the bug.
  2. Save a nice amount of work, allowing us to work pretty efficiently while helping the community to get a well tested blender.
Trying new versions in production greatly help to find bugs fast in complex, real world use cases. It would help a lot if you could add an option to make our work easier and give us an option for the auto save (with or without edit changes). It would: 1. Help us quickly get a version of the blend file just before the crash, making it easier to reproduce the bug. 2. Save a nice amount of work, allowing us to work pretty efficiently while helping the community to get a well tested blender.
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#48929
No description provided.