Page MenuHome

Add number and memory size formatting throughout the UI
ClosedPublic

Authored by Diego Gangl (januz) on Apr 19 2015, 1:47 AM.

Details

Summary

This patch adds number formatting (thousands separator) to the baking panel. It also adds a new funciton to format memory sizes (KB/GB/etc) and applies it to the baking panel and scene stats.

Diff Detail

Repository
rB Blender
Branch
thousands

Event Timeline

Diego Gangl (januz) retitled this revision from to Add number formatting to face count in the decimate modifier and to the number of cached frames in particles/physics..
Sergey Sharybin (sergey) requested changes to this revision.Apr 22 2015, 3:27 PM

First part of the patch seems nice, but there's some feedback about memory usage.

source/blender/blenkernel/intern/pointcache.c
3735

It makes more sense to have an utility function which will give you human readable size in megabytes, gigabytes, terabytes and so on. So you don't have ridiculous reports about "100,000,000 Mb" which is not really informative.

This revision now requires changes to proceed.Apr 22 2015, 3:27 PM
Campbell Barton (campbellbarton) requested changes to this revision.Apr 22 2015, 3:27 PM
Campbell Barton (campbellbarton) edited edge metadata.
Campbell Barton (campbellbarton) added inline comments.
release/scripts/startup/bl_ui/properties_data_modifier.py
282

Why is this changed?, currently Blender scripts use C-style formatting everywhere.

source/blender/blenkernel/intern/pointcache.c
3735

In this particular case I'd rather have a utiliy function to display filesize. Most likely it can be reused elsewhere too. (then it can do GiB etc too).

release/scripts/startup/bl_ui/properties_data_modifier.py
282

Left this reply in by accident, C style formatting doesnt do this.

source/blender/blenkernel/intern/pointcache.c
3735

Note that this change is for frame count only, not the mem. I agree that it'd be nice to have a function to display filesize properly.

Diego Gangl (januz) updated this revision to Diff 5336.EditedOct 30 2015, 4:15 PM
Diego Gangl (januz) edited edge metadata.

Rebased

I didn't include the MB/GB code since this patch doesn't affect any ram number. I think that should go in another patch.

Diego Gangl (januz) updated this revision to Diff 8776.EditedMay 7 2017, 12:54 AM
Diego Gangl (januz) edited edge metadata.
Diego Gangl (januz) retitled this revision from Add number formatting to face count in the decimate modifier and to the number of cached frames in particles/physics. to Add number formatting to face count in the decimate modifier and to the number of cached frames in particles/physics..
  • Add a function to format a size in bytes
  • Add unit tests for BLI_str_format_bytes
  • Format memory stats in the physics panel
  • Format memory info in scene stats

I've added the memory formatting idea to this patch. Let me know if you guys want to split it.

Tested this with scenes and bakes from KBs to GBs. The only thing I didn't test was the mmap and gpu mem things in info_stats.c because I can't figure out how :)

Diego Gangl (januz) retitled this revision from Add number formatting to face count in the decimate modifier and to the number of cached frames in particles/physics. to Add number and memory size formatting throughout the UI.May 7 2017, 12:57 AM
Diego Gangl (januz) edited the summary of this revision. (Show Details)
Rebase. Also friendly ping before this patch rots too much (considering the topbar changes coming in 2.8)
Diego Gangl (januz) marked 5 inline comments as done.Jan 31 2018, 3:28 PM

Stumbled over this today and made some changes (updating patch in a minute). Should be ready to go now.

Julian Eisel (Severin) updated this revision to Diff 11126.EditedMay 25 2018, 10:11 PM

Improvements to BLI_str_format_bytes:

  • Rename to BLI_str_format_byte_unit
  • Use long long int as argument, not double. Floating point byte-count doesn't make much sense, it's only needed for internal purposes.
  • Strip trailing zeroes.
  • Support passing negative values - not sure if that's useful even, but simple to support.
  • Improve test coverage, esp. for corner-cases.
  • General cleanup (codestyle, naming, comments, etc.)
This revision was not accepted when it landed; it landed in state Needs Review.May 25 2018, 10:42 PM
This revision was automatically updated to reflect the committed changes.

Hey, awesome! Thanks for pushing this.