diff options
Diffstat (limited to 'core/bind')
-rw-r--r-- | core/bind/core_bind.cpp | 51 | ||||
-rw-r--r-- | core/bind/core_bind.h | 3 |
2 files changed, 50 insertions, 4 deletions
diff --git a/core/bind/core_bind.cpp b/core/bind/core_bind.cpp index fd6a91d125..ec159da00f 100644 --- a/core/bind/core_bind.cpp +++ b/core/bind/core_bind.cpp @@ -479,10 +479,54 @@ void _OS::print_all_textures_by_size() { 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_resources_by_type(const Vector<String>& p_types) { + Map<String,int> type_count; + + List<Ref<Resource> > resources; + ResourceCache::get_cached_resources(&resources); + + List<Ref<Resource> > rsrc; + ResourceCache::get_cached_resources(&rsrc); + + for (List<Ref<Resource> >::Element *E=rsrc.front();E;E=E->next()) { + + Ref<Resource> r = E->get(); + + bool found = false; + + for (int i=0; i<p_types.size(); i++) { + if (r->is_type(p_types[i])) + found = true; + } + if (!found) + continue; + + if (!type_count.has(r->get_type())) { + type_count[r->get_type()]=0; + } + + + type_count[r->get_type()]++; + + print_line(r->get_type()+": "+r->get_path()); + + List<String> metas; + r->get_meta_list(&metas); + for (List<String>::Element* me = metas.front(); me; me = me->next()) { + print_line(" "+String(me->get()) + ": " + r->get_meta(me->get())); + }; + } + + for(Map<String,int>::Element *E=type_count.front();E;E=E->next()) { + + print_line(E->key()+" count: "+itos(E->get())); + } + +}; -} void _OS::print_all_resources(const String& p_to_file ) { @@ -509,9 +553,9 @@ float _OS::get_frames_per_second() const { return OS::get_singleton()->get_frames_per_second(); } -Error _OS::native_video_play(String p_path) { +Error _OS::native_video_play(String p_path, float p_volume) { - return OS::get_singleton()->native_video_play(p_path); + return OS::get_singleton()->native_video_play(p_path, p_volume); }; bool _OS::native_video_is_playing() { @@ -614,6 +658,7 @@ 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); + ObjectTypeDB::bind_method(_MD("print_resources_by_type"),&_OS::print_resources_by_type); ObjectTypeDB::bind_method(_MD("native_video_play"),&_OS::native_video_play); ObjectTypeDB::bind_method(_MD("native_video_is_playing"),&_OS::native_video_is_playing); diff --git a/core/bind/core_bind.h b/core/bind/core_bind.h index f5c94dcf06..18eb594760 100644 --- a/core/bind/core_bind.h +++ b/core/bind/core_bind.h @@ -98,7 +98,7 @@ public: bool is_video_mode_resizable(int p_screen=0) const; Array get_fullscreen_mode_list(int p_screen=0) const; - Error native_video_play(String p_path); + Error native_video_play(String p_path, float p_volume); bool native_video_is_playing(); void native_video_pause(); void native_video_stop(); @@ -139,6 +139,7 @@ public: void print_resources_in_use(bool p_short=false); void print_all_resources(const String& p_to_file); void print_all_textures_by_size(); + void print_resources_by_type(const Vector<String>& p_types); bool has_touchscreen_ui_hint() const; |