From 4def6e80728a120977f869b475251b133d88e4ab Mon Sep 17 00:00:00 2001 From: Julian Eisel Date: Tue, 29 Mar 2022 14:36:06 +0200 Subject: Icons: Programmatically create indirect library icon, remove from SVG The indirect library data icon was just a grayed out version of the regular one. This graying out is now done in code, so the icon can be removed from the SVG. Note that the icon is still defined as `ICON_LIBRARY_DATA_INDIRECT` (or `LIBRARY_DATA_INDIRECT` in BPY). --- source/blender/editors/datafiles/CMakeLists.txt | 1 - source/blender/editors/include/UI_icons.h | 4 +++- source/blender/editors/interface/interface_icons.c | 13 +++++++++++++ 3 files changed, 16 insertions(+), 2 deletions(-) (limited to 'source') diff --git a/source/blender/editors/datafiles/CMakeLists.txt b/source/blender/editors/datafiles/CMakeLists.txt index d58bbec01cd..e820423cdff 100644 --- a/source/blender/editors/datafiles/CMakeLists.txt +++ b/source/blender/editors/datafiles/CMakeLists.txt @@ -191,7 +191,6 @@ set(ICON_NAMES library_data_broken boids strands - library_data_indirect greasepencil line_data library_data_override diff --git a/source/blender/editors/include/UI_icons.h b/source/blender/editors/include/UI_icons.h index a560208ac1e..8607c6d242c 100644 --- a/source/blender/editors/include/UI_icons.h +++ b/source/blender/editors/include/UI_icons.h @@ -246,7 +246,7 @@ DEF_ICON(RENDER_STILL) DEF_ICON(LIBRARY_DATA_BROKEN) DEF_ICON(BOIDS) DEF_ICON(STRANDS) -DEF_ICON(LIBRARY_DATA_INDIRECT) +DEF_ICON_BLANK(263) DEF_ICON(GREASEPENCIL) DEF_ICON_SHADING(LINE_DATA) DEF_ICON(LIBRARY_DATA_OVERRIDE) @@ -981,6 +981,8 @@ DEF_ICON_VECTOR(SEQUENCE_COLOR_07) DEF_ICON_VECTOR(SEQUENCE_COLOR_08) DEF_ICON_VECTOR(SEQUENCE_COLOR_09) +DEF_ICON_VECTOR(LIBRARY_DATA_INDIRECT) + /* Events. */ DEF_ICON_COLOR(EVENT_A) DEF_ICON_COLOR(EVENT_B) diff --git a/source/blender/editors/interface/interface_icons.c b/source/blender/editors/interface/interface_icons.c index 07e4f6c2a24..887781beda1 100644 --- a/source/blender/editors/interface/interface_icons.c +++ b/source/blender/editors/interface/interface_icons.c @@ -465,6 +465,17 @@ DEF_ICON_STRIP_COLOR_DRAW(09, SEQUENCE_COLOR_09); # undef DEF_ICON_STRIP_COLOR_DRAW +# define ICON_INDIRECT_DATA_ALPHA 0.6f + +static void vicon_strip_color_draw_library_data_indirect( + int x, int y, int w, int UNUSED(h), float alpha) +{ + const float aspect = (float)ICON_DEFAULT_WIDTH / (float)w; + + UI_icon_draw_ex( + x, y, ICON_LIBRARY_DATA_DIRECT, aspect, ICON_INDIRECT_DATA_ALPHA * alpha, 0.0f, NULL, false); +} + /* Dynamically render icon instead of rendering a plain color to a texture/buffer * This is not strictly a "vicon", as it needs access to icon->obj to get the color info, * but it works in a very similar way. @@ -974,6 +985,8 @@ static void init_internal_icons(void) def_internal_vicon(ICON_SEQUENCE_COLOR_07, vicon_strip_color_draw_07); def_internal_vicon(ICON_SEQUENCE_COLOR_08, vicon_strip_color_draw_08); def_internal_vicon(ICON_SEQUENCE_COLOR_09, vicon_strip_color_draw_09); + + def_internal_vicon(ICON_LIBRARY_DATA_INDIRECT, vicon_strip_color_draw_library_data_indirect); } static void init_iconfile_list(struct ListBase *list) -- cgit v1.2.3