WIP: UI: Icons at 64x64 and Simplified Process #112261
BIN
release/datafiles/blender_icons64.png
Normal file
BIN
release/datafiles/blender_icons64.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 585 KiB |
@ -45,62 +45,9 @@ blender_bin = os.environ.get("BLENDER_BIN", blender_bin)
|
||||
cmd = (
|
||||
inkscape_bin,
|
||||
os.path.join(BASEDIR, "blender_icons.svg"),
|
||||
"--export-width=602",
|
||||
"--export-height=640",
|
||||
"--export-width=2408",
|
||||
"--export-height=2560",
|
||||
"--export-type=png",
|
||||
"--export-filename=" + os.path.join(BASEDIR, "blender_icons16.png"),
|
||||
"--export-filename=" + os.path.join(BASEDIR, "blender_icons64.png"),
|
||||
)
|
||||
run(cmd, env=env)
|
||||
|
||||
cmd = (
|
||||
inkscape_bin,
|
||||
os.path.join(BASEDIR, "blender_icons.svg"),
|
||||
"--export-width=1204",
|
||||
"--export-height=1280",
|
||||
"--export-type=png",
|
||||
"--export-filename=" + os.path.join(BASEDIR, "blender_icons32.png"),
|
||||
)
|
||||
run(cmd, env=env)
|
||||
|
||||
|
||||
# For testing it can be good to clear all old
|
||||
# rm ./blender_icons16/*.dat
|
||||
# rm ./blender_icons32/*.dat
|
||||
|
||||
datatoc_icon_split_py = os.path.join(BASEDIR, "..", "..", "source", "blender", "datatoc", "datatoc_icon_split.py")
|
||||
|
||||
# create .dat pixmaps (which are stored in git)
|
||||
cmd = (
|
||||
blender_bin, "--background", "--factory-startup", "-noaudio",
|
||||
"--python", datatoc_icon_split_py, "--",
|
||||
"--image=" + os.path.join(BASEDIR, "blender_icons16.png"),
|
||||
"--output=" + os.path.join(BASEDIR, "blender_icons16"),
|
||||
"--output_prefix=icon16_",
|
||||
"--name_style=UI_ICONS",
|
||||
"--parts_x", "26", "--parts_y", "30",
|
||||
"--minx", "3", "--maxx", "53", "--miny", "3", "--maxy", "8",
|
||||
"--minx_icon", "2", "--maxx_icon", "2", "--miny_icon", "2", "--maxy_icon", "2",
|
||||
"--spacex_icon", "1", "--spacey_icon", "1",
|
||||
)
|
||||
run(cmd, env=env)
|
||||
|
||||
cmd = (
|
||||
blender_bin, "--background", "--factory-startup", "-noaudio",
|
||||
"--python", datatoc_icon_split_py, "--",
|
||||
"--image=" + os.path.join(BASEDIR, "blender_icons32.png"),
|
||||
"--output=" + os.path.join(BASEDIR, "blender_icons32"),
|
||||
"--output_prefix=icon32_",
|
||||
"--name_style=UI_ICONS",
|
||||
"--parts_x", "26", "--parts_y", "30",
|
||||
"--minx", "6", "--maxx", "106", "--miny", "6", "--maxy", "16",
|
||||
"--minx_icon", "4", "--maxx_icon", "4", "--miny_icon", "4", "--maxy_icon", "4",
|
||||
"--spacex_icon", "2", "--spacey_icon", "2",
|
||||
)
|
||||
run(cmd, env=env)
|
||||
|
||||
os.remove(os.path.join(BASEDIR, "blender_icons16.png"))
|
||||
os.remove(os.path.join(BASEDIR, "blender_icons32.png"))
|
||||
|
||||
# For testing, if we want the PNG of each image
|
||||
# ./datatoc_icon_split_to_png.py ./blender_icons16/*.dat
|
||||
# ./datatoc_icon_split_to_png.py ./blender_icons32/*.dat
|
||||
|
@ -909,21 +909,11 @@ if(WITH_BLENDER)
|
||||
data_to_c_simple(../../../../release/datafiles/splash.png SRC)
|
||||
data_to_c_simple(../../../../release/datafiles/alert_icons.png SRC)
|
||||
data_to_c_simple(../../../../release/datafiles/blender_logo.png SRC)
|
||||
# XXX These are handy, but give nasty "false changes" in svn :/
|
||||
# svg_to_png(../../../../release/datafiles/blender_icons.svg
|
||||
# ../../../../release/datafiles/blender_icons16.png
|
||||
# 90 SRC)
|
||||
|
||||
data_to_c_simple_icons(../../../../release/datafiles/blender_icons16 "icon16_" "${ICON_NAMES}" SRC)
|
||||
# data_to_c_simple(../../../../release/datafiles/blender_icons16.png SRC)
|
||||
# svg_to_png(../../../../release/datafiles/blender_icons.svg
|
||||
# ../../../../release/datafiles/blender_icons32.png
|
||||
# 180 SRC)
|
||||
data_to_c_simple_icons(../../../../release/datafiles/blender_icons32 "icon32_" "${ICON_NAMES}" SRC)
|
||||
# data_to_c_simple(../../../../release/datafiles/blender_icons32.png SRC)
|
||||
# svg_to_png(../../../../release/datafiles/prvicons.svg
|
||||
# ../../../../release/datafiles/prvicons.png
|
||||
# 90 SRC)
|
||||
# Interface icons.
|
||||
data_to_c_simple(../../../../release/datafiles/blender_icons64.png SRC)
|
||||
|
||||
# Larger icons used for File Browser Thumbnail Views.
|
||||
data_to_c_simple(../../../../release/datafiles/prvicons.png SRC)
|
||||
|
||||
# Brushes.
|
||||
|
@ -23,11 +23,8 @@ extern const char datatoc_preview_blend[];
|
||||
extern int datatoc_preview_grease_pencil_blend_size;
|
||||
extern const char datatoc_preview_grease_pencil_blend[];
|
||||
|
||||
extern int datatoc_blender_icons16_png_size;
|
||||
extern const char datatoc_blender_icons16_png[];
|
||||
|
||||
extern int datatoc_blender_icons32_png_size;
|
||||
extern const char datatoc_blender_icons32_png[];
|
||||
extern int datatoc_blender_icons64_png_size;
|
||||
extern const char datatoc_blender_icons64_png[];
|
||||
|
||||
extern int datatoc_prvicons_png_size;
|
||||
extern const char datatoc_prvicons_png[];
|
||||
|
@ -69,11 +69,12 @@
|
||||
#ifndef WITH_HEADLESS
|
||||
# define ICON_GRID_COLS 26
|
||||
# define ICON_GRID_ROWS 30
|
||||
|
||||
# define ICON_MONO_BORDER_OUTSET 2
|
||||
# define ICON_GRID_MARGIN 10
|
||||
# define ICON_GRID_W 32
|
||||
# define ICON_GRID_H 32
|
||||
# define ICON_GRID_WIDTH_MIN 301
|
||||
# define ICON_GRID_HEIGHT_MIN 320
|
||||
# define ICON_MONO_BORDER_OUTSET 4
|
||||
# define ICON_GRID_MARGIN 20
|
||||
# define ICON_GRID_W 64
|
||||
# define ICON_GRID_H 64
|
||||
#endif /* WITH_HEADLESS */
|
||||
|
||||
struct IconImage {
|
||||
@ -870,40 +871,47 @@ void UI_icons_reload_internal_textures()
|
||||
{
|
||||
bTheme *btheme = UI_GetTheme();
|
||||
ImBuf *b16buf = nullptr, *b32buf = nullptr, *b16buf_border = nullptr, *b32buf_border = nullptr;
|
||||
ImBuf *b64buf = nullptr, *b64buf_border = nullptr, *b8buf = nullptr, *b8buf_border = nullptr;
|
||||
const float icon_border_intensity = btheme->tui.icon_border_intensity;
|
||||
const bool need_icons_with_border = icon_border_intensity > 0.0f;
|
||||
|
||||
if (b16buf == nullptr) {
|
||||
b16buf = IMB_ibImageFromMemory((const uchar *)datatoc_blender_icons16_png,
|
||||
datatoc_blender_icons16_png_size,
|
||||
IB_rect,
|
||||
nullptr,
|
||||
"<blender icons>");
|
||||
b64buf = IMB_ibImageFromMemory((const uchar *)datatoc_blender_icons64_png,
|
||||
datatoc_blender_icons64_png_size,
|
||||
IB_rect,
|
||||
nullptr,
|
||||
"<blender icons>");
|
||||
|
||||
if (need_icons_with_border) {
|
||||
b64buf_border = create_mono_icon_with_border(b64buf, 1, icon_border_intensity);
|
||||
IMB_premultiply_alpha(b64buf_border);
|
||||
}
|
||||
if (b16buf) {
|
||||
if (need_icons_with_border) {
|
||||
b16buf_border = create_mono_icon_with_border(b16buf, 2, icon_border_intensity);
|
||||
IMB_premultiply_alpha(b16buf_border);
|
||||
}
|
||||
IMB_premultiply_alpha(b16buf);
|
||||
IMB_premultiply_alpha(b64buf);
|
||||
|
||||
/* Create 32x32 level from 64x64. */
|
||||
b32buf = IMB_dupImBuf(b64buf);
|
||||
IMB_scaleImBuf(b32buf, ICON_GRID_WIDTH_MIN * 4, ICON_GRID_HEIGHT_MIN * 4);
|
||||
if (need_icons_with_border) {
|
||||
b32buf_border = create_mono_icon_with_border(b32buf, 2, icon_border_intensity);
|
||||
IMB_premultiply_alpha(b32buf_border);
|
||||
}
|
||||
|
||||
if (b32buf == nullptr) {
|
||||
b32buf = IMB_ibImageFromMemory((const uchar *)datatoc_blender_icons32_png,
|
||||
datatoc_blender_icons32_png_size,
|
||||
IB_rect,
|
||||
nullptr,
|
||||
"<blender icons>");
|
||||
}
|
||||
if (b32buf) {
|
||||
if (need_icons_with_border) {
|
||||
b32buf_border = create_mono_icon_with_border(b32buf, 1, icon_border_intensity);
|
||||
IMB_premultiply_alpha(b32buf_border);
|
||||
}
|
||||
IMB_premultiply_alpha(b32buf);
|
||||
/* Create 16x16 level from 32x32. */
|
||||
b16buf = IMB_dupImBuf(b32buf);
|
||||
IMB_scaleImBuf(b16buf, ICON_GRID_WIDTH_MIN * 2, ICON_GRID_HEIGHT_MIN * 2);
|
||||
if (need_icons_with_border) {
|
||||
b16buf_border = create_mono_icon_with_border(b16buf, 4, icon_border_intensity);
|
||||
IMB_premultiply_alpha(b16buf_border);
|
||||
}
|
||||
|
||||
if (b16buf && b32buf) {
|
||||
/* Create 8x8 level from 16x16. */
|
||||
b8buf = IMB_dupImBuf(b16buf);
|
||||
IMB_scaleImBuf(b8buf, ICON_GRID_WIDTH_MIN, ICON_GRID_HEIGHT_MIN);
|
||||
if (need_icons_with_border) {
|
||||
b8buf_border = create_mono_icon_with_border(b8buf, 8, icon_border_intensity);
|
||||
IMB_premultiply_alpha(b8buf_border);
|
||||
}
|
||||
|
||||
if (b8buf && b16buf && b32buf && b64buf) {
|
||||
/* Free existing texture if any. */
|
||||
free_icons_textures();
|
||||
|
||||
@ -913,36 +921,46 @@ void UI_icons_reload_internal_textures()
|
||||
/* Note the filter and LOD bias were tweaked to better preserve icon
|
||||
* sharpness at different UI scales. */
|
||||
if (icongltex.tex[0] == nullptr) {
|
||||
icongltex.w = b32buf->x;
|
||||
icongltex.h = b32buf->y;
|
||||
icongltex.invw = 1.0f / b32buf->x;
|
||||
icongltex.invh = 1.0f / b32buf->y;
|
||||
icongltex.w = b64buf->x;
|
||||
icongltex.h = b64buf->y;
|
||||
icongltex.invw = 1.0f / b64buf->x;
|
||||
icongltex.invh = 1.0f / b64buf->y;
|
||||
|
||||
icongltex.tex[0] = GPU_texture_create_2d(
|
||||
"icons", b32buf->x, b32buf->y, 2, GPU_RGBA8, GPU_TEXTURE_USAGE_SHADER_READ, nullptr);
|
||||
GPU_texture_update_mipmap(icongltex.tex[0], 0, GPU_DATA_UBYTE, b32buf->byte_buffer.data);
|
||||
GPU_texture_update_mipmap(icongltex.tex[0], 1, GPU_DATA_UBYTE, b16buf->byte_buffer.data);
|
||||
"icons", icongltex.w, icongltex.h, 4, GPU_RGBA8, GPU_TEXTURE_USAGE_SHADER_READ, nullptr);
|
||||
GPU_texture_update_mipmap(icongltex.tex[0], 0, GPU_DATA_UBYTE, b64buf->byte_buffer.data);
|
||||
GPU_texture_update_mipmap(icongltex.tex[0], 1, GPU_DATA_UBYTE, b32buf->byte_buffer.data);
|
||||
GPU_texture_update_mipmap(icongltex.tex[0], 2, GPU_DATA_UBYTE, b16buf->byte_buffer.data);
|
||||
GPU_texture_update_mipmap(icongltex.tex[0], 3, GPU_DATA_UBYTE, b8buf->byte_buffer.data);
|
||||
}
|
||||
|
||||
if (need_icons_with_border && icongltex.tex[1] == nullptr) {
|
||||
icongltex.tex[1] = GPU_texture_create_2d("icons_border",
|
||||
b32buf_border->x,
|
||||
b32buf_border->y,
|
||||
2,
|
||||
icongltex.w,
|
||||
icongltex.h,
|
||||
4,
|
||||
GPU_RGBA8,
|
||||
GPU_TEXTURE_USAGE_SHADER_READ,
|
||||
nullptr);
|
||||
GPU_texture_update_mipmap(
|
||||
icongltex.tex[1], 0, GPU_DATA_UBYTE, b32buf_border->byte_buffer.data);
|
||||
icongltex.tex[1], 0, GPU_DATA_UBYTE, b64buf_border->byte_buffer.data);
|
||||
GPU_texture_update_mipmap(
|
||||
icongltex.tex[1], 1, GPU_DATA_UBYTE, b16buf_border->byte_buffer.data);
|
||||
icongltex.tex[1], 1, GPU_DATA_UBYTE, b32buf_border->byte_buffer.data);
|
||||
GPU_texture_update_mipmap(
|
||||
icongltex.tex[1], 2, GPU_DATA_UBYTE, b16buf_border->byte_buffer.data);
|
||||
GPU_texture_update_mipmap(
|
||||
icongltex.tex[1], 3, GPU_DATA_UBYTE, b8buf_border->byte_buffer.data);
|
||||
}
|
||||
}
|
||||
|
||||
IMB_freeImBuf(b8buf);
|
||||
IMB_freeImBuf(b16buf);
|
||||
IMB_freeImBuf(b32buf);
|
||||
IMB_freeImBuf(b64buf);
|
||||
IMB_freeImBuf(b8buf_border);
|
||||
IMB_freeImBuf(b16buf_border);
|
||||
IMB_freeImBuf(b32buf_border);
|
||||
IMB_freeImBuf(b64buf_border);
|
||||
}
|
||||
|
||||
static void init_internal_icons()
|
||||
|
@ -4864,8 +4864,8 @@ static void rna_def_userdef_view(BlenderRNA *brna)
|
||||
prop = RNA_def_property(srna, "ui_scale", PROP_FLOAT, PROP_NONE);
|
||||
RNA_def_property_ui_text(
|
||||
prop, "UI Scale", "Changes the size of the fonts and widgets in the interface");
|
||||
RNA_def_property_range(prop, 0.25f, 4.0f);
|
||||
RNA_def_property_ui_range(prop, 0.5f, 2.0f, 1, 2);
|
||||
RNA_def_property_range(prop, 0.25f, 8.0f);
|
||||
RNA_def_property_ui_range(prop, 0.5f, 4.0f, 1, 2);
|
||||
RNA_def_property_update(prop, 0, "rna_userdef_gpu_update");
|
||||
|
||||
prop = RNA_def_property(srna, "ui_line_width", PROP_ENUM, PROP_NONE);
|
||||
|
Loading…
Reference in New Issue
Block a user