From: Mikko Rasa Date: Tue, 2 Nov 2021 11:32:33 +0000 (+0200) Subject: Don't use resource manager for builtin data X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=147ec71f9fe3bd6b7ce25a7b74122f0282a99393;p=libs%2Fgl.git Don't use resource manager for builtin data Detecting them by the underscore at the beginning of the name feels a little dodgy, but it will do for now. --- diff --git a/source/resources/resources.cpp b/source/resources/resources.cpp index a0ee5e85..7cbdd2c5 100644 --- a/source/resources/resources.cpp +++ b/source/resources/resources.cpp @@ -166,7 +166,7 @@ T *Resources::create_generic(const string &name) Mesh *Resources::create_mesh(const string &name) { - if(!resource_manager) + if(!resource_manager || name[0]=='_') return 0; if(RefPtr io = open_raw(name)) @@ -182,9 +182,16 @@ Mesh *Resources::create_mesh(const string &name) Texture *Resources::create_texture(const string &name) { + bool managed = (resource_manager && name[0]!='_'); + string ext = FS::extpart(name); if(ext==".tex") - return create_generic>(name); + { + if(managed) + return create_generic>(name); + else + return create_generic(name); + } if(RefPtr io = open_raw(name)) { @@ -192,14 +199,16 @@ Texture *Resources::create_texture(const string &name) // Verify that the image is loadable Graphics::Image image; - if(!resource_manager) + if(!managed) image.load_io(*io); tex = new Texture2D; - tex->set_manager(resource_manager); - if(resource_manager) + if(managed) + { + tex->set_manager(resource_manager); resource_manager->set_resource_location(*tex, *this, name); + } else tex->image(image);