mirror of https://github.com/godotengine/godot
Compress LightmapGIData, VoxelGIData and baked ArrayOccluder3D in the editor
This results in smaller files that are present outside `.godot/`, and therefore committed to version control. Since these files are regularly updated in projects, this adds up to significant size savings when using Git (and therefore faster repository clones). Additionally, other formats that may be saved as binary from the editor and committed to version control will now use compression. This does not affect files that use text-based formats. Example on Truck Town: - VoxelGIData: 9,159,442 -> 2,244,616 bytes (4.1x smaller) - LightmapGIData: 588,031 -> 319,785 bytes (1.8x smaller) - ArrayOccluder3D: 253,480 -> 109,887 bytes (2.3x smaller) The compression is lossless.
This commit is contained in:
parent
39c201ca58
commit
d27988aa04
|
|
@ -1233,7 +1233,7 @@ void EditorAudioBuses::_drop_at_index(int p_bus, int p_index) {
|
||||||
|
|
||||||
void EditorAudioBuses::_server_save() {
|
void EditorAudioBuses::_server_save() {
|
||||||
Ref<AudioBusLayout> state = AudioServer::get_singleton()->generate_bus_layout();
|
Ref<AudioBusLayout> state = AudioServer::get_singleton()->generate_bus_layout();
|
||||||
ResourceSaver::save(state, edited_path);
|
ResourceSaver::save(state, edited_path, ResourceSaver::FLAG_COMPRESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
void EditorAudioBuses::_select_layout() {
|
void EditorAudioBuses::_select_layout() {
|
||||||
|
|
@ -1276,7 +1276,7 @@ void EditorAudioBuses::_file_dialog_callback(const String &p_string) {
|
||||||
AudioServer::get_singleton()->set_bus_layout(empty_state);
|
AudioServer::get_singleton()->set_bus_layout(empty_state);
|
||||||
}
|
}
|
||||||
|
|
||||||
Error err = ResourceSaver::save(AudioServer::get_singleton()->generate_bus_layout(), p_string);
|
Error err = ResourceSaver::save(AudioServer::get_singleton()->generate_bus_layout(), p_string, ResourceSaver::FLAG_COMPRESS);
|
||||||
if (err != OK) {
|
if (err != OK) {
|
||||||
EditorNode::get_singleton()->show_warning(vformat(TTR("Error saving file: %s"), p_string));
|
EditorNode::get_singleton()->show_warning(vformat(TTR("Error saving file: %s"), p_string));
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
|
|
@ -2196,7 +2196,7 @@ void EditorNode::_dialog_action(String p_file) {
|
||||||
|
|
||||||
MeshLibraryEditor::update_library_file(editor_data.get_edited_scene_root(), ml, merge_with_existing_library, apply_mesh_instance_transforms);
|
MeshLibraryEditor::update_library_file(editor_data.get_edited_scene_root(), ml, merge_with_existing_library, apply_mesh_instance_transforms);
|
||||||
|
|
||||||
Error err = ResourceSaver::save(ml, p_file);
|
Error err = ResourceSaver::save(ml, p_file, ResourceSaver::FLAG_COMPRESS);
|
||||||
if (err) {
|
if (err) {
|
||||||
show_accept(TTR("Error saving MeshLibrary!"), TTR("OK"));
|
show_accept(TTR("Error saving MeshLibrary!"), TTR("OK"));
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
|
|
@ -663,7 +663,7 @@ void Skeleton3DEditor::_file_selected(const String &p_file) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Error err = ResourceSaver::save(sp, p_file);
|
Error err = ResourceSaver::save(sp, p_file, ResourceSaver::FLAG_COMPRESS);
|
||||||
|
|
||||||
if (err != OK) {
|
if (err != OK) {
|
||||||
EditorNode::get_singleton()->show_warning(vformat(TTR("Error saving file: %s"), p_file));
|
EditorNode::get_singleton()->show_warning(vformat(TTR("Error saving file: %s"), p_file));
|
||||||
|
|
|
||||||
|
|
@ -173,7 +173,7 @@ void VoxelGIEditorPlugin::_voxel_gi_save_path_and_bake(const String &p_path) {
|
||||||
Ref<VoxelGIData> voxel_gi_data = voxel_gi->get_probe_data();
|
Ref<VoxelGIData> voxel_gi_data = voxel_gi->get_probe_data();
|
||||||
ERR_FAIL_COND(voxel_gi_data.is_null());
|
ERR_FAIL_COND(voxel_gi_data.is_null());
|
||||||
voxel_gi_data->set_path(p_path);
|
voxel_gi_data->set_path(p_path);
|
||||||
ResourceSaver::save(voxel_gi_data, p_path, ResourceSaver::FLAG_CHANGE_PATH);
|
ResourceSaver::save(voxel_gi_data, p_path, ResourceSaver::FLAG_CHANGE_PATH | ResourceSaver::FLAG_COMPRESS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1468,8 +1468,7 @@ LightmapGI::BakeError LightmapGI::bake(Node *p_from_node, String p_image_data_pa
|
||||||
/* Compute a BSP tree of the simplices, so it's easy to find the exact one */
|
/* Compute a BSP tree of the simplices, so it's easy to find the exact one */
|
||||||
}
|
}
|
||||||
|
|
||||||
gi_data->set_path(p_image_data_path, true);
|
Error err = ResourceSaver::save(gi_data, "", ResourceSaver::FLAG_COMPRESS);
|
||||||
Error err = ResourceSaver::save(gi_data);
|
|
||||||
|
|
||||||
if (err != OK) {
|
if (err != OK) {
|
||||||
return BAKE_ERROR_CANT_CREATE_IMAGE;
|
return BAKE_ERROR_CANT_CREATE_IMAGE;
|
||||||
|
|
|
||||||
|
|
@ -678,7 +678,7 @@ OccluderInstance3D::BakeError OccluderInstance3D::bake_scene(Node *p_from_node,
|
||||||
|
|
||||||
occ->set_arrays(vertices, indices);
|
occ->set_arrays(vertices, indices);
|
||||||
|
|
||||||
Error err = ResourceSaver::save(occ, p_occluder_path);
|
Error err = ResourceSaver::save(occ, p_occluder_path, ResourceSaver::FLAG_COMPRESS);
|
||||||
|
|
||||||
if (err != OK) {
|
if (err != OK) {
|
||||||
return BAKE_ERROR_CANT_SAVE;
|
return BAKE_ERROR_CANT_SAVE;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue