-
-
Notifications
You must be signed in to change notification settings - Fork 101
Description
Describe the project you are working on
A game with many pck-files
Describe the problem or limitation you are having in your project
When wanting to create my pck-files, I will always have to save every resource to the file system before being able to insert it into a PCK.
This lets some things slot into place worse:
- Unpacking a ZIP export of the project and piecemeal-adding them into PCK files
- using EditorExportPlatform.export_project_files will call each file with a file_data PackedByteArray (it's another issue that it's hard or impossible to get a properly configurable preset with EditorExportPlatform, but that's for another day...)
Describe the feature / enhancement and how it helps to overcome the problem or limitation
Don't need to write many temp files
Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams
godot/core/io/pck_packer.cpp already gets a full byte buffer of the file which it then packs into the PCK.
It would be trivial to add another function that expects the buffer directly.
If this enhancement will not be used often, can it be worked around with a few lines of script?
Only by doing this:
var filename : String = "res://bla"
var packer : PCKPacker # imagine it's already initialized
var tmp = FileAccess.create_temp(FileAccess.WRITE_READ, "blabla", "bin", true)
tmp.store_buffer(buff)
tmp.close()
packer.add_file(filename, tmp.get_path_absolute())
return tmp
Is there a reason why this should be core and not an add-on in the asset library?
Implementing it using an external library would make it necessary to create temp files too.
Adding here, it is possible to reimplement the PCK Format (as it is rather simple) in pure GDScript (someone has actually done that in an addon), but as the core already has all the functionality, just doesn't expose this portion of it, I think it would be much less friction to spend the time to do it here.
If this proposal gets accepted, I would even do the change myself, it's really straightforward.