65 if (!(label && label[0])) {
72 block,
ButType::Label, 0, label, 0,
y,
x,
UI_UNIT_Y,
nullptr, 0, 0, std::nullopt);
77 uchar color[4] = {255, 255, 255, 255};
93 const int size = roundness * 20;
97 rct += 4 * (ibuf->
y -
size) * ibuf->
x;
99 for (
int y = 0;
y <
size;
y++) {
100 for (
int x = 0;
x <
size;
x++, rct += 4) {
101 const float pixel = 1.0 /
size;
102 const float u = pixel *
x;
103 const float v = pixel *
y;
108 const int offset_l = 4 * (
size -
x -
x - 1) + 3;
109 const int offset_r = 4 * (ibuf->
x -
size) + 3;
125 rct[offset_l] = alpha;
126 rct[offset_r] = alpha;
131 rct += 4 * (ibuf->
x -
size);
139 ImBuf *ibuf =
nullptr;
142 if (
U.app_template[0] !=
'\0') {
146 U.app_template, template_directory,
sizeof(template_directory)))
148 BLI_path_join(splash_filepath,
sizeof(splash_filepath), template_directory,
"splash.png");
153 if (ibuf ==
nullptr) {
154 const char *custom_splash_path =
BLI_getenv(
"BLENDER_CUSTOM_SPLASH");
155 if (custom_splash_path) {
160 if (ibuf ==
nullptr) {
164 splash_data, splash_data_size,
IB_byte_data,
"<splash screen>");
169 height = (width * ibuf->
y) / ibuf->
x;
170 if (width != ibuf->
x || height != ibuf->
y) {
190 ImBuf *ibuf =
nullptr;
192 int width = max_width;
195 const char *custom_splash_path =
BLI_getenv(
"BLENDER_CUSTOM_SPLASH_BANNER");
196 if (custom_splash_path) {
208 if (width > 0 && height > 0 && (width > max_width || height > max_height)) {
209 const float splash_ratio = max_width /
float(max_height);
210 const float banner_ratio = ibuf->
x /
float(ibuf->
y);
212 if (banner_ratio > splash_ratio) {
215 height = max_width / banner_ratio;
217 else if (banner_ratio < splash_ratio) {
220 width = max_height * banner_ratio;
226 if (width != ibuf->
x || height != ibuf->
y) {
252 bool has_fileselect =
false;
255 has_fileselect =
true;
260 if (has_fileselect) {
265#if defined(__APPLE__)
270# include <sys/sysctl.h>
272static int is_using_macos_rosetta()
277 if (sysctlbyname(
"sysctl.proc_translated", &
ret, &
size,
nullptr, 0) != -1) {
281 if (errno == ENOENT) {
310 block, ibuf, 0, 0.5f *
U.widget_unit, splash_width, splash_height,
nullptr);
323 int banner_width = 0;
324 int banner_height = 0;
326 &banner_width, &banner_height, splash_width, splash_height);
329 block, bannerbuf, 0, 0.5f *
U.widget_unit, banner_width, banner_height,
nullptr);
340 splash_width - (layout_margin_x * 2),
366#if defined(__APPLE__) || defined(_M_X64)
367# if defined(__APPLE__)
368 if (is_using_macos_rosetta() > 0)
369# elif defined(_M_X64)
370 const char *proc_id =
BLI_getenv(
"PROCESSOR_IDENTIFIER");
371 if (proc_id && strncmp(proc_id,
"ARM", 3) == 0)
380 row1->
label(
RPT_(
"Intel binary detected. Expect reduced performance."), ICON_ERROR);
387# if defined(__APPLE__)
391 "https://docs.blender.org/manual/en/latest/getting_started/installing/macos.html");
392# elif defined(_M_X64)
396 "https://docs.blender.org/manual/en/latest/getting_started/installing/windows.html");
419 ot->name =
"Splash Screen";
420 ot->idname =
"WM_OT_splash";
421 ot->description =
"Open the splash screen with release info";
455 constexpr bool show_color =
false;
456 const float size = 0.2f * dialog_width;
469 row = &layout.
row(
false);
471 uiDefButImage(block, ibuf, 0,
U.widget_unit, ibuf->
x, ibuf->
y, show_color ?
nullptr : color);
474 row = &layout.
row(
false);
504 ot->name =
"About Blender";
505 ot->idname =
"WM_OT_splash_about";
506 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])
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)
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)
@ UI_BLOCK_THEME_STYLE_POPUP
void UI_block_flag_enable(uiBlock *block, int flag)
uiBut * uiDefBut(uiBlock *block, uiButTypeWithPointerType but_and_ptr_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)
ImBuf * UI_svg_icon_bitmap(uint icon_id, float size, bool multicolor=false)
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)
uiLayout & block_layout(uiBlock *block, LayoutDirection direction, LayoutType type, int x, int y, int size, int em, int padding, const uiStyle *style)
void RNA_string_set(PointerRNA *ptr, const char *name, const char *value)
ImBufByteBuffer byte_buffer
uiWidgetColors wcol_menu_back
void alignment_set(blender::ui::LayoutAlign alignment)
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)
PointerRNA op(wmOperatorType *ot, std::optional< blender::StringRef > name, int icon, blender::wm::OpCallContext context, eUI_Item_Flag flag)
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)