From 4ec566fae2d849776cf378ebacd84654dc32d58c Mon Sep 17 00:00:00 2001 From: MineBill Date: Wed, 28 Jun 2023 00:26:25 +0300 Subject: [PATCH] Set the VoxelGIData path before saving, otherwise the ResourceSave will revert it to an empty String (cherry picked from commit c34d5627fb4718ad8f89cafa552a9e6658074eb9) --- editor/plugins/voxel_gi_editor_plugin.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/editor/plugins/voxel_gi_editor_plugin.cpp b/editor/plugins/voxel_gi_editor_plugin.cpp index 5ae5468e4bb..43b133f4b53 100644 --- a/editor/plugins/voxel_gi_editor_plugin.cpp +++ b/editor/plugins/voxel_gi_editor_plugin.cpp @@ -166,8 +166,13 @@ void VoxelGIEditorPlugin::_voxel_gi_save_path_and_bake(const String &p_path) { probe_file->hide(); if (voxel_gi) { voxel_gi->bake(); - ERR_FAIL_COND(voxel_gi->get_probe_data().is_null()); - ResourceSaver::save(voxel_gi->get_probe_data(), p_path, ResourceSaver::FLAG_CHANGE_PATH); + // Ensure the VoxelGIData is always saved to an external resource. + // This avoids bloating the scene file with large binary data, + // which would be serialized as Base64 if the scene is a `.tscn` file. + Ref voxel_gi_data = voxel_gi->get_probe_data(); + ERR_FAIL_COND(voxel_gi_data.is_null()); + voxel_gi_data->set_path(p_path); + ResourceSaver::save(voxel_gi_data, p_path, ResourceSaver::FLAG_CHANGE_PATH); } }