diff options
author | Anton Yabchinskiy <arn@bestmx.ru> | 2015-07-29 23:01:36 +0300 |
---|---|---|
committer | Anton Yabchinskiy <arn@bestmx.ru> | 2015-07-29 23:01:36 +0300 |
commit | dc8df8a91a995796f0f330bf6bb6b209f6dfce08 (patch) | |
tree | 46cfe09124703b07860754d6b44e0289422e0573 /tools/editor/pvrtc_compress.cpp | |
parent | 16746f157f83d666079ba3266acec13d35b84c3f (diff) | |
parent | 922356b903061cda7591090bf19e8346c3a78cf5 (diff) |
Merge branch 'master' of github.com:okamstudio/godot
Diffstat (limited to 'tools/editor/pvrtc_compress.cpp')
-rw-r--r-- | tools/editor/pvrtc_compress.cpp | 30 |
1 files changed, 28 insertions, 2 deletions
diff --git a/tools/editor/pvrtc_compress.cpp b/tools/editor/pvrtc_compress.cpp index 9511d6a26d..a2f98adbe0 100644 --- a/tools/editor/pvrtc_compress.cpp +++ b/tools/editor/pvrtc_compress.cpp @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -32,11 +32,34 @@ #include "io/resource_saver.h" #include "io/resource_loader.h" #include "os/os.h" - +#include "os/file_access.h" +static void (*_base_image_compress_pvrtc2_func)(Image *)=NULL; +static void (*_base_image_compress_pvrtc4_func)(Image *)=NULL; static void _compress_image(Image::CompressMode p_mode,Image *p_image) { String ttpath = EditorSettings::get_singleton()->get("PVRTC/texture_tool"); + + if (ttpath.strip_edges()=="" || !FileAccess::exists(ttpath)) { + switch(p_mode) { + + case Image::COMPRESS_PVRTC2: + if (_base_image_compress_pvrtc2_func) + _base_image_compress_pvrtc2_func(p_image); + 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) + _base_image_compress_pvrtc4_func(p_image); + + break; + default: ERR_FAIL(); + + } + return; + } String spath = EditorSettings::get_singleton()->get_settings_path(); @@ -100,6 +123,9 @@ static void _compress_etc(Image *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; + Image::_image_compress_pvrtc2_func=_compress_pvrtc2; Image::_image_compress_pvrtc4_func=_compress_pvrtc4; //Image::_image_compress_etc_func=_compress_etc; //use the built in one for ETC |