WM: explicitly skip auto-save when in modes that don't support it #118892

Merged
Jacques Lucke merged 8 commits from JacquesLucke/blender:auto-save-active-memfile into main 2024-02-29 13:15:08 +01:00
Member

This implements the first part of what was discussed here.

Auto-save currently only really works in modes that use the MemFile undo step, that excludes things like mesh edit and sculpt mode. Previously, Blender would attempt to auto-save in those modes, but it would only save the last state from before the mode was entered, which is useless when staying in the mode for longer. This problem is not fixed here. However, the code now explicitly skips auto-saving in order to avoid unnecessary short freezes in these modes when Blender auto-saves. Furthermore, the auto-save will happen when changing modes.

This reduces the impact of save-time-regressions with #106903.

This implements the first part of what was discussed [here](https://devtalk.blender.org/t/remove-support-for-saving-memfile-undo-steps-as-blend-files-proposal/33544/12?u=jacqueslucke). Auto-save currently only really works in modes that use the `MemFile` undo step, that excludes things like mesh edit and sculpt mode. Previously, Blender would attempt to auto-save in those modes, but it would only save the last state from before the mode was entered, which is useless when staying in the mode for longer. This problem is *not* fixed here. However, the code now explicitly skips auto-saving in order to avoid unnecessary short freezes in these modes when Blender auto-saves. Furthermore, the auto-save will happen when changing modes. This reduces the impact of save-time-regressions with #106903.
Jacques Lucke added 3 commits 2024-02-29 10:22:16 +01:00
Jacques Lucke requested review from Brecht Van Lommel 2024-02-29 10:23:29 +01:00

Does this now autosave when exiting modes?

To me that's an important part, because previously while in edit/sculpt modes it would still autosave changes that were flushed by switching modes.

Does this now autosave when exiting modes? To me that's an important part, because previously while in edit/sculpt modes it would still autosave changes that were flushed by switching modes.
Author
Member

Ah, right now the patch only auto-saves (almost) immediately after going to a mode that uses MemFile, but not when switching between edit and sculpt mode. Will fix.

Ah, right now the patch only auto-saves (almost) immediately after going to a mode that uses `MemFile`, but not when switching between edit and sculpt mode. Will fix.
Jacques Lucke added 1 commit 2024-02-29 11:08:18 +01:00
Author
Member

It should auto-save on mode changes now, if the auto-save timer was up while in a mode that didn't support it.
I couldn't verify that Blender would auto-save when switching between edit/sculpt mode before though.

It should auto-save on mode changes now, if the auto-save timer was up while in a mode that didn't support it. I couldn't verify that Blender would auto-save when switching between edit/sculpt mode before though.
Brecht Van Lommel requested changes 2024-02-29 11:34:11 +01:00
Dismissed
@ -160,1 +160,4 @@
int opengl_deprecation_usage_lineno;
/** Auto-save timer was up, but it wasn't possible to auto-save in the current mode. */
bool autosave_scheduled;

I would put this autosave_schedule in wm next to wm->autosavetimer, and then have a WM_autosave_if_scheduled function.

Seems better to me to me than spreading this state across more places.

I would put this `autosave_schedule` in `wm` next to `wm->autosavetimer`, and then have a `WM_autosave_if_scheduled` function. Seems better to me to me than spreading this state across more places.
JacquesLucke marked this conversation as resolved
@ -2139,0 +2141,4 @@
BlendFileWriteParams params{};
BLO_write_file(bmain, filepath, fileflags, &params, nullptr);
G.autosave_scheduled = false;

I think this should reset the autosave timer if called from mode switching?

I think this should reset the autosave timer if called from mode switching?
JacquesLucke marked this conversation as resolved
Jacques Lucke added 4 commits 2024-02-29 13:05:19 +01:00
Jacques Lucke requested review from Brecht Van Lommel 2024-02-29 13:05:25 +01:00
Brecht Van Lommel approved these changes 2024-02-29 13:12:32 +01:00
Jacques Lucke merged commit 41b10424c7 into main 2024-02-29 13:15:08 +01:00
Jacques Lucke deleted branch auto-save-active-memfile 2024-02-29 13:15:11 +01:00
Sign in to join this conversation.
No reviewers
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
2 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#118892
No description provided.