godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
91.04k stars 21.18k forks source link

Delete, rename, open confuses godot editor. #39469

Open oguzhantopcu opened 4 years ago

oguzhantopcu commented 4 years ago

Godot version: 3.2.1

OS/device including version: Fedora 32/KDE, it does not matter.

Issue description: Delete, rename, open flow confuses godot editor.

Steps to reproduce: 1.) Open a scene, 1.tscn (scene A). 2.) Open a scene, 2.tscn (scene B). 3.) Delete scene 1.tscn. 4.) Rename scene 2.tscn to scene 1.tscn. 5.) Open 1.tscn.

Expected behaviour: show scene B Actual behaviour: shows scene A

rsubtil commented 4 years ago

I followed your steps, but the editor is showing the expected behaviour (opening scene B). Can you record this behaviour?

oguzhantopcu commented 4 years ago

Here you are.

simplescreenrecorder-2020-09-25_19.02.26.zip

rsubtil commented 4 years ago

Sorry for the late late reply, have been pretty busy with other stuff :stuck_out_tongue:

From what I can tell, that happens because even though Godot deletes a file, it doesn't remove if from the currently opened files. And then, when you open the new file that has the same name as the old one, Godot reuses what's already opened for that.

I think the best solution is to simply remove the tab from the opened files if the user deletes it from the FileSystem dock.

oguzhantopcu commented 4 years ago

Well, there are workarounds, obviously. I can live with this bug, too. But this is a bug.

At the and of the day It is up to you to fix it or not since we are all volunteers here.

KoBeWi commented 4 years ago

I looked at the code of the PR for this issue and the old behavior looks like intended. This is similar to e.g. VS Code where deleting an opened script will mark its tab as deleted. image Maybe we could do similar for scene tabs instead of removing them?

See also #40515

rsubtil commented 4 years ago

Ah, I didn't know there was a proposal already :stuck_out_tongue:

I think a system like VSCode would be better, but not entirely as it's described in the proposal. I'll write a more detailed opinion there: https://github.com/godotengine/godot-proposals/issues/1550

oguzhantopcu commented 4 years ago

IMHO VS Code's behaviour is pretty OK, too.

akien-mga commented 2 years ago

See https://github.com/godotengine/godot/pull/42885#issuecomment-1175037982 for a suggestion on how to solve this bug.

For the usability part around deleted scenes/scripts, discussion can continue in https://github.com/godotengine/godot-proposals/issues/1550.