Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a Resource to handle project files/directories references #9552

Open
simo498 opened this issue Apr 18, 2024 · 1 comment · May be fixed by godotengine/godot#91815
Open

Add a Resource to handle project files/directories references #9552

simo498 opened this issue Apr 18, 2024 · 1 comment · May be fixed by godotengine/godot#91815

Comments

@simo498
Copy link

simo498 commented Apr 18, 2024

References my open discussion #9545 (comment)

Describe the project you are working on

An RPG game, where any of the adjacent rooms are loaded at runtime

Describe the problem or limitation you are having in your project

Each of the rooms needs to keep the reference to the adjacent rooms as a string path, but the only way assign file paths to a property is by passing a string representing it. You can use an attribute hint to make it easier:

[Export(PropertyHint.File)] // or [Export(PropertyHint.Dir)]
public string pathToResource; //or pathToPackedScene, or pathToDir

but it's still not possible to keep track of files/directories which get renamed or moved.

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

If you use a resource directly, the engine is able to keep track of it even when renamed or moved inside the editor, i'd like to implement something similar but limiting this feature to keep track of a (project) resource path (or directory), to give the developer a way to manually handle each resource (when load/unload them, and how to do it, for example using other threads to load some scenes and resources)

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

  • This functionality should be added as a new resource type (something like Path), which only takes a string as its member fields.

  • The user should be able to pass a file/directory into this resource from the editor, and the latter should be tracked by the editor and updated whether it gets moved or renamed from inside the editor.

  • The user should be able to access the file path as a string with a method

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

It can't be worked around. The only way to achieve the same result is by manually changing each of the references to a certain file/directory when moved/renamed (which is not convenient at all, in particular when you are moving a large amount of file into a new location, and might lead to some of the references to be null if you forget to manually update them)

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

It should improve the editor usability, as it's a missing core funcionality

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants