Skip to content

Commit f027032

Browse files
committed
Use ResourceSaver
1 parent 4db600e commit f027032

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/baked_reflection_data.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
#include "baked_reflection_data.hpp"
2+
23
#include <godot_cpp/core/class_db.hpp>
34
#include <godot_cpp/variant/utility_functions.hpp>
5+
#include <godot_cpp/classes/resource_saver.hpp>
6+
#include <godot_cpp/variant/utility_functions.hpp>
47

58
using namespace godot;
69

@@ -22,6 +25,11 @@ void SteamAudioBakedReflectionData::set_serialized_data_internal(IPLbyte *data)
2225
for (size_t i = 0; i < sizeof(data); ++i) {
2326
serialized_data[i] = data[i];
2427
}
28+
29+
Error result = ResourceSaver::get_singleton()->save(this, get_path(), ResourceSaver::FLAG_COMPRESS);
30+
if (result != OK) {
31+
UtilityFunctions::push_error("Failed to save the baked reflection data resource. Error code: " + String::num_int64(result));
32+
}
2533
}
2634

2735
void SteamAudioBakedReflectionData::set_serialized_data(const PackedByteArray& p_data) {

0 commit comments

Comments
 (0)