-
-
Notifications
You must be signed in to change notification settings - Fork 21.5k
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
Godot should be able to import a CSV without forcing it to be used for translation #19627
Comments
Which kind of resource a CSV is? I think there is only this choice in the importer because a Translation is a resource with some format requirements, whereas raw CSV data doesn't need to be imported, it can just be loaded as is using file functions (same story for JSON and TXT btw). |
To be fair, I'm not specifically requesting csv be "importable" (might be cool to display them as a simple resource with a little viewer in the inspector, but i assume this is easy enough to do custom, just might be a nice addition but out of scope of this issue) but it is very misleading or confusing seeing a bunch of red error-stuff on it if you're trying to use a csv in your project, perhaps an option in the import menu to just say something like "this isn't a translation csv, just a normal one, so don't try and import it" or something along those lines |
I still have a lot of import error for CSV files each time I switch from editor to running project and switch back to editor while debugging. And, most big issue: Editor goes deadlock (and only way out is closing the editor) while debugging the project at any breakpoint following CSV.open(path,WRITE) and before executing CSV.close(). Is it bad to have an option to import "as is"? |
@burstina As a workaround, you can change the file extension to something else like |
The benefit of using CSV would be to quickly change and edit and manage larger amounts of data in a spreadsheet like Open Office Calc. Being forced to change the extension to .txt sucks because it's like throwing a brick in the designers flow, but if you don't iterate over your data often (aka not really doing design or balancing work), it at at least kinda works. It won't show up in the file manager and I haven't tested yet if it will get exported, though. From my recent comment on reddit concerning the same subject:
I really hope the Godot devs consider closer and more open CSV integration. From balancing FPS to strategy games or data driven games like card games, I can see this benefiting all kinds of games with larger data structures. |
Looks like the only problem here is to tell Godot to NOT run the importer on these files. Apart from that, they can be loaded just fine with the |
@Zylann Where is this CSV class? I don't see it in the latest docs and a search in the source code doesn't turn up a dedicated class for it (that I can find)... Edit: Oh, nevermind. I see that the File API includes CSV file type methods for reading/writing data. Gotcha. |
On second thought, I'm not entirely sure if my PR is the best solution for this Issue. If someone were to open up the "CSV Translation" import options and see an option to "toggle on the actual parsing of this file as a translation CSV" not checked by default...it'd be really weird. But you can't make the importer NOT get pulled into the list of importers that match the file extension so...as far as I can tell, this is the only way, given the current system, to make it not do it by default. Perhaps a better solution(?) would be to add an entirely new importer for the .csv extension that doesn't consider CSV files to be translation files? But we don't really have a resource that we plan to parse the file into, so it doesn't make sense to write a ResourceImporter just to make the dropdown not use CSV Translation by default. Thoughts? Edit: I mean, I'm not entirely opposed to creating a dedicated resource for CSVFile types and then writing an importer for it that is set as the default. Would that be acceptable to everyone? I already have a partial implementation as a CSVFile class (modeled like the ConfigFile class) in godot-next. |
|
Maybe someone in future writes an importer feature to also have checkboxes for "Import as Array of Arrays" and "Import as Dictionary" ... would be really cool and a lot more accessible for designers. |
It's kind of an odd lie, within the source code anyway, since, regardless of whether it is actually parsed into a translation resource, the "resource_type" that will be affiliated with the CSV file is "Translation". And the importer itself is literally ResourceImporterCSVTranslation, lol. The simplest way to fix it would be to just write a whole different importer (and would presumably grant more usability for CSV files overall that way). I mean, I could just refactor the CSV import to have no mention of translation whatsoever aside from the boolean toggle I added and the logic not exiting early and doing translation stuff, but that would be a really hacky way to do it which I would rather avoid. If I did that, anyone who looked at the code would be like, "What the heck? Why was this written this way?" |
That sounds like a clean solution
This soulds like something somebody already said while crawling godot source code :) |
Haha! Especially because the importer has this drop down menu rn with "Import as..." and CSV Translation being the only option. Almost like a prank. Well, actually exactly like a prank. :) |
I went ahead and started writing a new Godot module for a Spreadsheet resource class that would be able to load CSV files, but also presumably support other spreadsheet-like file formats. Would also ideally be able to fulfill a similar purpose as UE4's DataTable types (a table of StringName-Script/Dictionary pairs). |
Fixed by #31927. |
I see this was addressed in 3.2 but I cannot figure out how to actually get Godot to stop trying to treat the |
In Godot 3.3 and later, you can use the Keep File (No Import) mode for any resource: After doing this, remember to add |
Godot version:
3.0.3
OS/device including version:
N/A (all)
Issue description:
Importing a CSV appears to only be possible if it's used for translation, I think most people coming to Godot from other engines would assume they could import a CSV as just a container for simple data by default (especially as there appears to be functions for working with CSV files! importing as another extension just seems like a hack, not a solution) - with an option in the import menu to mark it to be used for translations if that's the actual purpose
Steps to reproduce:
Add csv to project
Click it, go to import menu
Expected an option to import it as a normal CSV, but can only be used for translation
Minimal reproduction project:
N/A (blank project with an added csv file)
The text was updated successfully, but these errors were encountered: