diff --git a/source/blender/draw/engines/eevee_next/eevee_lightprobe_volume.cc b/source/blender/draw/engines/eevee_next/eevee_lightprobe_volume.cc index 1997e210d74..4b14ea5220e 100644 --- a/source/blender/draw/engines/eevee_next/eevee_lightprobe_volume.cc +++ b/source/blender/draw/engines/eevee_next/eevee_lightprobe_volume.cc @@ -932,8 +932,8 @@ void IrradianceBake::surfels_create(const Object &probe_object) capture_info_buf_.do_surfel_count = false; capture_info_buf_.do_surfel_output = false; - int neg_flt_max = int(0xFF7FFFFFu ^ 0x7FFFFFFFu); /* floatBitsToOrderedInt(-FLT_MAX) */ - int pos_flt_max = 0x7F7FFFFF; /* floatBitsToOrderedInt(FLT_MAX) */ + const int neg_flt_max = int(0xFF7FFFFFu ^ 0x7FFFFFFFu); /* floatBitsToOrderedInt(-FLT_MAX) */ + const int pos_flt_max = 0x7F7FFFFF; /* floatBitsToOrderedInt(FLT_MAX) */ capture_info_buf_.scene_bound_x_min = pos_flt_max; capture_info_buf_.scene_bound_y_min = pos_flt_max; capture_info_buf_.scene_bound_z_min = pos_flt_max; @@ -948,6 +948,12 @@ void IrradianceBake::surfels_create(const Object &probe_object) GPU_memory_barrier(GPU_BARRIER_BUFFER_UPDATE); capture_info_buf_.read(); + if (capture_info_buf_.scene_bound_x_min == pos_flt_max) { + /* No valid object has been found. */ + do_break_ = true; + return; + } + auto ordered_int_bits_to_float = [](int32_t int_value) -> float { int32_t float_bits = (int_value < 0) ? (int_value ^ 0x7FFFFFFF) : int_value; return *reinterpret_cast(&float_bits); diff --git a/source/blender/editors/asset/intern/asset_shelf_popover.cc b/source/blender/editors/asset/intern/asset_shelf_popover.cc index e57fdd5c9c2..934f80c0d61 100644 --- a/source/blender/editors/asset/intern/asset_shelf_popover.cc +++ b/source/blender/editors/asset/intern/asset_shelf_popover.cc @@ -71,6 +71,8 @@ static AssetShelf *get_shelf_for_popup(const bContext &C, AssetShelfType &shelf_ if (type_poll_for_popup(C, &shelf_type)) { AssetShelf *new_shelf = create_shelf_from_type(shelf_type); new_shelf->settings.display_flag |= ASSETSHELF_SHOW_NAMES; + /* Increased size of previews, to leave more space for the name. */ + new_shelf->settings.preview_size = ASSET_SHELF_PREVIEW_SIZE_DEFAULT; popup_shelves.append(new_shelf); return new_shelf; } @@ -180,18 +182,29 @@ static AssetShelfType *lookup_type_from_idname_in_context(const bContext *C) } constexpr int LEFT_COL_WIDTH_UNITS = 10; -constexpr int RIGHT_COL_WIDTH_UNITS = 30; -constexpr int LAYOUT_WIDTH_UNITS = LEFT_COL_WIDTH_UNITS + RIGHT_COL_WIDTH_UNITS; +constexpr int RIGHT_COL_WIDTH_UNITS_DEFAULT = 50; + +/** + * Ensure the popover width fits into the window: Clamp width by the window width, minus some + * padding. + */ +static int layout_width_units_clamped(const wmWindow *win) +{ + const int max_units_x = (win->sizex / UI_UNIT_X) - 2; + return std::min(LEFT_COL_WIDTH_UNITS + RIGHT_COL_WIDTH_UNITS_DEFAULT, max_units_x); +} static void popover_panel_draw(const bContext *C, Panel *panel) { + const wmWindow *win = CTX_wm_window(C); + const int layout_width_units = layout_width_units_clamped(win); AssetShelfType *shelf_type = lookup_type_from_idname_in_context(C); BLI_assert_msg(shelf_type != nullptr, "couldn't find asset shelf type from context"); const ARegion *region = CTX_wm_region_popup(C) ? CTX_wm_region_popup(C) : CTX_wm_region(C); uiLayout *layout = panel->layout; - uiLayoutSetUnitsX(layout, LAYOUT_WIDTH_UNITS); + uiLayoutSetUnitsX(layout, layout_width_units); AssetShelf *shelf = get_shelf_for_popup(*C, *shelf_type); if (!shelf) { @@ -224,7 +237,8 @@ static void popover_panel_draw(const bContext *C, Panel *panel) ICON_VIEWZOOM); uiLayout *asset_view_col = uiLayoutColumn(right_col, false); - uiLayoutSetUnitsX(asset_view_col, RIGHT_COL_WIDTH_UNITS); + BLI_assert((layout_width_units - LEFT_COL_WIDTH_UNITS) > 0); + uiLayoutSetUnitsX(asset_view_col, layout_width_units - LEFT_COL_WIDTH_UNITS); uiLayoutSetFixedSize(asset_view_col, true); build_asset_view(*asset_view_col, shelf->settings.asset_library_reference, *shelf, *C, *region);