1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-24 15:26:15 +00:00

Add Image.load_exr_from_buffer and enable tinyexr by default

This commit is contained in:
metamuffin
2025-01-08 00:40:08 +01:00
parent b79fe2e020
commit 6145b0ca29
8 changed files with 52 additions and 4 deletions

View File

@@ -3925,6 +3925,7 @@ void Image::_bind_methods() {
ClassDB::bind_method(D_METHOD("load_bmp_from_buffer", "buffer"), &Image::load_bmp_from_buffer);
ClassDB::bind_method(D_METHOD("load_ktx_from_buffer", "buffer"), &Image::load_ktx_from_buffer);
ClassDB::bind_method(D_METHOD("load_dds_from_buffer", "buffer"), &Image::load_dds_from_buffer);
ClassDB::bind_method(D_METHOD("load_exr_from_buffer", "buffer"), &Image::load_exr_from_buffer);
ClassDB::bind_method(D_METHOD("load_svg_from_buffer", "buffer", "scale"), &Image::load_svg_from_buffer, DEFVAL(1.0));
ClassDB::bind_method(D_METHOD("load_svg_from_string", "svg_str", "scale"), &Image::load_svg_from_string, DEFVAL(1.0));
@@ -4424,6 +4425,14 @@ Error Image::load_jpg_from_buffer(const Vector<uint8_t> &p_array) {
return _load_from_buffer(p_array, _jpg_mem_loader_func);
}
Error Image::load_exr_from_buffer(const Vector<uint8_t> &p_array) {
ERR_FAIL_NULL_V_MSG(
_exr_mem_loader_func,
ERR_UNAVAILABLE,
"The TinyEXR module isn't enabled. Recompile the Godot editor or export template binary with the `tinyexr_export_templates=yes` SCons option.");
return _load_from_buffer(p_array, _exr_mem_loader_func);
}
Error Image::load_webp_from_buffer(const Vector<uint8_t> &p_array) {
return _load_from_buffer(p_array, _webp_mem_loader_func);
}