Godot Version
4.3
Question
Hey folks!
I’m building my own file editor as a learning project, and I wanna test it out for Godot projects.
When I set in the options that I use an external IDE like VS code, it reflects code changes in the Godot editor.
But when I edit files on the file system using my thing (so programmatically edit the files), I didn’t managed to get rid of the « Files changed on disk » modal I need to accept in Godot (after switching tabs to trigger it).
I tried to play around with the EditorFileSystem methods, like reimport_files([path]), but without success still have to accept this modal.
My goal is to directly edit Godot files on the file system for the changes to be reflected in the Godot editor in kinda « hot reload ».
Curious if you have any ideas ?
Here’s a quick example of what I’m trying to do:
var path = "/Users/hugoduprez/alfred/MyGame.tscn"
var editor_fs = EditorInterface.get_resource_filesystem()
var file = FileAccess.open(path, FileAccess.WRITE)
# This simulates the file being edited in my own external file editor
var file_data = """[gd_scene format=3 uid="uid://cxrsnpwdfbu5"]
[node name="MyGame" type="Node3D"]
[node name="Sphere" type="CSGSphere3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0)
radius = 1.0""";
if file:
file.store_string(file_data)
print("File edited")
file.close()
editor_fs.scan() # Doesn't get rid of the "File has been changed on disk" dialog
editor_fs.scan_sources() # This doesn't help either
editor_fs.update_file(path) # This doesn't help either