Save files always in the same way

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Dhal_Naka

HI everyone! A newbie here.

I’m experiencing some undesired issues with Godot and gitHub. As you may know Godot files change how they save the file depending on the moment you save the file, eg, you save the file in the beginning of an animation or in the middle of it, the saved values are different.

I would love to see only the real changes, and not unrelated changes due to this saving way. I know I can use the RESET animation, but does not always do the work, you need like save the file twice to make it work, and anyway animations that don’t need a RESET would not be covered.

I was trying to make a script to save all the files always in the same way. My idea it’s to:

1- run through all the animation nodes
2- on each animation node, run through all the animations, from the last one to the first one (which sometimes will be the RESET animation) and leaving them all in the frame 0.
3- save the file.

I have part of it done, but I’m getting nuts in the simplest part, and I can’t believe it’s that hard. The 3rd point, something so simple as saving the file.

I’ve made a button and I’m trying to run this

extends Button

func _pressed():
	var scene_tree = get_tree()
	var current_scene = scene_tree.get_current_scene()
	var path = get_tree().edited_scene_root.filename, current_scene)

But I’m getting this error:
Can’t save empty resource to path ‘res://scenes/file_save_playground.tscn’.

Do you know what I’m doing wrong? Thanks!

Unsure what you’re trying to achieve here, the animation state?

In godot, there’s a Reset On Save property of the animation player. Perhaps you mean to use this?

AnimationPlayer — Godot Engine (stable) documentation in English

spaceyjase | 2023-06-14 10:28

I just want to know what I’m doing wrong there to not be able to save the file and get that error :S

I know about the RESET animation thing, but it’s not working as expected, and not all the animations have a RESET animation.

Dhal_Naka | 2023-06-14 10:43