diff options
author | Juan Linietsky <reduzio@gmail.com> | 2014-02-26 10:08:17 -0300 |
---|---|---|
committer | Juan Linietsky <reduzio@gmail.com> | 2014-02-26 10:08:17 -0300 |
commit | ed6d9463d264d0983f75c2dc93191c8526e9115b (patch) | |
tree | 3518ba92d9e4fa5b5d36e7272faa3faa01f908c7 /core/bind/core_bind.cpp | |
parent | b2ce682f6ed9493423be257a5b2e87126692a94f (diff) |
-Added ATITC texture support
-Fixed bug of some tabs showing wrong names
-Exported properties for viewport
Diffstat (limited to 'core/bind/core_bind.cpp')
-rw-r--r-- | core/bind/core_bind.cpp | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/core/bind/core_bind.cpp b/core/bind/core_bind.cpp index 61209ecb90..73f6f753b9 100644 --- a/core/bind/core_bind.cpp +++ b/core/bind/core_bind.cpp @@ -413,6 +413,56 @@ void _OS::dump_memory_to_file(const String& p_file) { OS::get_singleton()->dump_memory_to_file(p_file.utf8().get_data()); } +struct _OSCoreBindImg { + + String path; + Size2 size; + int fmt; + ObjectID id; + int vram; + bool operator<(const _OSCoreBindImg& p_img) const { return vram==p_img.vram ? id<p_img.id : vram > p_img.vram; } +}; + +void _OS::print_all_textures_by_size() { + + + List<_OSCoreBindImg> imgs; + int total=0; + { + List<Ref<Resource> > rsrc; + ResourceCache::get_cached_resources(&rsrc); + + for (List<Ref<Resource> >::Element *E=rsrc.front();E;E=E->next()) { + + if (!E->get()->is_type("ImageTexture")) + continue; + + Size2 size = E->get()->call("get_size"); + int fmt = E->get()->call("get_format"); + + _OSCoreBindImg img; + img.size=size; + img.fmt=fmt; + img.path=E->get()->get_path(); + img.vram=Image::get_image_data_size(img.size.width,img.size.height,Image::Format(img.fmt)); + img.id=E->get()->get_instance_ID(); + total+=img.vram; + imgs.push_back(img); + } + } + + imgs.sort(); + + for(List<_OSCoreBindImg>::Element *E=imgs.front();E;E=E->next()) { + + print_line(E->get().path+" - "+String::humanize_size(E->get().vram)+" ("+E->get().size+") - total:"+String::humanize_size(total) ); + total-=E->get().vram; + } + + + +} + void _OS::print_all_resources(const String& p_to_file ) { OS::get_singleton()->print_all_resources(p_to_file); @@ -516,6 +566,8 @@ void _OS::_bind_methods() { ObjectTypeDB::bind_method(_MD("get_frames_per_second"),&_OS::get_frames_per_second); + ObjectTypeDB::bind_method(_MD("print_all_textures_by_size"),&_OS::print_all_textures_by_size); + BIND_CONSTANT( DAY_SUNDAY ); BIND_CONSTANT( DAY_MONDAY ); BIND_CONSTANT( DAY_TUESDAY ); |