godot-proposals icon indicating copy to clipboard operation
godot-proposals copied to clipboard

Add an autosave editor setting for scenes

Open Zireael07 opened this issue 5 years ago • 14 comments
trafficstars

Describe the project you are working on: 3d open world game (but it doesn't really matter for this proposal)

Describe the problem or limitation you are having in your project: If my computer hangs/crashes (e.g. because I wrote a bad shader or got a loop by mistake in a script), I lose progress.

Describe the feature / enhancement and how it helps to overcome the problem or limitation: Autosaving, e.g. every 5 minutes, is a standard in most game engines/IDEs and prevents losing progress.

Describe how your proposal will work, with code, pseudocode, mockups, and/or diagrams: Autosaving is often coupled with saving to .bak or some other file in addition to the main file, so that file content is not lost on I/O errors (see https://github.com/godotengine/godot/issues/38813 for one such report, and I am almost certain there was one more, too)

If this enhancement will not be used often, can it be worked around with a few lines of script?: Nope.

Is there a reason why this should be core and not an add-on in the asset library?: Requires core changes.

Original issue: https://github.com/godotengine/godot/issues/6236

Related: https://github.com/godotengine/godot/issues/6231

Zireael07 avatar May 28 '20 16:05 Zireael07

Auto-saving should not be default, because some workflows involve inspecting scenes without saving differences.

Some game engines have an annoying that warns auto-save is after 30s though.

fire avatar May 28 '20 17:05 fire

Which is why it would be best if the auto save time is configurable.

SIsilicon avatar May 28 '20 17:05 SIsilicon

Configurable time sounds good. Personally I have my IDEs auto-save after 0.5 seconds of inactivity.

It could just be set to 0 to disable it, so we don't need a checkbox in the editor settings, just a number.

aaronfranke avatar Jul 02 '20 16:07 aaronfranke

I thought we had (in 3.1.1+) an autosave for scripts in text_editor/files/autosave_interval_secs; how is this proposal different from it?

I'd like to propose an additional feature though: autosaving every time the godot window loses focus as opposed to in a fixed interval. Fixed interval is annoying as the editor shows the syntax error while you type due to unfinished statements.

sygi avatar Mar 26 '21 12:03 sygi

Note that periodic autosave is not the same as save on focus loss. Periodic autosave guarantees that work longer than given period is saved.

If user often runs the game or switches to Photoshop or Stack Overflow, focus loss can be frequent. However, if work is to just edit a scene or to write a lot of code in embedded GDScript editor, focus loss may not happen for a very long time.

starry-abyss avatar Jun 18 '21 23:06 starry-abyss

Note that periodic autosave is not the same as save on focus loss. Periodic autosave guarantees that work longer than given period is saved.

If user often runs the game or switches to Photoshop or Stack Overflow, focus loss can be frequent. However, if work is to just edit a scene or to write a lot of code in embedded GDScript editor, focus loss may not happen for a very long time.

Unlike scripts, there's a progress dialog every time you save a scene. This would make automatic saving for scenes obnoxious even if it's made optional.

Automatic saving for scripts is already available in the Editor Settings.

Calinou avatar Jun 18 '21 23:06 Calinou

Ah, didn't notice this issue is dedicated to scenes...

Unlike scripts, there's a progress dialog every time you save a scene. This would make automatic saving for scenes obnoxious even if it's made optional.

Then for this feature to be implemented, one probably needs to first add background saving support? While there is certainly a logic behind making an incomplete solution for the sake of less effort, I don't understand why the request for this feature is closed after implementing a different feature.

starry-abyss avatar Jun 18 '21 23:06 starry-abyss

Then for this feature to be implemented, one probably needs to first add background saving support? While there is certainly a logic behind making an incomplete solution for the sake of less effort, I don't understand why the request for this feature is closed after implementing a different feature.

I don't think it's worth the effort for a feature that very few people will enable. Saving on focus loss addresses the main need behind this proposal, without requiring complex implementation of new features. We only have a finite amount of manpower to maintain the engine and its editor :slightly_smiling_face:

Calinou avatar Jun 18 '21 23:06 Calinou

Saving on focus loss addresses the main need behind this proposal

Ehmmm... Nope? :)

Describe the problem or limitation you are having in your project: If my computer hangs/crashes (e.g. because I wrote a bad shader or got a loop by mistake in a script), I lose progress.

The problem is crashing during live coding a shader. How is it related to focus?

starry-abyss avatar Jun 18 '21 23:06 starry-abyss

I see, so there is more than one way to interpret OP's request (title is about scenes, not shaders). Hopefully, eventually we'll get full autosaving in Godot though.

starry-abyss avatar Jun 19 '21 00:06 starry-abyss

This issue should be re-opened. Saving on window focus loss is useless and doesn't help when I have Godot 4.0 constantly crashing while editing collision shapes on a focused window.

If necessary I'll re-make this post (while also mentioning it being disabled by DEFAULT) so that an autosave every X minutes is actually considered for scene/project editing and NOT just scripts. Blender has it, Godot should too. And I'm completely fine with waiting for an automatic save dialog to finish instead of constantly losing my non-script progress

wavetro avatar Mar 26 '23 21:03 wavetro

Thank you for re-opening this! Please keep us updated if this feature gets considered in a future Godot version, or if there's anything else that needs to be done before consideration :+1:

wavetro avatar Mar 26 '23 21:03 wavetro

In agreement with @wavetro. The feature should be there, even in an inferior form, for those who don't mind it even with the progress dialog.

I often get carried away working on stuff without saving, until the next inevitable crash where I lose all progress. Incredibly frustrating, and this is a very basic feature in.. pretty much all creative software.

noorus avatar Apr 14 '24 23:04 noorus

👋 Hello everyone!

Because of the need for this feature as well, I decided to create an AutoSaver Toggle plugin for Godot to help us! 🙌

"AutoSaver is a peace-of-mind plugin for Godot 4 that enables a toggle to automatically save the currently open scenes and files based on a timer schedule (default is 60 seconds) and/or when the application loses focus."

Godot Library Asset Latest Release

AutoSaver Toggle for Godot Editor by Victor R.R. Avalos

[!NOTE] The AutoSaver Toggle for Godot Editor is currently in early development. I welcome feedback and contributions to improve its stability and features such as porting to GDScript. Check Contributions section for more info.

The plugin is already published in the Godot Asset Library, and has the following features:

  • Creates a visible toggle to easily turn autosave on/off.
  • Automatically save open scenes (.tscn) and scripts/text files (.gd,.txt,.md,etc) at customizable intervals.
  • Option to save when the Godot editor loses focus (disabled by default)
  • The first version is written in C#, but a GDScript version is welcome (see contributions in the GitHub repo)
  • Although written in C#, it's also compatible with GDScript-only projects using Godot .NET (check Troubleshooting)
  • Uses Godot's built-in autosave settings (for scripts/text files in the Script Editor)
AutoSaver Toggle for Godot Editor by Victor R.R. Avalos

The plugin can be found in the Godot Asset Library or in the GitHub repository.

The plugin is open source, so feel free to contribute or suggest improvements.

Please let me know if you have any questions or feedback!

vrravalos avatar Jul 25 '24 17:07 vrravalos

I am teaching a course for godot for a while now, and I receive requests for this feature regularly. Students do lose their work, because for some reason godot closed (godot crashed, OS crashed, or accidental close). I'd say 2 out of ten students experience this at least once during the first weeks and lose sometimes hours of work. Save on losing focus does not help in most cases. The students are so focused on dealing with their nodes, that they can spend a long time without switching windows. I feel that these are the moments when it hurts most. Especially during the fragile first phase of getting to know a new technology, I think that this feature would be highly appreciated.

@vrravalos this looks great! I'm very curious about the translation to gdscript.

themancalledjakob avatar Feb 10 '25 16:02 themancalledjakob