63 popup_block_close(
C, win, block);
68 if (!(label && label[0])) {
75 block,
ui::ButtonType::Label, label, 0,
y,
x,
UI_UNIT_Y,
nullptr, 0, 0, std::nullopt);
81 button_color_set(but,
color);
96 const int size = roundness * 20;
98 if (size < ibuf->
x && size < ibuf->
y) {
100 rct += 4 * (ibuf->
y - size) * ibuf->
x;
102 for (
int y = 0;
y < size;
y++) {
103 for (
int x = 0;
x < size;
x++, rct += 4) {
104 const float pixel = 1.0 / size;
105 const float u = pixel *
x;
106 const float v = pixel *
y;
111 const int offset_l = 4 * (size -
x -
x - 1) + 3;
112 const int offset_r = 4 * (ibuf->
x - size) + 3;
121 const float fac = (1.0 -
distance) * size;
128 rct[offset_l] = alpha;
129 rct[offset_r] = alpha;
134 rct += 4 * (ibuf->
x - size);
144 if (logo ==
nullptr) {
152 const int x = ibuf->
x * 0.025f;
153 const int y = ibuf->
y - int(ibuf->
x * 0.02f) - logo->
y;
182 if (
project ==
nullptr ||
project->get_splash_image_path().is_empty()) {
193 if (filepath.
is_empty() || width <= 0) {
198 if (ibuf ==
nullptr) {
207 if (ibuf->
byte_data() ==
nullptr || ibuf->
x <= 0 || ibuf->
y <= 0) {
217 const int2 size(ibuf->
x, ibuf->
y);
218 const int2 crop_size(std::min(size.x, size.y * 2), std::max(std::min(size.y, size.x / 2), 1));
219 if (crop_size != size) {
220 IMB_crop(ibuf, (size - crop_size) / 2, crop_size);
224 const int height = std::max(width / 2, 1);
225 if (width != ibuf->
x || height != ibuf->
y) {
242 ImBuf *ibuf =
nullptr;
247 if (ibuf ==
nullptr &&
U.app_template[0] !=
'\0') {
251 U.app_template, template_directory,
sizeof(template_directory)))
253 BLI_path_join(splash_filepath,
sizeof(splash_filepath), template_directory,
"splash.png");
258 if (ibuf ==
nullptr) {
259 const char *custom_splash_path =
BLI_getenv(
"BLENDER_CUSTOM_SPLASH");
260 if (custom_splash_path) {
265 if (ibuf ==
nullptr) {
274 height = (width * ibuf->
y) / ibuf->
x;
275 if (width != ibuf->
x || height != ibuf->
y) {
295 ImBuf *ibuf =
nullptr;
297 int width = max_width;
300 const char *custom_splash_path =
BLI_getenv(
"BLENDER_CUSTOM_SPLASH_BANNER");
301 if (custom_splash_path) {
313 if (width > 0 && height > 0 && (width > max_width || height > max_height)) {
314 const float splash_ratio = max_width /
float(max_height);
315 const float banner_ratio = ibuf->
x /
float(ibuf->
y);
317 if (banner_ratio > splash_ratio) {
320 height = max_width / banner_ratio;
322 else if (banner_ratio < splash_ratio) {
325 width = max_height * banner_ratio;
331 if (width != ibuf->
x || height != ibuf->
y) {
357 bool has_fileselect =
false;
360 has_fileselect =
true;
365 if (has_fileselect) {
370#if defined(__APPLE__)
375# include <sys/sysctl.h>
377static int is_using_macos_rosetta()
382 if (sysctlbyname(
"sysctl.proc_translated", &
ret, &
size,
nullptr, 0) != -1) {
386 if (errno == ENOENT) {
413 if (ibuf) [[likely]] {
415 block, ibuf, 0, 0.5f *
U.widget_unit, splash_width, splash_height,
nullptr);
428 int banner_width = 0;
429 int banner_height = 0;
431 &banner_width, &banner_height, splash_width, splash_height);
434 block, bannerbuf, 0, 0.5f *
U.widget_unit, banner_width, banner_height,
nullptr);
449 const int project_margin =
UI_UNIT_X / 2;
454 splash_width - project_width - project_margin,
455 0.5f *
U.widget_unit + project_margin +
461 project_layout.
menu(
"WM_MT_splash_project",
472 splash_width - (layout_margin_x * 2),
498#if defined(__APPLE__) || defined(_M_X64)
499# if defined(__APPLE__)
500 if (is_using_macos_rosetta() > 0)
501# elif defined(_M_X64)
502 const char *proc_id =
BLI_getenv(
"PROCESSOR_IDENTIFIER");
503 if (proc_id && strncmp(proc_id,
"ARM", 3) == 0)
512 row1.
label(
RPT_(
"Intel binary detected. Expect reduced performance."),
513 ICON_STATUS_WARNING_FILLED);
520# if defined(__APPLE__)
524 "https://docs.blender.org/manual/en/latest/getting_started/installing/macos.html");
525# elif defined(_M_X64)
529 "https://docs.blender.org/manual/en/latest/getting_started/installing/windows.html");
536 block_bounds_set_centered(block, 0);
552 ot->
name =
"Splash Screen";
553 ot->
idname =
"WM_OT_splash";
554 ot->
description =
"Open the splash screen with release info";
588 constexpr bool show_color =
false;
589 const float size = 0.2f * dialog_width;
602 uiDefButImage(block, ibuf, 0,
U.widget_unit, ibuf->
x, ibuf->
y, show_color ?
nullptr :
color);
611 uiItemL_ex(&col,
IFACE_(
"Blender"), ICON_NONE,
true,
false);
634 ot->
name =
"About Blender";
635 ot->
idname =
"WM_OT_splash_about";
636 ot->
description =
"Open a window with information about Blender";
#define BLI_path_join(...)
#define CTX_IFACE_(context, msgid)
#define BLT_I18NCONTEXT_OPERATOR_DEFAULT
int datatoc_splash_png_size
const char datatoc_splash_png[]
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
constexpr const char * c_str() const
constexpr bool is_empty() const
float distance(float, float) RET
void split(const std::string &s, const char delim, std::vector< std::string > &tokens)
const bTheme * theme_get()
@ BLOCK_THEME_STYLE_POPUP
const uiStyle * style_get_dpi()
void popup_block_invoke(bContext *C, BlockCreateFunc func, void *arg, FreeArgFunc arg_free, StructRNA *srna_owner=nullptr)
void menutype_draw(bContext *C, MenuType *mt, Layout *layout)
Layout & block_layout(Block *block, LayoutDirection direction, LayoutType type, int x, int y, int size, int em, int padding, const uiStyle *style)
ImBuf * svg_icon_bitmap(uint icon_id, float size, bool multicolor=false)
static void wm_project_splash_logo_add(ImBuf *ibuf)
static void wm_block_splash_close_on_fileselect(bContext *C, void *arg1, void *)
MINLINE unsigned char unit_float_to_uchar_clamp(float val)
std::string BKE_blender_project_path_resolve(StringRef path, const bke::BlenderProject &project)
static ui::Block * wm_block_about_create(bContext *C, ARegion *region, void *)
Vector< RecentProject > BKE_blender_project_recent_get()
void IMB_unpremultiply_alpha(ImBuf *ibuf)
void WM_OT_splash_about(wmOperatorType *ot)
std::string WM_project_splash_image_filepath(const Main *bmain)
void RNA_string_set(PointerRNA *ptr, const char *name, const char *value)
static void wm_block_splash_close(bContext *C, ui::Block *block)
MenuType * WM_menutype_find(const StringRef idname, bool quiet)
static ui::Block * wm_block_splash_create(bContext *C, ARegion *region, void *)
wmWindow * CTX_wm_window(const bContext *C)
ATTR_WARN_UNUSED_RESULT const BMVert * v
int WM_window_native_pixel_x(const wmWindow *win)
auto BKE_blender_project_read_callback(const Main *bmain, Fn lambda)
static wmOperatorStatus wm_splash_invoke(bContext *C, wmOperator *, const wmEvent *)
void IMB_crop(ImBuf *ibuf, const int2 &rect_pos, const int2 &rect_size)
static void wm_block_splash_image_roundcorners_add(ImBuf *ibuf)
static ImBuf * wm_block_splash_image(const Main *bmain, int width, int *r_height)
ImBuf * IMB_load_image_from_filepath(const char *filepath, ImBufFlags flags, ColorManagedColorspaceSettings *colorspace_settings=nullptr)
void IMB_rectblend(ImBuf *dbuf, uint8_t *dbuf_byte_data, float *dbuf_float_data, const ImBuf *obuf, const ImBuf *sbuf, unsigned short *dmask, const unsigned short *curvemask, const unsigned short *texmask, float mask_max, int destx, int desty, int origx, int origy, int srcx, int srcy, int width, int height, IMB_BlendMode mode, bool accumulate)
void IMB_freeImBuf(ImBuf *ibuf)
VecBase< int32_t, 2 > int2
static wmOperatorStatus wm_splash_about_invoke(bContext *C, wmOperator *, const wmEvent *)
bool BKE_appdir_app_template_id_search(const char *app_template, char *path, size_t path_maxncpy) ATTR_NONNULL(1)
ImBuf * WM_project_splash_image_load(const StringRefNull filepath, const int width, const bool add_logo)
static void wm_block_splash_add_label(ui::Block *block, const char *label, int x, int y)
ImBuf * IMB_load_image_from_memory(const unsigned char *mem, size_t size, ImBufFlags flags, const char *descr, const char *filepath=nullptr, ColorManagedColorspaceSettings *colorspace_settings=nullptr)
bool WM_operator_winactive(bContext *C)
Main * CTX_data_main(const bContext *C)
void IMB_byte_from_float(ImBuf *ibuf)
static ImBuf * wm_block_splash_banner_image(int *r_width, int *r_height, int max_width, int max_height)
bool IMB_scale(ImBuf *ibuf, int2 new_size, IMBScaleFilter filter, bool threaded=true)
void WM_OT_splash(wmOperatorType *ot)
void IMB_free_float_pixels(ImBuf *ibuf)
const char * BKE_blender_version_string()
const char * BLI_getenv(const char *env) ATTR_NONNULL(1) ATTR_WARN_UNUSED_RESULT
void IMB_premultiply_alpha(ImBuf *ibuf)
KERNEL_FEATURE_LIGHT_PASSES KERNEL_FEATURE_PATH_GUIDING float
uiWidgetColors wcol_menu_back
const uint8_t * byte_data() const
uint8_t * byte_data_for_write()
ListBaseT< wmEvent > event_queue
void alignment_set(LayoutAlign alignment)
void label(StringRef name, int icon)
PointerRNA op(wmOperatorType *ot, std::optional< StringRef > name, int icon, wm::OpCallContext context, eUI_Item_Flag flag)
void menu(MenuType *mt, std::optional< StringRef > name, int icon)
Layout & split(float percentage, bool align)
Layout & column(bool align)
void separator(float factor=1.0f, LayoutSeparatorType type=LayoutSeparatorType::Auto)
bool(*) poll(bContext *C) ATTR_WARN_UNUSED_RESULT
wmOperatorStatus(*) invoke(bContext *C, wmOperator *op, const wmEvent *event) ATTR_WARN_UNUSED_RESULT
bke::WindowRuntime * runtime