summaryrefslogtreecommitdiff
path: root/editor/pvrtc_compress.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'editor/pvrtc_compress.cpp')
-rw-r--r--editor/pvrtc_compress.cpp21
1 files changed, 9 insertions, 12 deletions
diff --git a/editor/pvrtc_compress.cpp b/editor/pvrtc_compress.cpp
index 43963d3aae..23bcf9540e 100644
--- a/editor/pvrtc_compress.cpp
+++ b/editor/pvrtc_compress.cpp
@@ -38,25 +38,25 @@
#include "editor_settings.h"
#include "scene/resources/texture.h"
-static void (*_base_image_compress_pvrtc2_func)(Image *) = NULL;
-static void (*_base_image_compress_pvrtc4_func)(Image *) = NULL;
+static void (*_base_image_compress_pvrtc2_func)(Image *) = nullptr;
+static void (*_base_image_compress_pvrtc4_func)(Image *) = nullptr;
static void _compress_image(Image::CompressMode p_mode, Image *p_image) {
-
String ttpath = EditorSettings::get_singleton()->get("filesystem/import/pvrtc_texture_tool");
if (ttpath.strip_edges() == "" || !FileAccess::exists(ttpath)) {
switch (p_mode) {
-
case Image::COMPRESS_PVRTC2:
- if (_base_image_compress_pvrtc2_func)
+ if (_base_image_compress_pvrtc2_func) {
_base_image_compress_pvrtc2_func(p_image);
- else if (_base_image_compress_pvrtc4_func)
+ } else if (_base_image_compress_pvrtc4_func) {
_base_image_compress_pvrtc4_func(p_image);
+ }
break;
case Image::COMPRESS_PVRTC4:
- if (_base_image_compress_pvrtc4_func)
+ if (_base_image_compress_pvrtc4_func) {
_base_image_compress_pvrtc4_func(p_image);
+ }
break;
default:
ERR_FAIL_MSG("Unsupported Image compress mode used in PVRTC module.");
@@ -98,7 +98,7 @@ static void _compress_image(Image::CompressMode p_mode, Image *p_image) {
// Save source PNG.
Ref<ImageTexture> t = memnew(ImageTexture);
- t->create_from_image(Ref<Image>(p_image), 0);
+ t->create_from_image(Ref<Image>(p_image));
ResourceSaver::save(src_img, t);
Error err = OS::get_singleton()->execute(ttpath, args, true);
@@ -109,7 +109,7 @@ static void _compress_image(Image::CompressMode p_mode, Image *p_image) {
ERR_FAIL_MSG("Could not execute PVRTC tool: " + ttpath);
}
- t = ResourceLoader::load(dst_img, "Texture");
+ t = ResourceLoader::load(dst_img, "Texture2D");
if (t.is_null()) {
// Clean up generated files.
DirAccess::remove_file_or_error(src_img);
@@ -125,17 +125,14 @@ static void _compress_image(Image::CompressMode p_mode, Image *p_image) {
}
static void _compress_pvrtc2(Image *p_image) {
-
_compress_image(Image::COMPRESS_PVRTC2, p_image);
}
static void _compress_pvrtc4(Image *p_image) {
-
_compress_image(Image::COMPRESS_PVRTC4, p_image);
}
void _pvrtc_register_compressors() {
-
_base_image_compress_pvrtc2_func = Image::_image_compress_pvrtc2_func;
_base_image_compress_pvrtc4_func = Image::_image_compress_pvrtc4_func;