Godot version:
Godot 3.1 alpha 4 and 3.2 master (a0ce88f953a4311edc726523ff8724b891407855)
OS/device including version:
Windows 10 x64
Manjaro Linux 18.1.5
Issue description:
I'm using a Node with a tool script to open a file and generate a custom resource. For instance, using a Twine/Yarn dialogue data to generate a native godot resource (.tres) with ResourceSaver.save().
The issue is when I need to re-import this data and overwrite the .tres file. If this resource is already loaded in the resource cache/history of the editor, the .tres will be updated but if I save/run any scene, it will be overwritten again with the cached data.
To fix it I need to import the data and restart the editor.
Steps to reproduce:
Minimal reproduction project:
custom-resource-update.zip
I'm having this issue with pretty much any custom resources tres file. If you change any data in an external application it will not resync in Godot, external including running your own game from the editor. Appears that the engine is not watching changes to the filesystem for file modification, only file creation and deletion.
A fast workaround to fix this would be to expose the ability to manually reindex the project with a button on the FileSystem inspector in Godot editor. This is a common ability that I see in many IDEs that index their projects, such as IntelliJ. There should also probably be a filesystem watcher (inotify) that recursively checks and reimports files if it detects any changes potentially from external editors. This would help significantly when dealing with things like git merge conflicts while the editor is open, since I usually always have it running when working on a project.
Just like @nhydock Nicholas points out above, we have the issue with Open RPG: we're trying to use Godot's Resources to store most data, but anything saved during a debug run of the game with ResourceSaver.save, the entire tree of Resources this Resource holds will be reverted to their default values upon closing the game.
I wanted to use this so we could save and load debug savegames and other user data like game settings in the res:// folder during development to be able to edit and test the resources straight in the inspector, for testing purposes.
i think what the editor does is read the properties from disk and update them on the running resource. This works for some resources but not all of them. Maybe a method you can override to do your own logic would be enough?
That sounds fine by me :)
@reduz Maybe a method you can override to do your own logic would be enough?
How exactly would that work?
// edit, seems to be a won't fix https://github.com/GDquest/godot-open-rpg/issues/159#issuecomment-450737664 ... will read about the other ways to store files.. maybe my git problem can be solved.
Godot 3.1.beta.calinou.9ca6ffa win x64:
Open VehicleBody stored in res:// in Godot,
Open VehicleBody in text editor,
Change mass in text editor and save,
--> Mass of VehicleBody doesn't change in Godot.
Close VehicleBody in Godot without saving or changing something,
--> Text editor complains that mass of VehicleBody changed back to old value.
So to pull changes from git it seems that I first have to close Godot, then pull, then reopen Godot.
My suggestion would be only save when pressign save. Reload when opening / pressing a new "reload from disk" button / option to always directly reload disk changes.
Is this still reproducible in the current master branch / latest 3.2 builds?
Yep, still reproducible.
Tested with master (a0ce88f953a4311edc726523ff8724b891407855).
Just to add up another case where the editor doesn't refresh the .tres
I have a Tileset with collisions if I add a collision manually in the .tres and if this is a new collision shape for a particular tile. It's loaded fine.
But if I edit existing shape than the new shape is not loaded until I close the Godot editor and reopened it again.
First thing I was looking was some button "Reload resource" or "Reimport"
So it'll be really good is something like this is added.
But if I edit existing shape than the new shape is not loaded until I close the Godot editor and reopened it again.
If you save the scene, you can use Scene > Revert Scene to reload the scene file on disk. This is faster than closing and reopening the editor. There's no keyboard shortcut associated to that action by default, but you can define one in the Editor Settings. (If we can find a sensible default shortcut, it'd make sense to add one.)
Are there any news about this issue?
I was implementing an in-game editor like @NathanLovato said in the previous comment.
For my use case I managed to bypass the actual problem by making a copy of the targeted resource in the user:/ folder and checking if the file exists there before the actual resource in the res:/ directory.
This will definitely help anyone making in-game resource editors
@raptdwar As far as I know, nobody has started working on a fix yet.
Anyone know a workaround?
I made an editor that saves off textures to res, but it's having this issue..
This really needs to be addressed.
I shouldn't have to implement a custom handler or call reload or update through setters.
The editor should do all this for us.
Note that the Scene > Revert Scene approach suggested above does not seem to work (anymore?). At least not with AnimationTrees as resources. This leaves me with no other choice than restarting the editor every time I want to see the changes to my procedurally generated resources.
Most helpful comment
How exactly would that work?