|
@@ -968,7 +968,7 @@ void _OS::print_all_textures_by_size() {
|
|
|
ResourceCache::get_cached_resources(&rsrc);
|
|
|
|
|
|
for (List<Ref<Resource>>::Element *E = rsrc.front(); E; E = E->next()) {
|
|
|
- if (!E->get()->is_class("ImageTexture")) {
|
|
|
+ if (!E->get()->is_class("Texture")) {
|
|
|
continue;
|
|
|
}
|
|
|
|
|
@@ -988,14 +988,30 @@ void _OS::print_all_textures_by_size() {
|
|
|
|
|
|
imgs.sort();
|
|
|
|
|
|
+ if (imgs.size() == 0) {
|
|
|
+ print_line("No textures seem used in this project.");
|
|
|
+ } else {
|
|
|
+ print_line("Textures currently in use, sorted by VRAM usage:\n"
|
|
|
+ "Path - VRAM usage (Dimensions)");
|
|
|
+ }
|
|
|
+
|
|
|
for (List<_OSCoreBindImg>::Element *E = imgs.front(); E; E = E->next()) {
|
|
|
- total -= E->get().vram;
|
|
|
+ print_line(vformat("%s - %s %s",
|
|
|
+ E->get().path,
|
|
|
+ String::humanize_size(E->get().vram),
|
|
|
+ E->get().size));
|
|
|
}
|
|
|
+
|
|
|
+ print_line(vformat("Total VRAM usage: %s.", String::humanize_size(total)));
|
|
|
}
|
|
|
|
|
|
void _OS::print_resources_by_type(const Vector<String> &p_types) {
|
|
|
- Map<String, int> type_count;
|
|
|
+ ERR_FAIL_COND_MSG(p_types.size() == 0,
|
|
|
+ "At least one type should be provided to print resources by type.");
|
|
|
+
|
|
|
+ print_line(vformat("Resources currently in use for the following types: %s", p_types));
|
|
|
|
|
|
+ Map<String, int> type_count;
|
|
|
List<Ref<Resource>> resources;
|
|
|
ResourceCache::get_cached_resources(&resources);
|
|
|
|
|
@@ -1018,8 +1034,20 @@ void _OS::print_resources_by_type(const Vector<String> &p_types) {
|
|
|
}
|
|
|
|
|
|
type_count[r->get_class()]++;
|
|
|
+
|
|
|
+ print_line(vformat("%s: %s", r->get_class(), r->get_path()));
|
|
|
+
|
|
|
+ List<String> metas;
|
|
|
+ r->get_meta_list(&metas);
|
|
|
+ for (List<String>::Element *F = metas.front(); F; F = F->next()) {
|
|
|
+ print_line(vformat(" %s: %s", F->get(), r->get_meta(F->get())));
|
|
|
+ }
|
|
|
}
|
|
|
-};
|
|
|
+
|
|
|
+ for (Map<String, int>::Element *E = type_count.front(); E; E = E->next()) {
|
|
|
+ print_line(vformat("%s count: %d", E->key(), E->get()));
|
|
|
+ }
|
|
|
+}
|
|
|
|
|
|
bool _OS::has_virtual_keyboard() const {
|
|
|
return OS::get_singleton()->has_virtual_keyboard();
|