Skip to content

Provide and document the solution to deal with .uid file movements in external editors #11565

@YYF233333

Description

@YYF233333

Edit: This proposal now mainly focus on resolving .uid file cluttering with file nesting, and automate/document the solution.

Original proposal:

Describe the project you are working on

Godot

Describe the problem or limitation you are having in your project

Just read https://godotengine.org/article/uid-changes-coming-to-godot-4-4/ and see this:

Secondly, when you move a script or shader outside Godot, you should also move the .uid file along with it.

This sounds absolutely terrible. If I want to pick something instead of all from a folder, I need to double the clicks now? Also it is impossible to move C# scripts in Visual Studio, as VS know nothing about uid, right?

I think this definitely needs a patch, preferably before 4.4 stable.

Describe the feature / enhancement and how it helps to overcome the problem or limitation

When I ask GPT, it provides me this piece of code:

from watchdog.observers import Observer
from watchdog.events import FileSystemEventHandler
import shutil
import os

class FileMoveHandler(FileSystemEventHandler):
    def on_moved(self, event):
        if not event.is_directory:
            if "file1" in event.src_path:
                src_dir = os.path.dirname(event.src_path)
                dest_dir = os.path.dirname(event.dest_path)
                other_file = os.path.join(src_dir, "file2")
                if os.path.exists(other_file):
                    shutil.move(other_file, dest_dir)

observer = Observer()
observer.schedule(FileMoveHandler(), path="/path/to/watch", recursive=True)
observer.start()

So we do have some sort of File Movement Event, utilizing this we can move files around freely with the uids following automatically.

Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams

Develop a simple program, running at background. Whenever a file in the project is moved, check if the uid is moved too. If not, do users a favour.

This should not be built into the editor as we mainly want this functionality when the editor is closed. It should be an official plugin or something, people can download that inside the editor (or by other convenient ways). Idealy we should add it to startup items so we won't forget to start the service itself.

If this enhancement will not be used often, can it be worked around with a few lines of script?

This functionality is quite simple, but handling cross-platform compatibility and other edge cases can be very tricky. Therefore, it's best to have a centralized repository where everyone can collaborate to resolve bugs. Additionally, considering that the primary audience for this feature consists of people who either can't or don't want to code, it would be ideal to provide a precompiled binary and a highly simplified installation process.

Is there a reason why this should be core and not an add-on in the asset library?

The functionality itself won't be in the core. But we need some kind of announcement letting people know. Otherwise they may flood into github issue or reddit complaining about this :)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions