summaryrefslogtreecommitdiff
path: root/scene/io
diff options
context:
space:
mode:
Diffstat (limited to 'scene/io')
-rw-r--r--scene/io/resource_format_image.cpp47
1 files changed, 44 insertions, 3 deletions
diff --git a/scene/io/resource_format_image.cpp b/scene/io/resource_format_image.cpp
index b0fcf9717b..16c2ec9706 100644
--- a/scene/io/resource_format_image.cpp
+++ b/scene/io/resource_format_image.cpp
@@ -131,14 +131,55 @@ RES ResourceFormatLoaderImage::load(const String &p_path,const String& p_origina
uint32_t flags=0;
- if (bool(GLOBAL_DEF("image_loader/filter",true)))
+
+ FileAccess *f2 = FileAccess::open(p_path+".flags",FileAccess::READ);
+ Map<String,bool> flags_found;
+ if (f2) {
+
+ while(!f2->eof_reached()) {
+ String l2 = f2->get_line();
+ int eqpos = l2.find("=");
+ if (eqpos!=-1) {
+ String flag=l2.substr(0,eqpos).strip_edges();
+ String val=l2.substr(eqpos+1,l2.length()).strip_edges().to_lower();
+ flags_found[flag]=(val=="true" || val=="1")?true:false;
+ }
+ }
+ memdelete(f2);
+ }
+
+
+ if (flags_found.has("filter")) {
+ if (flags_found["filter"])
+ flags|=Texture::FLAG_FILTER;
+ } else if (bool(GLOBAL_DEF("image_loader/filter",true))) {
flags|=Texture::FLAG_FILTER;
- if (bool(GLOBAL_DEF("image_loader/gen_mipmaps",true)))
+ }
+
+
+ if (flags_found.has("gen_mipmaps")) {
+ if (flags_found["gen_mipmaps"])
+ flags|=Texture::FLAG_MIPMAPS;
+ } else if (bool(GLOBAL_DEF("image_loader/gen_mipmaps",true))) {
flags|=Texture::FLAG_MIPMAPS;
- if (bool(GLOBAL_DEF("image_loader/repeat",false)))
+ }
+
+ if (flags_found.has("repeat")) {
+ if (flags_found["repeat"])
+ flags|=Texture::FLAG_REPEAT;
+ } else if (bool(GLOBAL_DEF("image_loader/repeat",true))) {
flags|=Texture::FLAG_REPEAT;
+ }
+ if (flags_found.has("anisotropic")) {
+ if (flags_found["anisotropic"])
+ flags|=Texture::FLAG_ANISOTROPIC_FILTER;
+ }
+ if (flags_found.has("tolinear")) {
+ if (flags_found["tolinear"])
+ flags|=Texture::FLAG_CONVERT_TO_LINEAR;
+ }
if (debug_load_times)
begtime=OS::get_singleton()->get_ticks_usec();