Handler save_pre doesn't get called for session recovery save #71506
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#71506
Loading…
Reference in New Issue
No description provided.
Delete Branch "%!s(<nil>)"
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?
System Information
Operating system: Windows-10-10.0.18362 64 Bits
Graphics card: GeForce GTX 980M/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 389.12
Blender Version
Broken: version: 2.80 (sub 74), branch: master, commit date: 2019-07-11 13:50, hash:
06312c6d2d
Worked: (optional)
Short description of error
The Python handler
save_pre
does not get executed when Blender saves the session recovery file on exit. When add-on's are actively using this handler, they are very likely generating or finalizing data that will be saved along with the file. Skipping over this event while such add-ons are active is likely to cause data loss or strange bugs that will be difficult to track down.Exact steps for others to reproduce the error
Write a simple script that prints something to the console when
save_pre
is called, then exit Blender with it active. You can launch Blender from a console window to keep the window open after it exits.#71506.blend
Added subscriber: @CodeRunner
Added subscriber: @lichtwerk
Can confirm on first sight, not sure if these should be running in these situations, checking...
Added subscribers: @Sergey, @ideasman42
@Sergey, @ideasman42 : any drawbacks on calling these in
WM_exit_ex
as well? (see D6243: Fix #71506: Save Handlers not called for session recovery save)@CodeRunner, what are you using this for? It may help is finding a solution.
This is similar to auto-save which also doesn't run the write callbacks.
It's not obvious that it should since there are actions you may only want to run when the user saves their own data (write other files to disk for e.g.) which you wouldn't want to run on auto-save or exit.
While we could have
save_for_recovery
,save_for_autosave
_pre/post
, I'd like to know the purpose of adding additional callbacks.Setting this as a design task.
I'm personally using the callback to move global property data from the add-on preferences group to scene data, so such data will be saved inside the *.blend file.
That aside, I can't imagine a lot of uses for
save_pre
that would not involve manipulating part of the scene for some purpose that is intended to be saved with it. I would thinksave_post
would be better suited for other types of actions. However, if it is easy to add new callbacks for the specific purpose of manipulating scene data for a save, I can't think of any reason not to.There appear to be only a couple built-in add-ons using
save_pre
(blenderkit
andmeasureit
), and they both seem to be using it toclean
data. I haven't looked very closely atblenderkit
, butmeasureit
appears to be manipulating scene data in the handler. However, I'm not very familiar with it, so I'm not sure how critical it would be to skip over the code during the recovery file save. If it is only cleaning unused data, I'm assuming it would not be very noticeable - just accumulated garbage memory/scene-data.