Is there an easy way to move files and update all node references to it's new path?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By avencherus
:warning: Old Version Published before Godot 3 was released.

I’m wondering if there is an option that allows you to move a file in the file manager, and automatically update all the nodes that have a reference to it?

It seems just moving files in the file manager will break all connections to it, and you have to manually update all node properties that use it.

:bust_in_silhouette: Reply From: Zylann

EDIT: If you use the FileBrowser dock to move files, the editor will attempt to update most references (Godot 2.1.4). I did this recently on a game and it worked, I just had to close open files in the script editor and change some scripts because they were referencing old paths.


Old answer:
I don’t think there is. This is how Godot works. In theory it can be implemented, by fetching every file in the project, searching for places where the path is written and replace it. But it would only work if all format is text, if there are binary assets (.scn, .res, .msh…) they will have to be loaded first and checked for every reference, making the process more tricky. And even more, some assets may reference the asset with a full path, others with a relative path (including scripts!).
So… it’s not built-in, it’s doable, but not trivial. For now you have to use the dependency fix dialog, or write a plugin.

Edit: also, there might be a way to actually improve from the dependency fix dialog, which actually fectched the places for us.

Thanks Zylann.

I was considering writing a script or plugin in the future to handle remapping some sprites, if I ended up needing to change how I organized my images and textures. Wanted to be sure I wasn’t missing something, because it always seems like I’m discovering some little nook that has a useful feature, after I’ve assumed it didn’t exist, and began making my own solution.

I’ll also make a note of the dependency dialog as well, for when the time comes.

avencherus | 2016-10-07 11:39

This sucks royally. I’m currently struggling with this problem too. I moved some assets to organize them better and now some of my scenes crash when played, despite them loading fine in the editor :stuck_out_tongue: In the debugger it says that it cannot find the referred files, but the paths it reports seem to be fine, so I can’t figure out what’s wrong :stuck_out_tongue:

SasQ | 2017-12-13 20:33

I edited my answer, I moved files through the file browser dock, the editor will attempt to update paths if you do it in the editor.

Zylann | 2017-12-13 22:08