Commit: f195a3a30dfe27a5927b0dfa9843c571ae1f1cce
Author: Julian Eisel
Date:   Wed Oct 27 00:02:29 2021 +0200
Branches: master
https://developer.blender.org/rBf195a3a30dfe27a5927b0dfa9843c571ae1f1cce

Asset Browser: Reduce paddings & margins between previews

The paddings and margins were more than needed, this reduces them a bit. That
way space is used more efficiently, the small differences add up so that more
items fit into a row.
The File Browser should not be affected.

Before/after comparisons:
{F11529986} {F11529988}
{F11529987} {F11529989}

===================================================================

M       source/blender/editors/space_file/filesel.c

===================================================================

diff --git a/source/blender/editors/space_file/filesel.c 
b/source/blender/editors/space_file/filesel.c
index 4cd05237138..5299b8ba580 100644
--- a/source/blender/editors/space_file/filesel.c
+++ b/source/blender/editors/space_file/filesel.c
@@ -979,6 +979,8 @@ static void file_attribute_columns_init(const 
FileSelectParams *params, FileLayo
 void ED_fileselect_init_layout(struct SpaceFile *sfile, ARegion *region)
 {
   FileSelectParams *params = ED_fileselect_get_active_params(sfile);
+  /* Request a slightly more compact layout for asset browsing. */
+  const bool compact = ED_fileselect_is_asset_browser(sfile);
   FileLayout *layout = NULL;
   View2D *v2d = &region->v2d;
   int numfiles;
@@ -998,12 +1000,13 @@ void ED_fileselect_init_layout(struct SpaceFile *sfile, 
ARegion *region)
   layout->textheight = textheight;
 
   if (params->display == FILE_IMGDISPLAY) {
+    const float pad_fac = compact ? 0.15f : 0.3f;
     layout->prv_w = ((float)params->thumbnail_size / 20.0f) * UI_UNIT_X;
     layout->prv_h = ((float)params->thumbnail_size / 20.0f) * UI_UNIT_Y;
-    layout->tile_border_x = 0.3f * UI_UNIT_X;
-    layout->tile_border_y = 0.3f * UI_UNIT_X;
-    layout->prv_border_x = 0.3f * UI_UNIT_X;
-    layout->prv_border_y = 0.3f * UI_UNIT_Y;
+    layout->tile_border_x = pad_fac * UI_UNIT_X;
+    layout->tile_border_y = pad_fac * UI_UNIT_X;
+    layout->prv_border_x = pad_fac * UI_UNIT_X;
+    layout->prv_border_y = pad_fac * UI_UNIT_Y;
     layout->tile_w = layout->prv_w + 2 * layout->prv_border_x;
     layout->tile_h = layout->prv_h + 2 * layout->prv_border_y + textheight;
     layout->width = (int)(BLI_rctf_size_x(&v2d->cur) - 2 * 
layout->tile_border_x);

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to