Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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 #11803

Closed
AlekhineDev opened this issue Oct 3, 2017 · 10 comments · Fixed by #31747

Comments

@AlekhineDev
Copy link

AlekhineDev commented Oct 3, 2017

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

@AlekhineDev
Copy link
Author

AlekhineDev commented Oct 3, 2017

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.

@groud groud added this to the 2.1 milestone Oct 3, 2017
@puppetmaster-
Copy link

puppetmaster- commented Oct 4, 2017

@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" #8994

There is also this issue. #8615

@uldall
Copy link
Contributor

uldall commented Oct 6, 2017

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.

@raymoo
Copy link
Contributor

raymoo commented Oct 6, 2017

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.

@NathanWarden
Copy link
Contributor

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.

@Zylann
Copy link
Contributor

Zylann commented Oct 3, 2020

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.

@rzuf79
Copy link

rzuf79 commented Oct 3, 2020

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

@Zylann
Copy link
Contributor

Zylann commented Oct 3, 2020

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.

@rzuf79
Copy link

rzuf79 commented Oct 3, 2020

@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.

@Calinou
Copy link
Member

Calinou commented Oct 3, 2020

Duplicate of #20250.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

10 participants