63 if (!(label && label[0])) {
70 block,
UI_BTYPE_LABEL, 0, label, 0,
y,
x,
UI_UNIT_Y,
nullptr, 0, 0, std::nullopt);
75 uchar color[4] = {255, 255, 255, 255};
91 const int size = roundness * 20;
95 rct += 4 * (ibuf->
y -
size) * ibuf->
x;
97 for (
int y = 0;
y <
size;
y++) {
98 for (
int x = 0;
x <
size;
x++, rct += 4) {
99 const float pixel = 1.0 /
size;
100 const float u = pixel *
x;
101 const float v = pixel *
y;
106 const int offset_l = 4 * (
size -
x -
x - 1) + 3;
107 const int offset_r = 4 * (ibuf->
x -
size) + 3;
123 rct[offset_l] = alpha;
124 rct[offset_r] = alpha;
129 rct += 4 * (ibuf->
x -
size);
137 ImBuf *ibuf =
nullptr;
140 if (
U.app_template[0] !=
'\0') {
144 U.app_template, template_directory,
sizeof(template_directory)))
146 BLI_path_join(splash_filepath,
sizeof(splash_filepath), template_directory,
"splash.png");
151 if (ibuf ==
nullptr) {
152 const char *custom_splash_path =
BLI_getenv(
"BLENDER_CUSTOM_SPLASH");
153 if (custom_splash_path) {
158 if (ibuf ==
nullptr) {
162 splash_data, splash_data_size,
IB_byte_data,
"<splash screen>");
167 height = (width * ibuf->
y) / ibuf->
x;
168 if (width != ibuf->
x || height != ibuf->
y) {
188 ImBuf *ibuf =
nullptr;
190 int width = max_width;
193 const char *custom_splash_path =
BLI_getenv(
"BLENDER_CUSTOM_SPLASH_BANNER");
194 if (custom_splash_path) {
206 if (width > 0 && height > 0 && (width > max_width || height > max_height)) {
207 const float splash_ratio = max_width / float(max_height);
208 const float banner_ratio = ibuf->
x / float(ibuf->
y);
210 if (banner_ratio > splash_ratio) {
213 height = max_width / banner_ratio;
215 else if (banner_ratio < splash_ratio) {
218 width = max_height * banner_ratio;
224 if (width != ibuf->
x || height != ibuf->
y) {
250 bool has_fileselect =
false;
253 has_fileselect =
true;
258 if (has_fileselect) {
263#if defined(__APPLE__)
268# include <sys/sysctl.h>
270static int is_using_macos_rosetta()
275 if (sysctlbyname(
"sysctl.proc_translated", &
ret, &
size,
nullptr, 0) != -1) {
279 if (errno == ENOENT) {
308 block, ibuf, 0, 0.5f *
U.widget_unit, splash_width, splash_height,
nullptr);
321 int banner_width = 0;
322 int banner_height = 0;
324 &banner_width, &banner_height, splash_width, splash_height);
327 block, bannerbuf, 0, 0.5f *
U.widget_unit, banner_width, banner_height,
nullptr);
338 splash_width - (layout_margin_x * 2),
364#if defined(__APPLE__) || defined(_M_X64)
365# if defined(__APPLE__)
366 if (is_using_macos_rosetta() > 0)
367# elif defined(_M_X64)
368 const char *proc_id =
BLI_getenv(
"PROCESSOR_IDENTIFIER");
369 if (proc_id && strncmp(proc_id,
"ARM", 3) == 0)
378 row1->
label(
RPT_(
"Intel binary detected. Expect reduced performance."), ICON_ERROR);
385# if defined(__APPLE__)
389 "https://docs.blender.org/manual/en/latest/getting_started/installing/macos.html");
390# elif defined(_M_X64)
394 "https://docs.blender.org/manual/en/latest/getting_started/installing/windows.html");
417 ot->name =
"Splash Screen";
418 ot->idname =
"WM_OT_splash";
419 ot->description =
"Open the splash screen with release info";
446 constexpr bool show_color =
false;
447 const float size = 0.2f * dialog_width;
460 row = &layout->
row(
false);
462 uiDefButImage(block, ibuf, 0,
U.widget_unit, ibuf->
x, ibuf->
y, show_color ?
nullptr : color);
465 row = &layout->
row(
false);
495 ot->name =
"About Blender";
496 ot->idname =
"WM_OT_splash_about";
497 ot->description =
"Open a window with information about Blender";
bool BKE_appdir_app_template_id_search(const char *app_template, char *path, size_t path_maxncpy) ATTR_NONNULL(1)
const char * BKE_blender_version_string(void)
wmWindow * CTX_wm_window(const bContext *C)
#define LISTBASE_FOREACH(type, var, list)
#define BLI_path_join(...)
const char * BLI_getenv(const char *env) ATTR_NONNULL(1) ATTR_WARN_UNUSED_RESULT
#define CTX_IFACE_(context, msgid)
#define BLT_I18NCONTEXT_OPERATOR_DEFAULT
int datatoc_splash_png_size
const char datatoc_splash_png[]
static void split(const char *text, const char *seps, char ***str, int *count)
void IMB_premultiply_alpha(ImBuf *ibuf)
ImBuf * IMB_load_image_from_filepath(const char *filepath, const int flags, char r_colorspace[IM_MAX_SPACE]=nullptr)
ImBuf * IMB_load_image_from_memory(const unsigned char *mem, const size_t size, const int flags, const char *descr, const char *filepath=nullptr, char r_colorspace[IM_MAX_SPACE]=nullptr)
bool IMB_scale(ImBuf *ibuf, unsigned int newx, unsigned int newy, IMBScaleFilter filter, bool threaded=true)
void UI_but_func_set(uiBut *but, std::function< void(bContext &)> func)
void UI_block_emboss_set(uiBlock *block, blender::ui::EmbossType emboss)
void UI_block_theme_style_set(uiBlock *block, char theme_style)
uiBlock * UI_block_begin(const bContext *C, ARegion *region, std::string name, blender::ui::EmbossType emboss)
void UI_but_color_set(uiBut *but, const uchar color[4])
uiBut * uiDefBut(uiBlock *block, int type, int retval, blender::StringRef str, int x, int y, short width, short height, void *poin, float min, float max, std::optional< blender::StringRef > tip)
void UI_popup_block_invoke(bContext *C, uiBlockCreateFunc func, void *arg, uiFreeArgFunc arg_free)
const uiStyle * UI_style_get_dpi()
void UI_but_drawflag_enable(uiBut *but, int flag)
void UI_popup_block_close(bContext *C, wmWindow *win, uiBlock *block)
@ UI_BLOCK_THEME_STYLE_POPUP
void UI_block_func_set(uiBlock *block, uiButHandleFunc func, void *arg1, void *arg2)
void UI_but_drawflag_disable(uiBut *but, int flag)
uiBut * uiDefButImage(uiBlock *block, void *imbuf, int x, int y, short width, short height, const uchar color[4])
void UI_block_bounds_set_centered(uiBlock *block, int addval)
void UI_block_flag_enable(uiBlock *block, int flag)
ImBuf * UI_svg_icon_bitmap(uint icon_id, float size, bool multicolor=false)
uiLayout * UI_block_layout(uiBlock *block, int dir, int type, int x, int y, int size, int em, int padding, const uiStyle *style)
void uiLayoutSetAlignment(uiLayout *layout, char alignment)
void UI_menutype_draw(bContext *C, MenuType *mt, uiLayout *layout)
uiBut * uiItemL_ex(uiLayout *layout, blender::StringRef name, int icon, bool highlight, bool redalert)
ATTR_WARN_UNUSED_RESULT const BMVert * v
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
float distance(VecOp< float, D >, VecOp< float, D >) RET
MINLINE unsigned char unit_float_to_uchar_clamp(float val)
void RNA_string_set(PointerRNA *ptr, const char *name, const char *value)
ImBufByteBuffer byte_buffer
uiWidgetColors wcol_menu_back
PointerRNA op(wmOperatorType *ot, std::optional< blender::StringRef > name, int icon, wmOperatorCallContext context, eUI_Item_Flag flag)
void label(blender::StringRef name, int icon)
uiLayout & column(bool align)
void separator(float factor=1.0f, LayoutSeparatorType type=LayoutSeparatorType::Auto)
uiLayout & row(bool align)
uiLayout & split(float percentage, bool align)
WindowRuntimeHandle * runtime
bool WM_operator_winactive(bContext *C)
void WM_OT_splash_about(wmOperatorType *ot)
static ImBuf * wm_block_splash_image(int width, int *r_height)
static void wm_block_splash_add_label(uiBlock *block, const char *label, int x, int y)
static void wm_block_splash_close(bContext *C, void *arg_block, void *)
static uiBlock * wm_block_about_create(bContext *C, ARegion *region, void *)
static ImBuf * wm_block_splash_banner_image(int *r_width, int *r_height, int max_width, int max_height)
static void wm_block_splash_image_roundcorners_add(ImBuf *ibuf)
static wmOperatorStatus wm_splash_about_invoke(bContext *C, wmOperator *, const wmEvent *)
static wmOperatorStatus wm_splash_invoke(bContext *C, wmOperator *, const wmEvent *)
static void wm_block_splash_close_on_fileselect(bContext *C, void *arg1, void *)
static uiBlock * wm_block_splash_create(bContext *C, ARegion *region, void *)
void WM_OT_splash(wmOperatorType *ot)
int WM_window_native_pixel_x(const wmWindow *win)