diff options
author | Campbell Barton <ideasman42@gmail.com> | 2018-05-27 12:06:29 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2018-05-27 12:06:29 +0300 |
commit | 9a74b603670cc3fab14d9fcd7be7b3c17731a8ee (patch) | |
tree | 0611021c1450e586308d58223353793dcc137afe /source/blender/blenkernel/intern/pointcache.c | |
parent | 474971f3d84e5eacde7e92fc86ef4e10a5e0786c (diff) | |
parent | bc3727a94374d9c56745c943a1e6574627a88510 (diff) |
Merge branch 'master' into blender2.8
Diffstat (limited to 'source/blender/blenkernel/intern/pointcache.c')
-rw-r--r-- | source/blender/blenkernel/intern/pointcache.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/source/blender/blenkernel/intern/pointcache.c b/source/blender/blenkernel/intern/pointcache.c index 7fd7b791a3f..a99057ac0ad 100644 --- a/source/blender/blenkernel/intern/pointcache.c +++ b/source/blender/blenkernel/intern/pointcache.c @@ -50,6 +50,7 @@ #include "BLI_blenlib.h" #include "BLI_threads.h" #include "BLI_math.h" +#include "BLI_string.h" #include "BLI_utildefines.h" #include "BLT_translation.h" @@ -4071,9 +4072,11 @@ void BKE_ptcache_update_info(PTCacheID *pid) } else { PTCacheMem *pm = cache->mem_cache.first; - float bytes = 0.0f; - int i, mb; - + char formatted_tot[16]; + char formatted_mem[15]; + long long int bytes = 0.0f; + int i; + for (; pm; pm=pm->next) { for (i=0; i<BPHYS_TOT_DATA; i++) bytes += MEM_allocN_len(pm->data[i]); @@ -4088,12 +4091,10 @@ void BKE_ptcache_update_info(PTCacheID *pid) totframes++; } - mb = (bytes > 1024.0f * 1024.0f); + BLI_str_format_int_grouped(formatted_tot, totframes); + BLI_str_format_byte_unit(formatted_mem, bytes, true); - BLI_snprintf(mem_info, sizeof(mem_info), IFACE_("%i frames in memory (%.1f %s)"), - totframes, - bytes / (mb ? 1024.0f * 1024.0f : 1024.0f), - mb ? IFACE_("Mb") : IFACE_("kb")); + BLI_snprintf(mem_info, sizeof(mem_info), IFACE_("%s frames in memory (%s)"), formatted_tot, formatted_mem); } if (cache->flag & PTCACHE_OUTDATED) { |