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

Change the import logic to operate on segmented file extensions (eg.: .tar.gz) or filename endings instead of terminal file extensions (eg.: .gz) #9888

Open
Gnumaru opened this issue Jun 4, 2024 · 0 comments

Comments

@Gnumaru
Copy link

Gnumaru commented Jun 4, 2024

Describe the project you are working on

More than one godot project

Describe the problem or limitation you are having in your project

I want to create an import plugin that handles file extensions already recognized by the editor like csv and json or any other.

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

The editor would decide on how to import files based on segmented file extensions (like .tar.gz) instead of terminal file extensions (only gz for .tar.gz), or even just plain filename endings, which make the import process work for files without extension.

With this people could create all sorts of segmented extensions without clashing with existing ones. For example the editor could import only .csv files as translations and ignore any segmented extension where the terminal extension is .csv. To prevent backwards compatibility breakage, a project setting could be created chose if the default import method uses only terminal extensions or segmented extensions/filename endings.

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

Instead of the current behavior where an extension is mandatory (and files without a dot character cannot be handled at all) and the import process operates only over terminal extensions (eg.: csv for thing.items.csv; json for thing.dialog.json), editor plugins would now operate over segmented file extensions (eg.: .items.csv instead of .csv, .dialog.json instead of .json) or over filename endings (eg.: use the ending "README" would match a file without any extension but whose name ends with "README").

The String class would get a method "get_full_extension" that is almost identical tot he current get_extension, but it would get a substring starting from the first dot instead of the last dot. Then while importing, the editor would use "get_full_extension" to determine the file type if the "import_files_using_full_extension" project setting is true, or using "get_extension" if it is false. The default value for import_files_using_full_extension would be false.

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

The users can always create a different terminal extension by themselves. But since most software use only the terminal extension to recognize files, it would be cumbersome to use that made-up extension with other softwares. For example, a made-up extension .dialog_json would not clash with anything in godot but then the operating system and external software integration would get messed up, the user would have to manually associate that file type to open with some software, maybe the text editor the person uses won't show the json highlight right away and the person would need to further configure his editor to recognize that made-up extension as json, etc.

Besides that, It would be pretty easy to create editor import plugins for handling imports of common file extensions like json and csv that are not meant to import every json or every csv, but only a subset of them.

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

I don't know if this editor behavior change is possible without changing the logic of the import process, which is core.

@Gnumaru Gnumaru changed the title Change the import logic to operate on segmented file extensions or filename endings instead of terminal file extensions Change the import logic to operate on segmented file extensions (eg .tar.gz) or filename endings instead of terminal file extensions (eg .gz) Jun 5, 2024
@Gnumaru Gnumaru changed the title Change the import logic to operate on segmented file extensions (eg .tar.gz) or filename endings instead of terminal file extensions (eg .gz) Change the import logic to operate on segmented file extensions (eg.: .tar.gz) or filename endings instead of terminal file extensions (eg.: .gz) Jun 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants