Godot: If a scene is open in godot and the scene file is modified outside godot a prompt should be given on whether or not to update or overwrite

Created on 3 Oct 2017  路  10Comments  路  Source: godotengine/godot

Operating system or device, Godot version, GPU Model and driver (if graphics related):
Linux Mint.
Godot 2.1.4.
GPU irrelevant.

Issue description:
If a scene is open in Godot and the scene file is externally modified no prompt is given of this conflict, if changes are made in Godot, saving will overwrite the external modifications to the scene file.
It should prompt the user whether or not to update the scene according to the new scene file or whether to overwrite these.
Ideally it should prompt immediately as the external changes are made.

Steps to reproduce:
Create a scene, make a change and save.
With the scene still open in Godot then externally modify the scene file(i.e by git pulling a commit with modifications to the scene)

Link to minimal example project:
An example project with its own readme.
https://github.com/AlekhineDev/godot-bug-scene-conflict

archived enhancement editor

Most helpful comment

I'm quite sure every OS has a way to get notifications to your program when a file has been changed (like inotify as @uldall mentioned above). This would be the "correct" way to implement this.

All 10 comments

This is a nuisance when working with a team on a project, when for instance pulling changes to a scene while the scene is open in godot. As these changes get discarded, and not shown when running the scene, and also overwritten if you save the scene.

@AlekhineDev You got less problem when changed are made from external source (coder or repository pull) when you disable this editor setting "Auto Save Before Running" https://github.com/godotengine/godot/issues/8994

There is also this issue. https://github.com/godotengine/godot/issues/8615

On Linux I guess this could be done with inotify. When a change happens to a scene file in the filesystem (and the scene has unsaved in-memory changes) a popup could appear in Godot prompting the user to take actions. Either discard current changes or overwrite the filesystem version with the current in-memory working copy.

You could also read the timestamp when reading in the file initially, then the timestamp can be checked again on saving to see if it has been modified. You could poll for the timestamp if you want to get notifications during editing.

I'm quite sure every OS has a way to get notifications to your program when a file has been changed (like inotify as @uldall mentioned above). This would be the "correct" way to implement this.

Note partially related to @NathanWarden and this issue in general:
Listening to file notifications might not be the only way. In Unity, I turned off the auto-reimport precisely to avoid messing with situations where I do a complex merge: sometimes when merging I need to take a look at the editor to verify the state of something, without having it reimport half-broken stuff or blocking me with a prompt. Then, when I'm done with the merge, I use their Ctrl+R shortcut which triggers the reimport-modified-stuff behavior, and it always worked beautifully (unless a dll is involved ofc). Which means there is a way to do it in a deferred way as well. I like the way this is consistently reliable across that engine.
I think Godot does this on re-focus without even giving you a choice, and yet it prompts you only on specific regions of the editor such as the script editor (at least that's how it was last time I checked) because it was in response to specific issues. The current issue shows that this problem is wider.

For the time being - is there a way around this issue that's better than quitting the editor before every git pull?

It's interesting because the title of the issue says a prompt should be given on whether or not to update or overwrite. Closing Godot does not works this around in any way, in fact it means you DO want to pick the file on disk in every case and prevent Godot from overwriting anything. The other way around (choosing which loaded resource you want to take over the one on disk) is harder to workaround without a dialog that lets you choose for every single resource.

@Zylann

Closing Godot does not works this around in any way

It does work around the issue of the editor overwriting any changes pulled from remote. As it is now, any external changes are simply discarded.

Was this page helpful?
0 / 5 - 0 ratings