2023-05-31 16:19:06 +02:00
|
|
|
/* SPDX-FileCopyrightText: 2001-2002 NaN Holding BV. All rights reserved.
|
|
|
|
|
*
|
|
|
|
|
* SPDX-License-Identifier: GPL-2.0-or-later */
|
2008-11-25 18:27:41 +00:00
|
|
|
|
2019-02-18 08:08:12 +11:00
|
|
|
/** \file
|
|
|
|
|
* \ingroup edinterface
|
2011-02-27 20:29:51 +00:00
|
|
|
*/
|
|
|
|
|
|
2008-11-25 18:27:41 +00:00
|
|
|
#include "MEM_guardedalloc.h"
|
|
|
|
|
|
2024-03-23 01:24:18 +01:00
|
|
|
#include "GPU_immediate.hh"
|
2025-01-26 20:08:00 +01:00
|
|
|
#include "GPU_state.hh"
|
2009-10-19 14:03:02 +00:00
|
|
|
|
2024-06-21 22:37:33 +02:00
|
|
|
#include "BLF_api.hh"
|
|
|
|
|
|
2025-02-24 16:08:30 +01:00
|
|
|
#include "BLI_math_vector.h"
|
2025-03-25 18:11:27 +01:00
|
|
|
#include "BLI_rect.h"
|
2025-01-16 23:17:51 +01:00
|
|
|
#include "BLI_string.h"
|
2008-11-25 18:27:41 +00:00
|
|
|
|
2025-03-21 01:57:32 +01:00
|
|
|
#include "BLT_translation.hh"
|
|
|
|
|
|
2020-09-15 12:13:03 -06:00
|
|
|
#include "DNA_collection_types.h"
|
This commit frees list ui items from their dependencies to Panel, and hence from all the limitations this implied (mostly, the "only one list per panel" one).
It introduces a new (py-extendable and registrable) RNA type, UIList (roughly similar to Panel one), which currently contains only "standard" list's scroll pos and size (but may be expended to include e.g. some filtering data, etc.). This now makes lists completely independent from Panels!
This UIList has a draw_item callback which allows to customize items' drawing from python, that all addons can now use. Incidentally, this also greatly simplifies the C code of this widget, as we do not code any "special case" here anymore!
To make all this work, other changes were also necessary:
* Now all buttons (uiBut struct) have a 'custom_data' void pointer, used currently to store the uiList struct associated with a given uiLayoutListBox.
* DynamicPaintSurface now exposes a new bool, use_color_preview (readonly), saying whether that surface has some 3D view preview data or not.
* UILayout class has now four new (static) functions, to get the actual icon of any RNA object (important e.g. with materials or textures), and to get an enum item's UI name, description and icon.
* UILayout's label() func now takes an optional 'icon_value' integer parameter, which if not zero will override the 'icon' one (mandatory to use "custom" icons as generated for material/texture/... previews).
Note: not sure whether we should add that one to all UILayout's prop funcs?
Note: will update addons using template list asap.
2012-12-28 09:20:16 +00:00
|
|
|
#include "DNA_dynamicpaint_types.h"
|
2023-03-13 10:42:51 +01:00
|
|
|
#include "DNA_gpencil_legacy_types.h"
|
2024-06-11 18:25:01 +02:00
|
|
|
#include "DNA_grease_pencil_types.h"
|
2008-11-25 18:27:41 +00:00
|
|
|
#include "DNA_screen_types.h"
|
2021-09-29 14:29:32 +02:00
|
|
|
#include "DNA_sequence_types.h"
|
2011-01-16 18:33:08 +00:00
|
|
|
#include "DNA_space_types.h"
|
2010-07-26 04:00:09 +00:00
|
|
|
|
2023-08-10 22:40:27 +02:00
|
|
|
#include "RNA_access.hh"
|
2024-07-10 18:30:02 +02:00
|
|
|
#include "RNA_prototypes.hh"
|
2008-11-25 18:27:41 +00:00
|
|
|
|
2023-11-16 11:41:55 +01:00
|
|
|
#include "BKE_context.hh"
|
2024-02-10 18:25:14 +01:00
|
|
|
#include "BKE_global.hh"
|
2008-11-25 18:27:41 +00:00
|
|
|
#include "BKE_icons.h"
|
2023-08-02 22:14:18 +02:00
|
|
|
#include "BKE_paint.hh"
|
2023-09-04 18:02:16 +02:00
|
|
|
#include "BKE_preview_image.hh"
|
2018-05-11 16:55:14 +02:00
|
|
|
#include "BKE_studiolight.h"
|
2008-11-25 18:27:41 +00:00
|
|
|
|
2024-01-18 22:50:23 +02:00
|
|
|
#include "IMB_imbuf.hh"
|
|
|
|
|
#include "IMB_thumbs.hh"
|
2008-11-25 18:27:41 +00:00
|
|
|
|
2023-08-05 02:57:52 +02:00
|
|
|
#include "BIF_glutil.hh"
|
2008-11-25 18:27:41 +00:00
|
|
|
|
2023-08-05 02:57:52 +02:00
|
|
|
#include "ED_keyframes_draw.hh"
|
|
|
|
|
#include "ED_keyframes_keylist.hh"
|
2025-03-25 18:11:27 +01:00
|
|
|
#include "ED_node.hh"
|
2023-08-05 02:57:52 +02:00
|
|
|
#include "ED_render.hh"
|
2008-11-25 18:27:41 +00:00
|
|
|
|
2023-08-05 02:57:52 +02:00
|
|
|
#include "UI_interface.hh"
|
|
|
|
|
#include "UI_interface_icons.hh"
|
2009-06-25 15:41:27 +00:00
|
|
|
|
2023-08-04 23:11:22 +02:00
|
|
|
#include "WM_api.hh"
|
2018-06-19 14:00:34 +02:00
|
|
|
|
2022-11-26 00:21:17 -06:00
|
|
|
#include "interface_intern.hh"
|
2009-06-25 15:41:27 +00:00
|
|
|
|
2025-01-26 20:08:00 +01:00
|
|
|
#include <fmt/format.h>
|
2024-08-11 20:10:32 +02:00
|
|
|
|
2022-11-25 23:48:02 -06:00
|
|
|
struct IconImage {
|
2008-11-25 18:27:41 +00:00
|
|
|
int w;
|
|
|
|
|
int h;
|
2023-05-18 10:19:01 +02:00
|
|
|
uint8_t *rect;
|
2019-03-25 09:08:29 +11:00
|
|
|
const uchar *datatoc_rect;
|
2013-01-22 11:18:41 +00:00
|
|
|
int datatoc_size;
|
2022-11-25 23:48:02 -06:00
|
|
|
};
|
2008-11-25 18:27:41 +00:00
|
|
|
|
2025-04-15 23:01:01 +02:00
|
|
|
using VectorDrawFunc =
|
|
|
|
|
void (*)(float x, float y, float w, float h, float alpha, const uchar mono_rgba[4]);
|
2008-11-25 19:23:54 +00:00
|
|
|
|
2018-07-02 15:28:47 +02:00
|
|
|
#define ICON_TYPE_PREVIEW 0
|
2024-07-17 20:13:17 +02:00
|
|
|
#define ICON_TYPE_SVG_COLOR 1
|
2024-07-17 22:15:09 +02:00
|
|
|
#define ICON_TYPE_SVG_MONO 2
|
2018-07-02 15:28:47 +02:00
|
|
|
#define ICON_TYPE_BUFFER 3
|
2020-12-14 13:21:58 +01:00
|
|
|
#define ICON_TYPE_IMBUF 4
|
|
|
|
|
#define ICON_TYPE_VECTOR 5
|
|
|
|
|
#define ICON_TYPE_GEOM 6
|
|
|
|
|
#define ICON_TYPE_EVENT 7 /* draw keymap entries using custom renderer. */
|
|
|
|
|
#define ICON_TYPE_GPLAYER 8
|
|
|
|
|
#define ICON_TYPE_BLANK 9
|
Sorry, three commits in one, became difficult to untangle..
Editors Modules
* render/ module added in editors, moved the preview render code there and
also shading related operators.
* physics/ module made more consistent with other modules. renaming files,
making a single physics_ops.c for operators and keymaps. Also move all
particle related operators here now.
* space_buttons/ now should have only operators relevant to the buttons
specificially.
Updates & Notifiers
* Material/Texture/World/Lamp can now be passed to DAG_id_flush_update,
which will go back to a callback in editors. Eventually these should
be in the depsgraph itself, but for now this gives a unified call for
doing updates.
* GLSL materials are now refreshed on changes. There's still various
cases missing,
* Preview icons now hook into this system, solving various update cases
that were missed before.
* Also fixes issue in my last commit, where some preview would not render,
problem is avoided in the new system.
Icon Rendering
* On systems with support for non-power of two textures, an OpenGL texture
is now used instead of glDrawPixels. This avoids problems with icons get
clipped on region borders. On my Linux desktop, this gives an 1.1x speedup,
and on my Mac laptop a 2.3x speedup overall in redrawing the full window,
with the default setup. The glDrawPixels implementation on Mac seems to
have a lot of overhread.
* Preview icons are now drawn using proper premul alpha, and never faded so
you can see them clearly.
* Also tried to fix issue with texture node preview rendering, globals can't
be used with threads reliably.
2009-09-29 19:12:12 +00:00
|
|
|
|
2022-11-25 23:48:02 -06:00
|
|
|
struct DrawInfo {
|
Sorry, three commits in one, became difficult to untangle..
Editors Modules
* render/ module added in editors, moved the preview render code there and
also shading related operators.
* physics/ module made more consistent with other modules. renaming files,
making a single physics_ops.c for operators and keymaps. Also move all
particle related operators here now.
* space_buttons/ now should have only operators relevant to the buttons
specificially.
Updates & Notifiers
* Material/Texture/World/Lamp can now be passed to DAG_id_flush_update,
which will go back to a callback in editors. Eventually these should
be in the depsgraph itself, but for now this gives a unified call for
doing updates.
* GLSL materials are now refreshed on changes. There's still various
cases missing,
* Preview icons now hook into this system, solving various update cases
that were missed before.
* Also fixes issue in my last commit, where some preview would not render,
problem is avoided in the new system.
Icon Rendering
* On systems with support for non-power of two textures, an OpenGL texture
is now used instead of glDrawPixels. This avoids problems with icons get
clipped on region borders. On my Linux desktop, this gives an 1.1x speedup,
and on my Mac laptop a 2.3x speedup overall in redrawing the full window,
with the default setup. The glDrawPixels implementation on Mac seems to
have a lot of overhread.
* Preview icons are now drawn using proper premul alpha, and never faded so
you can see them clearly.
* Also tried to fix issue with texture node preview rendering, globals can't
be used with threads reliably.
2009-09-29 19:12:12 +00:00
|
|
|
int type;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
Sorry, three commits in one, became difficult to untangle..
Editors Modules
* render/ module added in editors, moved the preview render code there and
also shading related operators.
* physics/ module made more consistent with other modules. renaming files,
making a single physics_ops.c for operators and keymaps. Also move all
particle related operators here now.
* space_buttons/ now should have only operators relevant to the buttons
specificially.
Updates & Notifiers
* Material/Texture/World/Lamp can now be passed to DAG_id_flush_update,
which will go back to a callback in editors. Eventually these should
be in the depsgraph itself, but for now this gives a unified call for
doing updates.
* GLSL materials are now refreshed on changes. There's still various
cases missing,
* Preview icons now hook into this system, solving various update cases
that were missed before.
* Also fixes issue in my last commit, where some preview would not render,
problem is avoided in the new system.
Icon Rendering
* On systems with support for non-power of two textures, an OpenGL texture
is now used instead of glDrawPixels. This avoids problems with icons get
clipped on region borders. On my Linux desktop, this gives an 1.1x speedup,
and on my Mac laptop a 2.3x speedup overall in redrawing the full window,
with the default setup. The glDrawPixels implementation on Mac seems to
have a lot of overhread.
* Preview icons are now drawn using proper premul alpha, and never faded so
you can see them clearly.
* Also tried to fix issue with texture node preview rendering, globals can't
be used with threads reliably.
2009-09-29 19:12:12 +00:00
|
|
|
union {
|
|
|
|
|
/* type specific data */
|
|
|
|
|
struct {
|
|
|
|
|
VectorDrawFunc func;
|
|
|
|
|
} vector;
|
2018-04-20 15:15:10 +02:00
|
|
|
struct {
|
2018-04-21 21:10:09 +02:00
|
|
|
ImBuf *image_cache;
|
2020-02-03 17:47:04 +01:00
|
|
|
bool inverted;
|
2018-04-20 15:15:10 +02:00
|
|
|
} geom;
|
Sorry, three commits in one, became difficult to untangle..
Editors Modules
* render/ module added in editors, moved the preview render code there and
also shading related operators.
* physics/ module made more consistent with other modules. renaming files,
making a single physics_ops.c for operators and keymaps. Also move all
particle related operators here now.
* space_buttons/ now should have only operators relevant to the buttons
specificially.
Updates & Notifiers
* Material/Texture/World/Lamp can now be passed to DAG_id_flush_update,
which will go back to a callback in editors. Eventually these should
be in the depsgraph itself, but for now this gives a unified call for
doing updates.
* GLSL materials are now refreshed on changes. There's still various
cases missing,
* Preview icons now hook into this system, solving various update cases
that were missed before.
* Also fixes issue in my last commit, where some preview would not render,
problem is avoided in the new system.
Icon Rendering
* On systems with support for non-power of two textures, an OpenGL texture
is now used instead of glDrawPixels. This avoids problems with icons get
clipped on region borders. On my Linux desktop, this gives an 1.1x speedup,
and on my Mac laptop a 2.3x speedup overall in redrawing the full window,
with the default setup. The glDrawPixels implementation on Mac seems to
have a lot of overhread.
* Preview icons are now drawn using proper premul alpha, and never faded so
you can see them clearly.
* Also tried to fix issue with texture node preview rendering, globals can't
be used with threads reliably.
2009-09-29 19:12:12 +00:00
|
|
|
struct {
|
2012-03-30 01:51:25 +00:00
|
|
|
IconImage *image;
|
Sorry, three commits in one, became difficult to untangle..
Editors Modules
* render/ module added in editors, moved the preview render code there and
also shading related operators.
* physics/ module made more consistent with other modules. renaming files,
making a single physics_ops.c for operators and keymaps. Also move all
particle related operators here now.
* space_buttons/ now should have only operators relevant to the buttons
specificially.
Updates & Notifiers
* Material/Texture/World/Lamp can now be passed to DAG_id_flush_update,
which will go back to a callback in editors. Eventually these should
be in the depsgraph itself, but for now this gives a unified call for
doing updates.
* GLSL materials are now refreshed on changes. There's still various
cases missing,
* Preview icons now hook into this system, solving various update cases
that were missed before.
* Also fixes issue in my last commit, where some preview would not render,
problem is avoided in the new system.
Icon Rendering
* On systems with support for non-power of two textures, an OpenGL texture
is now used instead of glDrawPixels. This avoids problems with icons get
clipped on region borders. On my Linux desktop, this gives an 1.1x speedup,
and on my Mac laptop a 2.3x speedup overall in redrawing the full window,
with the default setup. The glDrawPixels implementation on Mac seems to
have a lot of overhread.
* Preview icons are now drawn using proper premul alpha, and never faded so
you can see them clearly.
* Also tried to fix issue with texture node preview rendering, globals can't
be used with threads reliably.
2009-09-29 19:12:12 +00:00
|
|
|
} buffer;
|
|
|
|
|
struct {
|
2018-10-02 19:04:38 +02:00
|
|
|
int theme_color;
|
Sorry, three commits in one, became difficult to untangle..
Editors Modules
* render/ module added in editors, moved the preview render code there and
also shading related operators.
* physics/ module made more consistent with other modules. renaming files,
making a single physics_ops.c for operators and keymaps. Also move all
particle related operators here now.
* space_buttons/ now should have only operators relevant to the buttons
specificially.
Updates & Notifiers
* Material/Texture/World/Lamp can now be passed to DAG_id_flush_update,
which will go back to a callback in editors. Eventually these should
be in the depsgraph itself, but for now this gives a unified call for
doing updates.
* GLSL materials are now refreshed on changes. There's still various
cases missing,
* Preview icons now hook into this system, solving various update cases
that were missed before.
* Also fixes issue in my last commit, where some preview would not render,
problem is avoided in the new system.
Icon Rendering
* On systems with support for non-power of two textures, an OpenGL texture
is now used instead of glDrawPixels. This avoids problems with icons get
clipped on region borders. On my Linux desktop, this gives an 1.1x speedup,
and on my Mac laptop a 2.3x speedup overall in redrawing the full window,
with the default setup. The glDrawPixels implementation on Mac seems to
have a lot of overhread.
* Preview icons are now drawn using proper premul alpha, and never faded so
you can see them clearly.
* Also tried to fix issue with texture node preview rendering, globals can't
be used with threads reliably.
2009-09-29 19:12:12 +00:00
|
|
|
} texture;
|
2018-07-08 11:57:59 +02:00
|
|
|
struct {
|
|
|
|
|
/* Can be packed into a single int. */
|
|
|
|
|
short event_type;
|
|
|
|
|
short event_value;
|
|
|
|
|
int icon;
|
|
|
|
|
/* Allow lookups. */
|
2023-06-03 08:36:28 +10:00
|
|
|
DrawInfo *next;
|
2018-07-08 11:57:59 +02:00
|
|
|
} input;
|
Sorry, three commits in one, became difficult to untangle..
Editors Modules
* render/ module added in editors, moved the preview render code there and
also shading related operators.
* physics/ module made more consistent with other modules. renaming files,
making a single physics_ops.c for operators and keymaps. Also move all
particle related operators here now.
* space_buttons/ now should have only operators relevant to the buttons
specificially.
Updates & Notifiers
* Material/Texture/World/Lamp can now be passed to DAG_id_flush_update,
which will go back to a callback in editors. Eventually these should
be in the depsgraph itself, but for now this gives a unified call for
doing updates.
* GLSL materials are now refreshed on changes. There's still various
cases missing,
* Preview icons now hook into this system, solving various update cases
that were missed before.
* Also fixes issue in my last commit, where some preview would not render,
problem is avoided in the new system.
Icon Rendering
* On systems with support for non-power of two textures, an OpenGL texture
is now used instead of glDrawPixels. This avoids problems with icons get
clipped on region borders. On my Linux desktop, this gives an 1.1x speedup,
and on my Mac laptop a 2.3x speedup overall in redrawing the full window,
with the default setup. The glDrawPixels implementation on Mac seems to
have a lot of overhread.
* Preview icons are now drawn using proper premul alpha, and never faded so
you can see them clearly.
* Also tried to fix issue with texture node preview rendering, globals can't
be used with threads reliably.
2009-09-29 19:12:12 +00:00
|
|
|
} data;
|
2022-11-25 23:48:02 -06:00
|
|
|
};
|
Sorry, three commits in one, became difficult to untangle..
Editors Modules
* render/ module added in editors, moved the preview render code there and
also shading related operators.
* physics/ module made more consistent with other modules. renaming files,
making a single physics_ops.c for operators and keymaps. Also move all
particle related operators here now.
* space_buttons/ now should have only operators relevant to the buttons
specificially.
Updates & Notifiers
* Material/Texture/World/Lamp can now be passed to DAG_id_flush_update,
which will go back to a callback in editors. Eventually these should
be in the depsgraph itself, but for now this gives a unified call for
doing updates.
* GLSL materials are now refreshed on changes. There's still various
cases missing,
* Preview icons now hook into this system, solving various update cases
that were missed before.
* Also fixes issue in my last commit, where some preview would not render,
problem is avoided in the new system.
Icon Rendering
* On systems with support for non-power of two textures, an OpenGL texture
is now used instead of glDrawPixels. This avoids problems with icons get
clipped on region borders. On my Linux desktop, this gives an 1.1x speedup,
and on my Mac laptop a 2.3x speedup overall in redrawing the full window,
with the default setup. The glDrawPixels implementation on Mac seems to
have a lot of overhread.
* Preview icons are now drawn using proper premul alpha, and never faded so
you can see them clearly.
* Also tried to fix issue with texture node preview rendering, globals can't
be used with threads reliably.
2009-09-29 19:12:12 +00:00
|
|
|
|
2022-11-25 23:48:02 -06:00
|
|
|
struct IconType {
|
2018-10-02 19:04:38 +02:00
|
|
|
int type;
|
|
|
|
|
int theme_color;
|
2022-11-25 23:48:02 -06:00
|
|
|
};
|
2018-10-02 19:04:38 +02:00
|
|
|
|
2018-11-12 09:18:45 +11:00
|
|
|
#ifndef WITH_HEADLESS
|
|
|
|
|
|
2018-10-02 19:04:38 +02:00
|
|
|
static const IconType icontypes[] = {
|
2024-07-17 22:15:09 +02:00
|
|
|
# define DEF_ICON(name) {ICON_TYPE_SVG_MONO, 0},
|
2024-07-17 20:13:17 +02:00
|
|
|
# define DEF_ICON_COLOR(name) {ICON_TYPE_SVG_COLOR, 0},
|
2024-07-17 22:15:09 +02:00
|
|
|
# define DEF_ICON_SCENE(name) {ICON_TYPE_SVG_MONO, TH_ICON_SCENE},
|
|
|
|
|
# define DEF_ICON_COLLECTION(name) {ICON_TYPE_SVG_MONO, TH_ICON_COLLECTION},
|
|
|
|
|
# define DEF_ICON_OBJECT(name) {ICON_TYPE_SVG_MONO, TH_ICON_OBJECT},
|
|
|
|
|
# define DEF_ICON_OBJECT_DATA(name) {ICON_TYPE_SVG_MONO, TH_ICON_OBJECT_DATA},
|
|
|
|
|
# define DEF_ICON_MODIFIER(name) {ICON_TYPE_SVG_MONO, TH_ICON_MODIFIER},
|
|
|
|
|
# define DEF_ICON_SHADING(name) {ICON_TYPE_SVG_MONO, TH_ICON_SHADING},
|
|
|
|
|
# define DEF_ICON_FOLDER(name) {ICON_TYPE_SVG_MONO, TH_ICON_FOLDER},
|
|
|
|
|
# define DEF_ICON_FUND(name) {ICON_TYPE_SVG_MONO, TH_ICON_FUND},
|
2018-10-02 19:04:38 +02:00
|
|
|
# define DEF_ICON_VECTOR(name) {ICON_TYPE_VECTOR, 0},
|
|
|
|
|
# define DEF_ICON_BLANK(name) {ICON_TYPE_BLANK, 0},
|
2023-08-05 02:57:52 +02:00
|
|
|
# include "UI_icons.hh"
|
2018-09-20 18:07:58 +02:00
|
|
|
};
|
|
|
|
|
|
2008-11-25 18:27:41 +00:00
|
|
|
/* **************************************************** */
|
|
|
|
|
|
2018-10-02 19:04:38 +02:00
|
|
|
static DrawInfo *def_internal_icon(
|
|
|
|
|
ImBuf *bbuf, int icon_id, int xofs, int yofs, int size, int type, int theme_color)
|
2008-11-25 18:27:41 +00:00
|
|
|
{
|
2025-03-05 16:35:09 +01:00
|
|
|
Icon *new_icon = MEM_callocN<Icon>(__func__);
|
2008-11-25 18:27:41 +00:00
|
|
|
|
2022-12-29 12:01:32 -05:00
|
|
|
new_icon->obj = nullptr; /* icon is not for library object */
|
2018-04-19 12:52:32 +02:00
|
|
|
new_icon->id_type = 0;
|
2008-11-25 18:27:41 +00:00
|
|
|
|
2025-03-05 16:35:09 +01:00
|
|
|
DrawInfo *di = MEM_callocN<DrawInfo>(__func__);
|
2012-03-30 01:51:25 +00:00
|
|
|
di->type = type;
|
2008-11-25 18:27:41 +00:00
|
|
|
|
2024-07-17 22:15:09 +02:00
|
|
|
if (type == ICON_TYPE_SVG_MONO) {
|
2018-10-02 19:04:38 +02:00
|
|
|
di->data.texture.theme_color = theme_color;
|
2008-11-25 18:27:41 +00:00
|
|
|
}
|
2012-03-24 06:38:07 +00:00
|
|
|
else if (type == ICON_TYPE_BUFFER) {
|
2025-03-05 16:35:09 +01:00
|
|
|
IconImage *iimg = MEM_callocN<IconImage>(__func__);
|
Sorry, three commits in one, became difficult to untangle..
Editors Modules
* render/ module added in editors, moved the preview render code there and
also shading related operators.
* physics/ module made more consistent with other modules. renaming files,
making a single physics_ops.c for operators and keymaps. Also move all
particle related operators here now.
* space_buttons/ now should have only operators relevant to the buttons
specificially.
Updates & Notifiers
* Material/Texture/World/Lamp can now be passed to DAG_id_flush_update,
which will go back to a callback in editors. Eventually these should
be in the depsgraph itself, but for now this gives a unified call for
doing updates.
* GLSL materials are now refreshed on changes. There's still various
cases missing,
* Preview icons now hook into this system, solving various update cases
that were missed before.
* Also fixes issue in my last commit, where some preview would not render,
problem is avoided in the new system.
Icon Rendering
* On systems with support for non-power of two textures, an OpenGL texture
is now used instead of glDrawPixels. This avoids problems with icons get
clipped on region borders. On my Linux desktop, this gives an 1.1x speedup,
and on my Mac laptop a 2.3x speedup overall in redrawing the full window,
with the default setup. The glDrawPixels implementation on Mac seems to
have a lot of overhread.
* Preview icons are now drawn using proper premul alpha, and never faded so
you can see them clearly.
* Also tried to fix issue with texture node preview rendering, globals can't
be used with threads reliably.
2009-09-29 19:12:12 +00:00
|
|
|
iimg->w = size;
|
|
|
|
|
iimg->h = size;
|
|
|
|
|
|
2013-01-22 11:18:41 +00:00
|
|
|
/* icon buffers can get initialized runtime now, via datatoc */
|
|
|
|
|
if (bbuf) {
|
|
|
|
|
int y, imgsize;
|
2018-05-23 10:47:12 +02:00
|
|
|
|
2025-04-22 11:22:18 +02:00
|
|
|
iimg->rect = MEM_malloc_arrayN<uint8_t>(size * size * sizeof(uint), __func__);
|
2018-05-23 10:47:12 +02:00
|
|
|
|
2013-01-22 11:18:41 +00:00
|
|
|
/* Here we store the rect in the icon - same as before */
|
2019-03-25 10:15:20 +11:00
|
|
|
if (size == bbuf->x && size == bbuf->y && xofs == 0 && yofs == 0) {
|
2023-05-18 10:19:01 +02:00
|
|
|
memcpy(iimg->rect, bbuf->byte_buffer.data, size * size * 4 * sizeof(uint8_t));
|
2019-03-25 10:15:20 +11:00
|
|
|
}
|
2013-01-22 11:18:41 +00:00
|
|
|
else {
|
|
|
|
|
/* this code assumes square images */
|
|
|
|
|
imgsize = bbuf->x;
|
|
|
|
|
for (y = 0; y < size; y++) {
|
2023-05-18 10:19:01 +02:00
|
|
|
memcpy(&iimg->rect[y * size],
|
|
|
|
|
&bbuf->byte_buffer.data[(y + yofs) * imgsize + xofs],
|
|
|
|
|
size * 4 * sizeof(uint8_t));
|
2013-01-22 11:18:41 +00:00
|
|
|
}
|
|
|
|
|
}
|
Sorry, three commits in one, became difficult to untangle..
Editors Modules
* render/ module added in editors, moved the preview render code there and
also shading related operators.
* physics/ module made more consistent with other modules. renaming files,
making a single physics_ops.c for operators and keymaps. Also move all
particle related operators here now.
* space_buttons/ now should have only operators relevant to the buttons
specificially.
Updates & Notifiers
* Material/Texture/World/Lamp can now be passed to DAG_id_flush_update,
which will go back to a callback in editors. Eventually these should
be in the depsgraph itself, but for now this gives a unified call for
doing updates.
* GLSL materials are now refreshed on changes. There's still various
cases missing,
* Preview icons now hook into this system, solving various update cases
that were missed before.
* Also fixes issue in my last commit, where some preview would not render,
problem is avoided in the new system.
Icon Rendering
* On systems with support for non-power of two textures, an OpenGL texture
is now used instead of glDrawPixels. This avoids problems with icons get
clipped on region borders. On my Linux desktop, this gives an 1.1x speedup,
and on my Mac laptop a 2.3x speedup overall in redrawing the full window,
with the default setup. The glDrawPixels implementation on Mac seems to
have a lot of overhread.
* Preview icons are now drawn using proper premul alpha, and never faded so
you can see them clearly.
* Also tried to fix issue with texture node preview rendering, globals can't
be used with threads reliably.
2009-09-29 19:12:12 +00:00
|
|
|
}
|
|
|
|
|
di->data.buffer.image = iimg;
|
|
|
|
|
}
|
2008-11-25 18:27:41 +00:00
|
|
|
|
2008-11-25 19:23:54 +00:00
|
|
|
new_icon->drawinfo_free = UI_icons_free_drawinfo;
|
2008-11-25 18:27:41 +00:00
|
|
|
new_icon->drawinfo = di;
|
|
|
|
|
|
|
|
|
|
BKE_icon_set(icon_id, new_icon);
|
2018-05-23 10:47:12 +02:00
|
|
|
|
2013-01-22 11:18:41 +00:00
|
|
|
return di;
|
2008-11-25 18:27:41 +00:00
|
|
|
}
|
|
|
|
|
|
2012-03-30 01:51:25 +00:00
|
|
|
static void def_internal_vicon(int icon_id, VectorDrawFunc drawFunc)
|
2008-11-25 18:27:41 +00:00
|
|
|
{
|
2025-03-05 16:35:09 +01:00
|
|
|
Icon *new_icon = MEM_callocN<Icon>("texicon");
|
2008-11-25 18:27:41 +00:00
|
|
|
|
2022-12-29 12:01:32 -05:00
|
|
|
new_icon->obj = nullptr; /* icon is not for library object */
|
2018-04-19 12:52:32 +02:00
|
|
|
new_icon->id_type = 0;
|
2008-11-25 18:27:41 +00:00
|
|
|
|
2025-03-05 16:35:09 +01:00
|
|
|
DrawInfo *di = MEM_callocN<DrawInfo>("drawinfo");
|
2012-03-30 01:51:25 +00:00
|
|
|
di->type = ICON_TYPE_VECTOR;
|
2012-02-23 02:23:42 +00:00
|
|
|
di->data.vector.func = drawFunc;
|
2008-11-25 18:27:41 +00:00
|
|
|
|
2022-12-29 12:01:32 -05:00
|
|
|
new_icon->drawinfo_free = nullptr;
|
2008-11-25 18:27:41 +00:00
|
|
|
new_icon->drawinfo = di;
|
|
|
|
|
|
|
|
|
|
BKE_icon_set(icon_id, new_icon);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Vector Icon Drawing Routines */
|
|
|
|
|
|
2025-04-15 23:01:01 +02:00
|
|
|
static void vicon_rgb_color_draw(
|
|
|
|
|
float x, float y, float w, float h, const float color[4], float bg_alpha)
|
2025-03-21 01:57:32 +01:00
|
|
|
{
|
2025-04-15 23:01:01 +02:00
|
|
|
rctf rect = {x, x + w, y, y + h};
|
2025-03-21 01:57:32 +01:00
|
|
|
const float color_bg[4] = {color[0], color[1], color[2], bg_alpha};
|
|
|
|
|
UI_draw_roundbox_corner_set(UI_CNR_ALL);
|
2025-04-15 23:01:01 +02:00
|
|
|
UI_draw_roundbox_4fv_ex(&rect, color_bg, nullptr, 1.0f, color, U.pixelsize, 2.0f * UI_SCALE_FAC);
|
2025-03-21 01:57:32 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void vicon_rgb_text_draw(
|
2025-04-15 23:01:01 +02:00
|
|
|
float x, float y, float w, float h, const char *str, const uchar mono_rgba[4])
|
2025-03-21 01:57:32 +01:00
|
|
|
{
|
|
|
|
|
const int font_id = BLF_default();
|
|
|
|
|
const size_t len = strlen(str);
|
|
|
|
|
BLF_size(font_id, float(h - 3 * UI_SCALE_FAC));
|
|
|
|
|
float width, height;
|
|
|
|
|
BLF_width_and_height(font_id, str, len, &width, &height);
|
2025-04-15 23:01:01 +02:00
|
|
|
const float pos_x = x + (w - width) / 2.0f;
|
|
|
|
|
const float pos_y = y + (h - height) / 2.0f;
|
2025-03-21 01:57:32 +01:00
|
|
|
BLF_position(font_id, pos_x, pos_y, 0);
|
|
|
|
|
BLF_color4ubv(font_id, mono_rgba);
|
|
|
|
|
BLF_draw(font_id, str, len);
|
|
|
|
|
}
|
|
|
|
|
|
2025-04-15 23:01:01 +02:00
|
|
|
static void vicon_rgb_red_draw(
|
|
|
|
|
float x, float y, float w, float h, float alpha, const uchar mono_rgba[4])
|
2025-03-21 01:57:32 +01:00
|
|
|
{
|
|
|
|
|
const float color[4] = {0.5f, 0.0f, 0.0f, 1.0f * alpha};
|
|
|
|
|
vicon_rgb_color_draw(x, y, w, h, color, 0.25f * alpha);
|
|
|
|
|
const char *text = TIP_("R");
|
|
|
|
|
vicon_rgb_text_draw(x, y, w, h, text, mono_rgba);
|
|
|
|
|
}
|
|
|
|
|
|
2025-04-15 23:01:01 +02:00
|
|
|
static void vicon_rgb_green_draw(
|
|
|
|
|
float x, float y, float w, float h, float alpha, const uchar mono_rgba[4])
|
2025-03-21 01:57:32 +01:00
|
|
|
{
|
|
|
|
|
const float color[4] = {0.0f, 0.4f, 0.0f, 1.0f * alpha};
|
|
|
|
|
vicon_rgb_color_draw(x, y, w, h, color, 0.2f * alpha);
|
|
|
|
|
const char *text = TIP_("G");
|
|
|
|
|
vicon_rgb_text_draw(x, y, w, h, text, mono_rgba);
|
|
|
|
|
}
|
|
|
|
|
|
2025-04-15 23:01:01 +02:00
|
|
|
static void vicon_rgb_blue_draw(
|
|
|
|
|
float x, float y, float w, float h, float alpha, const uchar mono_rgba[4])
|
2025-03-21 01:57:32 +01:00
|
|
|
{
|
|
|
|
|
const float color[4] = {0.0f, 0.0f, 1.0f, 1.0f * alpha};
|
|
|
|
|
vicon_rgb_color_draw(x, y, w, h, color, 0.3f * alpha);
|
|
|
|
|
const char *text = TIP_("B");
|
|
|
|
|
vicon_rgb_text_draw(x, y, w, h, text, mono_rgba);
|
|
|
|
|
}
|
|
|
|
|
|
2012-03-30 01:51:25 +00:00
|
|
|
/* Utilities */
|
2008-11-25 18:27:41 +00:00
|
|
|
|
2025-04-15 23:01:01 +02:00
|
|
|
static void vicon_keytype_draw_wrapper(const float x,
|
|
|
|
|
const float y,
|
|
|
|
|
const float w,
|
|
|
|
|
const float h,
|
2024-04-05 11:53:57 +02:00
|
|
|
const float alpha,
|
|
|
|
|
const eBezTriple_KeyframeType key_type,
|
|
|
|
|
const short handle_type)
|
2016-03-14 00:56:52 +13:00
|
|
|
{
|
2021-07-26 12:32:42 +10:00
|
|
|
/* Initialize dummy theme state for Action Editor - where these colors are defined
|
|
|
|
|
* (since we're doing this off-screen, free from any particular space_id). */
|
2022-11-25 23:48:02 -06:00
|
|
|
bThemeState theme_state;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2016-03-14 00:56:52 +13:00
|
|
|
UI_Theme_Store(&theme_state);
|
|
|
|
|
UI_SetTheme(SPACE_ACTION, RGN_TYPE_WINDOW);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2021-07-26 12:32:42 +10:00
|
|
|
/* The "x" and "y" given are the bottom-left coordinates of the icon,
|
|
|
|
|
* while the #draw_keyframe_shape() function needs the midpoint for the keyframe. */
|
2025-04-15 23:01:01 +02:00
|
|
|
const float xco = x + (w / 2.0f) + 0.5f;
|
|
|
|
|
const float yco = y + (h / 2.0f) + 0.5f;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-07-18 00:12:21 +02:00
|
|
|
GPUVertFormat *format = immVertexFormat();
|
2021-08-13 09:37:38 +02:00
|
|
|
KeyframeShaderBindings sh_bindings;
|
|
|
|
|
sh_bindings.pos_id = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
|
|
|
|
|
sh_bindings.size_id = GPU_vertformat_attr_add(format, "size", GPU_COMP_F32, 1, GPU_FETCH_FLOAT);
|
|
|
|
|
sh_bindings.color_id = GPU_vertformat_attr_add(
|
2018-07-18 00:12:21 +02:00
|
|
|
format, "color", GPU_COMP_U8, 4, GPU_FETCH_INT_TO_FLOAT_UNIT);
|
2021-08-13 09:37:38 +02:00
|
|
|
sh_bindings.outline_color_id = GPU_vertformat_attr_add(
|
2018-07-18 00:12:21 +02:00
|
|
|
format, "outlineColor", GPU_COMP_U8, 4, GPU_FETCH_INT_TO_FLOAT_UNIT);
|
2021-08-13 09:37:38 +02:00
|
|
|
sh_bindings.flags_id = GPU_vertformat_attr_add(format, "flags", GPU_COMP_U32, 1, GPU_FETCH_INT);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-05-28 17:14:22 +02:00
|
|
|
GPU_program_point_size(true);
|
2021-09-23 15:53:38 +02:00
|
|
|
immBindBuiltinProgram(GPU_SHADER_KEYFRAME_SHAPE);
|
2019-08-22 11:10:11 +02:00
|
|
|
immUniform1f("outline_scale", 1.0f);
|
Dope Sheet: new option to display keyframe interpolation mode and extremes.
With the new automatic handle algorithm, it is possible to do a lot
of the animation via keyframes without touching the curves. It is
however necessary to change the keyframe interpolation and handle
types in certain cases. Currently the dopesheet/action editor
allows changing the types, but does not show them in any way.
To fix, add a new menu option to display this information. For handle
type, it is represented using the shape of the key icons: diamond for
Free, clipped diamond for Aligned, square for Vector, circle for Auto
Clamp, and cirle with dot for Automatic.
Non-bezier interpolation is a property of intervals between keys,
so it is marked by drawing lines, similar to holds. In this initial
version, only the fact of non-bezier interpolation is displayed,
without distinguishing types. For summaries, the line is drawn at
half alpha if not all curves in the group are non-bezier.
In addition, it is sometimes helpful to know the general direction
of change of the curve, and which keys are extremes. This commit
also adds an option to highlight extremes, based on comparing the
keyed values with adjacent keys. Half-intensity display is used
for overshot bezier extremes, or non-uniform summaries.
Reviewers: brecht, aligorith, billreynish
Differential Revision: https://developer.blender.org/D3788
2018-10-19 18:55:19 +03:00
|
|
|
immUniform2f("ViewportSize", -1.0f, -1.0f);
|
2018-07-18 00:12:21 +02:00
|
|
|
immBegin(GPU_PRIM_POINTS, 1);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2016-03-14 00:56:52 +13:00
|
|
|
/* draw keyframe
|
2025-03-21 00:51:50 +00:00
|
|
|
* - size: (default icon size == 16, default dope-sheet icon size == 10)
|
|
|
|
|
* - sel: true unless in handle-type icons
|
|
|
|
|
* (so that "keyframe" state shows the iconic yellow icon).
|
2016-03-14 00:56:52 +13:00
|
|
|
*/
|
2020-08-26 10:11:13 +10:00
|
|
|
const bool sel = (handle_type == KEYFRAME_HANDLE_NONE);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
Dope Sheet: new option to display keyframe interpolation mode and extremes.
With the new automatic handle algorithm, it is possible to do a lot
of the animation via keyframes without touching the curves. It is
however necessary to change the keyframe interpolation and handle
types in certain cases. Currently the dopesheet/action editor
allows changing the types, but does not show them in any way.
To fix, add a new menu option to display this information. For handle
type, it is represented using the shape of the key icons: diamond for
Free, clipped diamond for Aligned, square for Vector, circle for Auto
Clamp, and cirle with dot for Automatic.
Non-bezier interpolation is a property of intervals between keys,
so it is marked by drawing lines, similar to holds. In this initial
version, only the fact of non-bezier interpolation is displayed,
without distinguishing types. For summaries, the line is drawn at
half alpha if not all curves in the group are non-bezier.
In addition, it is sometimes helpful to know the general direction
of change of the curve, and which keys are extremes. This commit
also adds an option to highlight extremes, based on comparing the
keyed values with adjacent keys. Half-intensity display is used
for overshot bezier extremes, or non-uniform summaries.
Reviewers: brecht, aligorith, billreynish
Differential Revision: https://developer.blender.org/D3788
2018-10-19 18:55:19 +03:00
|
|
|
draw_keyframe_shape(xco,
|
|
|
|
|
yco,
|
|
|
|
|
(10.0f / 16.0f) * h,
|
|
|
|
|
sel,
|
|
|
|
|
key_type,
|
|
|
|
|
KEYFRAME_SHAPE_BOTH,
|
|
|
|
|
alpha,
|
2021-08-13 09:37:38 +02:00
|
|
|
&sh_bindings,
|
Dope Sheet: new option to display keyframe interpolation mode and extremes.
With the new automatic handle algorithm, it is possible to do a lot
of the animation via keyframes without touching the curves. It is
however necessary to change the keyframe interpolation and handle
types in certain cases. Currently the dopesheet/action editor
allows changing the types, but does not show them in any way.
To fix, add a new menu option to display this information. For handle
type, it is represented using the shape of the key icons: diamond for
Free, clipped diamond for Aligned, square for Vector, circle for Auto
Clamp, and cirle with dot for Automatic.
Non-bezier interpolation is a property of intervals between keys,
so it is marked by drawing lines, similar to holds. In this initial
version, only the fact of non-bezier interpolation is displayed,
without distinguishing types. For summaries, the line is drawn at
half alpha if not all curves in the group are non-bezier.
In addition, it is sometimes helpful to know the general direction
of change of the curve, and which keys are extremes. This commit
also adds an option to highlight extremes, based on comparing the
keyed values with adjacent keys. Half-intensity display is used
for overshot bezier extremes, or non-uniform summaries.
Reviewers: brecht, aligorith, billreynish
Differential Revision: https://developer.blender.org/D3788
2018-10-19 18:55:19 +03:00
|
|
|
handle_type,
|
|
|
|
|
KEYFRAME_EXTREME_NONE);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2017-02-11 00:24:59 -05:00
|
|
|
immEnd();
|
2019-05-28 17:14:22 +02:00
|
|
|
GPU_program_point_size(false);
|
2017-02-11 00:24:59 -05:00
|
|
|
immUnbindProgram();
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2016-03-14 00:56:52 +13:00
|
|
|
UI_Theme_Restore(&theme_state);
|
|
|
|
|
}
|
|
|
|
|
|
2025-03-21 01:57:32 +01:00
|
|
|
static void vicon_keytype_keyframe_draw(
|
2025-04-15 23:01:01 +02:00
|
|
|
float x, float y, float w, float h, float alpha, const uchar * /*mono_rgba[4]*/)
|
2016-03-14 00:56:52 +13:00
|
|
|
{
|
Dope Sheet: new option to display keyframe interpolation mode and extremes.
With the new automatic handle algorithm, it is possible to do a lot
of the animation via keyframes without touching the curves. It is
however necessary to change the keyframe interpolation and handle
types in certain cases. Currently the dopesheet/action editor
allows changing the types, but does not show them in any way.
To fix, add a new menu option to display this information. For handle
type, it is represented using the shape of the key icons: diamond for
Free, clipped diamond for Aligned, square for Vector, circle for Auto
Clamp, and cirle with dot for Automatic.
Non-bezier interpolation is a property of intervals between keys,
so it is marked by drawing lines, similar to holds. In this initial
version, only the fact of non-bezier interpolation is displayed,
without distinguishing types. For summaries, the line is drawn at
half alpha if not all curves in the group are non-bezier.
In addition, it is sometimes helpful to know the general direction
of change of the curve, and which keys are extremes. This commit
also adds an option to highlight extremes, based on comparing the
keyed values with adjacent keys. Half-intensity display is used
for overshot bezier extremes, or non-uniform summaries.
Reviewers: brecht, aligorith, billreynish
Differential Revision: https://developer.blender.org/D3788
2018-10-19 18:55:19 +03:00
|
|
|
vicon_keytype_draw_wrapper(x, y, w, h, alpha, BEZT_KEYTYPE_KEYFRAME, KEYFRAME_HANDLE_NONE);
|
2016-03-14 00:56:52 +13:00
|
|
|
}
|
|
|
|
|
|
2025-03-21 01:57:32 +01:00
|
|
|
static void vicon_keytype_breakdown_draw(
|
2025-04-15 23:01:01 +02:00
|
|
|
float x, float y, float w, float h, float alpha, const uchar * /*mono_rgba[4]*/)
|
2016-03-14 00:56:52 +13:00
|
|
|
{
|
Dope Sheet: new option to display keyframe interpolation mode and extremes.
With the new automatic handle algorithm, it is possible to do a lot
of the animation via keyframes without touching the curves. It is
however necessary to change the keyframe interpolation and handle
types in certain cases. Currently the dopesheet/action editor
allows changing the types, but does not show them in any way.
To fix, add a new menu option to display this information. For handle
type, it is represented using the shape of the key icons: diamond for
Free, clipped diamond for Aligned, square for Vector, circle for Auto
Clamp, and cirle with dot for Automatic.
Non-bezier interpolation is a property of intervals between keys,
so it is marked by drawing lines, similar to holds. In this initial
version, only the fact of non-bezier interpolation is displayed,
without distinguishing types. For summaries, the line is drawn at
half alpha if not all curves in the group are non-bezier.
In addition, it is sometimes helpful to know the general direction
of change of the curve, and which keys are extremes. This commit
also adds an option to highlight extremes, based on comparing the
keyed values with adjacent keys. Half-intensity display is used
for overshot bezier extremes, or non-uniform summaries.
Reviewers: brecht, aligorith, billreynish
Differential Revision: https://developer.blender.org/D3788
2018-10-19 18:55:19 +03:00
|
|
|
vicon_keytype_draw_wrapper(x, y, w, h, alpha, BEZT_KEYTYPE_BREAKDOWN, KEYFRAME_HANDLE_NONE);
|
2016-03-14 00:56:52 +13:00
|
|
|
}
|
|
|
|
|
|
2025-03-21 01:57:32 +01:00
|
|
|
static void vicon_keytype_extreme_draw(
|
2025-04-15 23:01:01 +02:00
|
|
|
float x, float y, float w, float h, float alpha, const uchar * /*mono_rgba[4]*/)
|
2016-03-14 00:56:52 +13:00
|
|
|
{
|
Dope Sheet: new option to display keyframe interpolation mode and extremes.
With the new automatic handle algorithm, it is possible to do a lot
of the animation via keyframes without touching the curves. It is
however necessary to change the keyframe interpolation and handle
types in certain cases. Currently the dopesheet/action editor
allows changing the types, but does not show them in any way.
To fix, add a new menu option to display this information. For handle
type, it is represented using the shape of the key icons: diamond for
Free, clipped diamond for Aligned, square for Vector, circle for Auto
Clamp, and cirle with dot for Automatic.
Non-bezier interpolation is a property of intervals between keys,
so it is marked by drawing lines, similar to holds. In this initial
version, only the fact of non-bezier interpolation is displayed,
without distinguishing types. For summaries, the line is drawn at
half alpha if not all curves in the group are non-bezier.
In addition, it is sometimes helpful to know the general direction
of change of the curve, and which keys are extremes. This commit
also adds an option to highlight extremes, based on comparing the
keyed values with adjacent keys. Half-intensity display is used
for overshot bezier extremes, or non-uniform summaries.
Reviewers: brecht, aligorith, billreynish
Differential Revision: https://developer.blender.org/D3788
2018-10-19 18:55:19 +03:00
|
|
|
vicon_keytype_draw_wrapper(x, y, w, h, alpha, BEZT_KEYTYPE_EXTREME, KEYFRAME_HANDLE_NONE);
|
2016-03-14 00:56:52 +13:00
|
|
|
}
|
|
|
|
|
|
2025-03-21 01:57:32 +01:00
|
|
|
static void vicon_keytype_jitter_draw(
|
2025-04-15 23:01:01 +02:00
|
|
|
float x, float y, float w, float h, float alpha, const uchar * /*mono_rgba[4]*/)
|
2016-03-14 00:56:52 +13:00
|
|
|
{
|
Dope Sheet: new option to display keyframe interpolation mode and extremes.
With the new automatic handle algorithm, it is possible to do a lot
of the animation via keyframes without touching the curves. It is
however necessary to change the keyframe interpolation and handle
types in certain cases. Currently the dopesheet/action editor
allows changing the types, but does not show them in any way.
To fix, add a new menu option to display this information. For handle
type, it is represented using the shape of the key icons: diamond for
Free, clipped diamond for Aligned, square for Vector, circle for Auto
Clamp, and cirle with dot for Automatic.
Non-bezier interpolation is a property of intervals between keys,
so it is marked by drawing lines, similar to holds. In this initial
version, only the fact of non-bezier interpolation is displayed,
without distinguishing types. For summaries, the line is drawn at
half alpha if not all curves in the group are non-bezier.
In addition, it is sometimes helpful to know the general direction
of change of the curve, and which keys are extremes. This commit
also adds an option to highlight extremes, based on comparing the
keyed values with adjacent keys. Half-intensity display is used
for overshot bezier extremes, or non-uniform summaries.
Reviewers: brecht, aligorith, billreynish
Differential Revision: https://developer.blender.org/D3788
2018-10-19 18:55:19 +03:00
|
|
|
vicon_keytype_draw_wrapper(x, y, w, h, alpha, BEZT_KEYTYPE_JITTER, KEYFRAME_HANDLE_NONE);
|
2016-03-14 00:56:52 +13:00
|
|
|
}
|
|
|
|
|
|
2025-03-21 01:57:32 +01:00
|
|
|
static void vicon_keytype_moving_hold_draw(
|
2025-04-15 23:01:01 +02:00
|
|
|
float x, float y, float w, float h, float alpha, const uchar * /*mono_rgba[4]*/)
|
2016-07-07 23:37:15 +12:00
|
|
|
{
|
Dope Sheet: new option to display keyframe interpolation mode and extremes.
With the new automatic handle algorithm, it is possible to do a lot
of the animation via keyframes without touching the curves. It is
however necessary to change the keyframe interpolation and handle
types in certain cases. Currently the dopesheet/action editor
allows changing the types, but does not show them in any way.
To fix, add a new menu option to display this information. For handle
type, it is represented using the shape of the key icons: diamond for
Free, clipped diamond for Aligned, square for Vector, circle for Auto
Clamp, and cirle with dot for Automatic.
Non-bezier interpolation is a property of intervals between keys,
so it is marked by drawing lines, similar to holds. In this initial
version, only the fact of non-bezier interpolation is displayed,
without distinguishing types. For summaries, the line is drawn at
half alpha if not all curves in the group are non-bezier.
In addition, it is sometimes helpful to know the general direction
of change of the curve, and which keys are extremes. This commit
also adds an option to highlight extremes, based on comparing the
keyed values with adjacent keys. Half-intensity display is used
for overshot bezier extremes, or non-uniform summaries.
Reviewers: brecht, aligorith, billreynish
Differential Revision: https://developer.blender.org/D3788
2018-10-19 18:55:19 +03:00
|
|
|
vicon_keytype_draw_wrapper(x, y, w, h, alpha, BEZT_KEYTYPE_MOVEHOLD, KEYFRAME_HANDLE_NONE);
|
|
|
|
|
}
|
|
|
|
|
|
2025-03-21 01:57:32 +01:00
|
|
|
static void vicon_keytype_generated_draw(
|
2025-04-15 23:01:01 +02:00
|
|
|
float x, float y, float w, float h, float alpha, const uchar * /*mono_rgba[4]*/)
|
2024-04-15 10:42:54 +02:00
|
|
|
{
|
|
|
|
|
vicon_keytype_draw_wrapper(x, y, w, h, alpha, BEZT_KEYTYPE_GENERATED, KEYFRAME_HANDLE_NONE);
|
|
|
|
|
}
|
|
|
|
|
|
2025-03-21 01:57:32 +01:00
|
|
|
static void vicon_handletype_free_draw(
|
2025-04-15 23:01:01 +02:00
|
|
|
float x, float y, float w, float h, float alpha, const uchar * /*mono_rgba[4]*/)
|
Dope Sheet: new option to display keyframe interpolation mode and extremes.
With the new automatic handle algorithm, it is possible to do a lot
of the animation via keyframes without touching the curves. It is
however necessary to change the keyframe interpolation and handle
types in certain cases. Currently the dopesheet/action editor
allows changing the types, but does not show them in any way.
To fix, add a new menu option to display this information. For handle
type, it is represented using the shape of the key icons: diamond for
Free, clipped diamond for Aligned, square for Vector, circle for Auto
Clamp, and cirle with dot for Automatic.
Non-bezier interpolation is a property of intervals between keys,
so it is marked by drawing lines, similar to holds. In this initial
version, only the fact of non-bezier interpolation is displayed,
without distinguishing types. For summaries, the line is drawn at
half alpha if not all curves in the group are non-bezier.
In addition, it is sometimes helpful to know the general direction
of change of the curve, and which keys are extremes. This commit
also adds an option to highlight extremes, based on comparing the
keyed values with adjacent keys. Half-intensity display is used
for overshot bezier extremes, or non-uniform summaries.
Reviewers: brecht, aligorith, billreynish
Differential Revision: https://developer.blender.org/D3788
2018-10-19 18:55:19 +03:00
|
|
|
{
|
|
|
|
|
vicon_keytype_draw_wrapper(x, y, w, h, alpha, BEZT_KEYTYPE_KEYFRAME, KEYFRAME_HANDLE_FREE);
|
|
|
|
|
}
|
|
|
|
|
|
2025-03-21 01:57:32 +01:00
|
|
|
static void vicon_handletype_aligned_draw(
|
2025-04-15 23:01:01 +02:00
|
|
|
float x, float y, float w, float h, float alpha, const uchar * /*mono_rgba[4]*/)
|
Dope Sheet: new option to display keyframe interpolation mode and extremes.
With the new automatic handle algorithm, it is possible to do a lot
of the animation via keyframes without touching the curves. It is
however necessary to change the keyframe interpolation and handle
types in certain cases. Currently the dopesheet/action editor
allows changing the types, but does not show them in any way.
To fix, add a new menu option to display this information. For handle
type, it is represented using the shape of the key icons: diamond for
Free, clipped diamond for Aligned, square for Vector, circle for Auto
Clamp, and cirle with dot for Automatic.
Non-bezier interpolation is a property of intervals between keys,
so it is marked by drawing lines, similar to holds. In this initial
version, only the fact of non-bezier interpolation is displayed,
without distinguishing types. For summaries, the line is drawn at
half alpha if not all curves in the group are non-bezier.
In addition, it is sometimes helpful to know the general direction
of change of the curve, and which keys are extremes. This commit
also adds an option to highlight extremes, based on comparing the
keyed values with adjacent keys. Half-intensity display is used
for overshot bezier extremes, or non-uniform summaries.
Reviewers: brecht, aligorith, billreynish
Differential Revision: https://developer.blender.org/D3788
2018-10-19 18:55:19 +03:00
|
|
|
{
|
|
|
|
|
vicon_keytype_draw_wrapper(x, y, w, h, alpha, BEZT_KEYTYPE_KEYFRAME, KEYFRAME_HANDLE_ALIGNED);
|
|
|
|
|
}
|
|
|
|
|
|
2025-03-21 01:57:32 +01:00
|
|
|
static void vicon_handletype_vector_draw(
|
2025-04-15 23:01:01 +02:00
|
|
|
float x, float y, float w, float h, float alpha, const uchar * /*mono_rgba[4]*/)
|
Dope Sheet: new option to display keyframe interpolation mode and extremes.
With the new automatic handle algorithm, it is possible to do a lot
of the animation via keyframes without touching the curves. It is
however necessary to change the keyframe interpolation and handle
types in certain cases. Currently the dopesheet/action editor
allows changing the types, but does not show them in any way.
To fix, add a new menu option to display this information. For handle
type, it is represented using the shape of the key icons: diamond for
Free, clipped diamond for Aligned, square for Vector, circle for Auto
Clamp, and cirle with dot for Automatic.
Non-bezier interpolation is a property of intervals between keys,
so it is marked by drawing lines, similar to holds. In this initial
version, only the fact of non-bezier interpolation is displayed,
without distinguishing types. For summaries, the line is drawn at
half alpha if not all curves in the group are non-bezier.
In addition, it is sometimes helpful to know the general direction
of change of the curve, and which keys are extremes. This commit
also adds an option to highlight extremes, based on comparing the
keyed values with adjacent keys. Half-intensity display is used
for overshot bezier extremes, or non-uniform summaries.
Reviewers: brecht, aligorith, billreynish
Differential Revision: https://developer.blender.org/D3788
2018-10-19 18:55:19 +03:00
|
|
|
{
|
|
|
|
|
vicon_keytype_draw_wrapper(x, y, w, h, alpha, BEZT_KEYTYPE_KEYFRAME, KEYFRAME_HANDLE_VECTOR);
|
|
|
|
|
}
|
|
|
|
|
|
2025-03-21 01:57:32 +01:00
|
|
|
static void vicon_handletype_auto_draw(
|
2025-04-15 23:01:01 +02:00
|
|
|
float x, float y, float w, float h, float alpha, const uchar * /*mono_rgba[4]*/)
|
Dope Sheet: new option to display keyframe interpolation mode and extremes.
With the new automatic handle algorithm, it is possible to do a lot
of the animation via keyframes without touching the curves. It is
however necessary to change the keyframe interpolation and handle
types in certain cases. Currently the dopesheet/action editor
allows changing the types, but does not show them in any way.
To fix, add a new menu option to display this information. For handle
type, it is represented using the shape of the key icons: diamond for
Free, clipped diamond for Aligned, square for Vector, circle for Auto
Clamp, and cirle with dot for Automatic.
Non-bezier interpolation is a property of intervals between keys,
so it is marked by drawing lines, similar to holds. In this initial
version, only the fact of non-bezier interpolation is displayed,
without distinguishing types. For summaries, the line is drawn at
half alpha if not all curves in the group are non-bezier.
In addition, it is sometimes helpful to know the general direction
of change of the curve, and which keys are extremes. This commit
also adds an option to highlight extremes, based on comparing the
keyed values with adjacent keys. Half-intensity display is used
for overshot bezier extremes, or non-uniform summaries.
Reviewers: brecht, aligorith, billreynish
Differential Revision: https://developer.blender.org/D3788
2018-10-19 18:55:19 +03:00
|
|
|
{
|
|
|
|
|
vicon_keytype_draw_wrapper(x, y, w, h, alpha, BEZT_KEYTYPE_KEYFRAME, KEYFRAME_HANDLE_AUTO);
|
|
|
|
|
}
|
|
|
|
|
|
2025-03-21 01:57:32 +01:00
|
|
|
static void vicon_handletype_auto_clamp_draw(
|
2025-04-15 23:01:01 +02:00
|
|
|
float x, float y, float w, float h, float alpha, const uchar * /*mono_rgba[4]*/)
|
Dope Sheet: new option to display keyframe interpolation mode and extremes.
With the new automatic handle algorithm, it is possible to do a lot
of the animation via keyframes without touching the curves. It is
however necessary to change the keyframe interpolation and handle
types in certain cases. Currently the dopesheet/action editor
allows changing the types, but does not show them in any way.
To fix, add a new menu option to display this information. For handle
type, it is represented using the shape of the key icons: diamond for
Free, clipped diamond for Aligned, square for Vector, circle for Auto
Clamp, and cirle with dot for Automatic.
Non-bezier interpolation is a property of intervals between keys,
so it is marked by drawing lines, similar to holds. In this initial
version, only the fact of non-bezier interpolation is displayed,
without distinguishing types. For summaries, the line is drawn at
half alpha if not all curves in the group are non-bezier.
In addition, it is sometimes helpful to know the general direction
of change of the curve, and which keys are extremes. This commit
also adds an option to highlight extremes, based on comparing the
keyed values with adjacent keys. Half-intensity display is used
for overshot bezier extremes, or non-uniform summaries.
Reviewers: brecht, aligorith, billreynish
Differential Revision: https://developer.blender.org/D3788
2018-10-19 18:55:19 +03:00
|
|
|
{
|
|
|
|
|
vicon_keytype_draw_wrapper(x, y, w, h, alpha, BEZT_KEYTYPE_KEYFRAME, KEYFRAME_HANDLE_AUTO_CLAMP);
|
2016-07-07 23:37:15 +12:00
|
|
|
}
|
|
|
|
|
|
2025-04-15 23:01:01 +02:00
|
|
|
static void icon_node_socket_draw(
|
|
|
|
|
int socket_type, float x, float y, float w, float h, float /*alpha*/)
|
2025-03-25 18:11:27 +01:00
|
|
|
{
|
|
|
|
|
/* Factor to account for the draw function of the node socket being based on the widget unit,
|
2025-03-27 01:13:34 +00:00
|
|
|
* which is 10 pixels by default, which differs from icons. */
|
2025-03-25 18:11:27 +01:00
|
|
|
constexpr float size_factor = 10.0f / float(ICON_DEFAULT_WIDTH);
|
|
|
|
|
|
|
|
|
|
const float socket_radius = w * 0.5f * size_factor;
|
|
|
|
|
const blender::float2 center = {x + 0.5f * w, y + 0.5f * h};
|
|
|
|
|
const rctf rect = {
|
|
|
|
|
center.x - socket_radius,
|
|
|
|
|
center.x + socket_radius,
|
|
|
|
|
center.y - socket_radius,
|
|
|
|
|
center.y + socket_radius,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
float color_inner[4];
|
|
|
|
|
blender::ed::space_node::std_node_socket_colors_get(socket_type, color_inner);
|
|
|
|
|
|
|
|
|
|
float color_outer[4] = {0.0f, 0.0f, 0.0f, 1.0f};
|
|
|
|
|
|
|
|
|
|
blender::ed::space_node::node_draw_nodesocket(
|
|
|
|
|
&rect, color_inner, color_outer, U.pixelsize, SOCK_DISPLAY_SHAPE_CIRCLE, 1.0f);
|
|
|
|
|
}
|
|
|
|
|
|
2022-12-20 15:51:47 -03:00
|
|
|
static void vicon_colorset_draw(int index, int x, int y, int w, int h, float /*alpha*/)
|
2016-05-19 03:25:00 +12:00
|
|
|
{
|
|
|
|
|
bTheme *btheme = UI_GetTheme();
|
2019-08-06 04:20:17 +10:00
|
|
|
const ThemeWireColor *cs = &btheme->tarm[index];
|
2017-02-11 00:24:59 -05:00
|
|
|
|
2016-05-19 03:25:00 +12:00
|
|
|
/* Draw three bands of color: One per color
|
|
|
|
|
* x-----a-----b-----c
|
|
|
|
|
* | N | S | A |
|
|
|
|
|
* x-----a-----b-----c
|
|
|
|
|
*/
|
|
|
|
|
const int a = x + w / 3;
|
|
|
|
|
const int b = x + w / 3 * 2;
|
|
|
|
|
const int c = x + w;
|
2017-02-11 00:24:59 -05:00
|
|
|
|
2018-07-18 00:12:21 +02:00
|
|
|
uint pos = GPU_vertformat_attr_add(
|
|
|
|
|
immVertexFormat(), "pos", GPU_COMP_I32, 2, GPU_FETCH_INT_TO_FLOAT);
|
2022-09-01 09:31:07 -03:00
|
|
|
immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);
|
2017-02-11 00:24:59 -05:00
|
|
|
|
2016-05-19 03:25:00 +12:00
|
|
|
/* XXX: Include alpha into this... */
|
|
|
|
|
/* normal */
|
2019-08-06 04:20:17 +10:00
|
|
|
immUniformColor3ubv(cs->solid);
|
2017-02-11 00:24:59 -05:00
|
|
|
immRecti(pos, x, y, a, y + h);
|
|
|
|
|
|
2016-05-19 03:25:00 +12:00
|
|
|
/* selected */
|
2019-08-06 04:20:17 +10:00
|
|
|
immUniformColor3ubv(cs->select);
|
2017-02-11 00:24:59 -05:00
|
|
|
immRecti(pos, a, y, b, y + h);
|
|
|
|
|
|
2016-05-19 03:25:00 +12:00
|
|
|
/* active */
|
2019-08-06 04:20:17 +10:00
|
|
|
immUniformColor3ubv(cs->active);
|
2017-02-11 00:24:59 -05:00
|
|
|
immRecti(pos, b, y, c, y + h);
|
|
|
|
|
|
|
|
|
|
immUnbindProgram();
|
2016-05-19 03:25:00 +12:00
|
|
|
}
|
|
|
|
|
|
2018-09-20 18:07:58 +02:00
|
|
|
# define DEF_ICON_VECTOR_COLORSET_DRAW_NTH(prefix, index) \
|
2025-03-21 01:57:32 +01:00
|
|
|
static void vicon_colorset_draw_##prefix( \
|
2025-04-15 23:01:01 +02:00
|
|
|
float x, float y, float w, float h, float alpha, const uchar * /*mono_rgba[4]*/) \
|
2016-05-19 03:25:00 +12:00
|
|
|
{ \
|
2025-04-15 23:01:01 +02:00
|
|
|
vicon_colorset_draw(index, int(x), int(y), int(w), int(h), alpha); \
|
2016-05-19 03:25:00 +12:00
|
|
|
}
|
2018-05-23 10:47:12 +02:00
|
|
|
|
2018-09-20 18:07:58 +02:00
|
|
|
DEF_ICON_VECTOR_COLORSET_DRAW_NTH(01, 0)
|
|
|
|
|
DEF_ICON_VECTOR_COLORSET_DRAW_NTH(02, 1)
|
|
|
|
|
DEF_ICON_VECTOR_COLORSET_DRAW_NTH(03, 2)
|
|
|
|
|
DEF_ICON_VECTOR_COLORSET_DRAW_NTH(04, 3)
|
|
|
|
|
DEF_ICON_VECTOR_COLORSET_DRAW_NTH(05, 4)
|
|
|
|
|
DEF_ICON_VECTOR_COLORSET_DRAW_NTH(06, 5)
|
|
|
|
|
DEF_ICON_VECTOR_COLORSET_DRAW_NTH(07, 6)
|
|
|
|
|
DEF_ICON_VECTOR_COLORSET_DRAW_NTH(08, 7)
|
|
|
|
|
DEF_ICON_VECTOR_COLORSET_DRAW_NTH(09, 8)
|
|
|
|
|
DEF_ICON_VECTOR_COLORSET_DRAW_NTH(10, 9)
|
|
|
|
|
DEF_ICON_VECTOR_COLORSET_DRAW_NTH(11, 10)
|
|
|
|
|
DEF_ICON_VECTOR_COLORSET_DRAW_NTH(12, 11)
|
|
|
|
|
DEF_ICON_VECTOR_COLORSET_DRAW_NTH(13, 12)
|
|
|
|
|
DEF_ICON_VECTOR_COLORSET_DRAW_NTH(14, 13)
|
|
|
|
|
DEF_ICON_VECTOR_COLORSET_DRAW_NTH(15, 14)
|
|
|
|
|
DEF_ICON_VECTOR_COLORSET_DRAW_NTH(16, 15)
|
|
|
|
|
DEF_ICON_VECTOR_COLORSET_DRAW_NTH(17, 16)
|
|
|
|
|
DEF_ICON_VECTOR_COLORSET_DRAW_NTH(18, 17)
|
|
|
|
|
DEF_ICON_VECTOR_COLORSET_DRAW_NTH(19, 18)
|
|
|
|
|
DEF_ICON_VECTOR_COLORSET_DRAW_NTH(20, 19)
|
|
|
|
|
|
|
|
|
|
# undef DEF_ICON_VECTOR_COLORSET_DRAW_NTH
|
2016-05-19 03:25:00 +12:00
|
|
|
|
2020-09-15 12:13:03 -06:00
|
|
|
static void vicon_collection_color_draw(
|
2025-04-15 23:01:01 +02:00
|
|
|
short color_tag, float x, float y, float w, float /*h*/, float /*alpha*/)
|
2020-09-15 12:13:03 -06:00
|
|
|
{
|
|
|
|
|
bTheme *btheme = UI_GetTheme();
|
|
|
|
|
const ThemeCollectionColor *collection_color = &btheme->collection_color[color_tag];
|
|
|
|
|
|
2025-04-15 23:01:01 +02:00
|
|
|
const float aspect = float(ICON_DEFAULT_WIDTH) / w;
|
2021-04-07 08:41:36 -06:00
|
|
|
|
2022-10-20 16:37:07 +02:00
|
|
|
UI_icon_draw_ex(x,
|
|
|
|
|
y,
|
|
|
|
|
ICON_OUTLINER_COLLECTION,
|
|
|
|
|
aspect,
|
|
|
|
|
1.0f,
|
|
|
|
|
0.0f,
|
|
|
|
|
collection_color->color,
|
2024-06-27 23:00:53 +02:00
|
|
|
btheme->tui.icon_border_intensity > 0.0f,
|
2022-10-20 16:37:07 +02:00
|
|
|
UI_NO_ICON_OVERLAY_TEXT);
|
2020-09-15 12:13:03 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
# define DEF_ICON_COLLECTION_COLOR_DRAW(index, color) \
|
2025-03-21 01:57:32 +01:00
|
|
|
static void vicon_collection_color_draw_##index( \
|
2025-04-15 23:01:01 +02:00
|
|
|
float x, float y, float w, float h, float alpha, const uchar * /*mono_rgba[4]*/) \
|
2020-09-15 12:13:03 -06:00
|
|
|
{ \
|
|
|
|
|
vicon_collection_color_draw(color, x, y, w, h, alpha); \
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
DEF_ICON_COLLECTION_COLOR_DRAW(01, COLLECTION_COLOR_01);
|
|
|
|
|
DEF_ICON_COLLECTION_COLOR_DRAW(02, COLLECTION_COLOR_02);
|
|
|
|
|
DEF_ICON_COLLECTION_COLOR_DRAW(03, COLLECTION_COLOR_03);
|
|
|
|
|
DEF_ICON_COLLECTION_COLOR_DRAW(04, COLLECTION_COLOR_04);
|
|
|
|
|
DEF_ICON_COLLECTION_COLOR_DRAW(05, COLLECTION_COLOR_05);
|
|
|
|
|
DEF_ICON_COLLECTION_COLOR_DRAW(06, COLLECTION_COLOR_06);
|
|
|
|
|
DEF_ICON_COLLECTION_COLOR_DRAW(07, COLLECTION_COLOR_07);
|
|
|
|
|
DEF_ICON_COLLECTION_COLOR_DRAW(08, COLLECTION_COLOR_08);
|
|
|
|
|
|
|
|
|
|
# undef DEF_ICON_COLLECTION_COLOR_DRAW
|
|
|
|
|
|
2021-09-29 14:29:32 +02:00
|
|
|
static void vicon_strip_color_draw(
|
2025-04-15 23:01:01 +02:00
|
|
|
short color_tag, float x, float y, float w, float /*h*/, float /*alpha*/)
|
2021-09-29 14:29:32 +02:00
|
|
|
{
|
|
|
|
|
bTheme *btheme = UI_GetTheme();
|
|
|
|
|
const ThemeStripColor *strip_color = &btheme->strip_color[color_tag];
|
|
|
|
|
|
2025-04-15 23:01:01 +02:00
|
|
|
const float aspect = float(ICON_DEFAULT_WIDTH) / w;
|
2021-09-29 14:29:32 +02:00
|
|
|
|
2024-06-27 23:00:53 +02:00
|
|
|
UI_icon_draw_ex(x,
|
|
|
|
|
y,
|
|
|
|
|
ICON_SNAP_FACE,
|
|
|
|
|
aspect,
|
|
|
|
|
1.0f,
|
|
|
|
|
0.0f,
|
|
|
|
|
strip_color->color,
|
|
|
|
|
btheme->tui.icon_border_intensity > 0.0f,
|
|
|
|
|
UI_NO_ICON_OVERLAY_TEXT);
|
2021-09-29 14:29:32 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
# define DEF_ICON_STRIP_COLOR_DRAW(index, color) \
|
2025-03-21 01:57:32 +01:00
|
|
|
static void vicon_strip_color_draw_##index( \
|
2025-04-15 23:01:01 +02:00
|
|
|
float x, float y, float w, float h, float alpha, const uchar * /*mono_rgba[4]*/) \
|
2021-09-29 14:29:32 +02:00
|
|
|
{ \
|
|
|
|
|
vicon_strip_color_draw(color, x, y, w, h, alpha); \
|
|
|
|
|
}
|
|
|
|
|
|
2025-01-07 16:05:12 +01:00
|
|
|
DEF_ICON_STRIP_COLOR_DRAW(01, STRIP_COLOR_01);
|
|
|
|
|
DEF_ICON_STRIP_COLOR_DRAW(02, STRIP_COLOR_02);
|
|
|
|
|
DEF_ICON_STRIP_COLOR_DRAW(03, STRIP_COLOR_03);
|
|
|
|
|
DEF_ICON_STRIP_COLOR_DRAW(04, STRIP_COLOR_04);
|
|
|
|
|
DEF_ICON_STRIP_COLOR_DRAW(05, STRIP_COLOR_05);
|
|
|
|
|
DEF_ICON_STRIP_COLOR_DRAW(06, STRIP_COLOR_06);
|
|
|
|
|
DEF_ICON_STRIP_COLOR_DRAW(07, STRIP_COLOR_07);
|
|
|
|
|
DEF_ICON_STRIP_COLOR_DRAW(08, STRIP_COLOR_08);
|
|
|
|
|
DEF_ICON_STRIP_COLOR_DRAW(09, STRIP_COLOR_09);
|
2021-09-29 14:29:32 +02:00
|
|
|
|
|
|
|
|
# undef DEF_ICON_STRIP_COLOR_DRAW
|
|
|
|
|
|
2022-03-29 14:36:06 +02:00
|
|
|
# define ICON_INDIRECT_DATA_ALPHA 0.6f
|
|
|
|
|
|
|
|
|
|
static void vicon_strip_color_draw_library_data_indirect(
|
2025-04-15 23:01:01 +02:00
|
|
|
float x, float y, float w, float /*h*/, float alpha, const uchar * /*mono_rgba[4]*/)
|
2022-03-29 14:36:06 +02:00
|
|
|
{
|
2025-04-15 23:01:01 +02:00
|
|
|
const float aspect = float(ICON_DEFAULT_WIDTH) / w;
|
2022-03-29 14:36:06 +02:00
|
|
|
|
2022-10-20 16:37:07 +02:00
|
|
|
UI_icon_draw_ex(x,
|
|
|
|
|
y,
|
|
|
|
|
ICON_LIBRARY_DATA_DIRECT,
|
|
|
|
|
aspect,
|
|
|
|
|
ICON_INDIRECT_DATA_ALPHA * alpha,
|
|
|
|
|
0.0f,
|
2022-12-29 12:01:32 -05:00
|
|
|
nullptr,
|
2022-10-20 16:37:07 +02:00
|
|
|
false,
|
|
|
|
|
UI_NO_ICON_OVERLAY_TEXT);
|
2022-03-29 14:36:06 +02:00
|
|
|
}
|
|
|
|
|
|
2022-03-29 17:26:13 +02:00
|
|
|
static void vicon_strip_color_draw_library_data_override_noneditable(
|
2025-04-15 23:01:01 +02:00
|
|
|
float x, float y, float w, float /*h*/, float alpha, const uchar * /*mono_rgba[4]*/)
|
2022-03-29 17:26:13 +02:00
|
|
|
{
|
2025-04-15 23:01:01 +02:00
|
|
|
const float aspect = float(ICON_DEFAULT_WIDTH) / w;
|
2022-03-29 17:26:13 +02:00
|
|
|
|
|
|
|
|
UI_icon_draw_ex(x,
|
|
|
|
|
y,
|
|
|
|
|
ICON_LIBRARY_DATA_OVERRIDE,
|
|
|
|
|
aspect,
|
|
|
|
|
ICON_INDIRECT_DATA_ALPHA * alpha * 0.75f,
|
|
|
|
|
0.0f,
|
2022-12-29 12:01:32 -05:00
|
|
|
nullptr,
|
2022-10-20 16:37:07 +02:00
|
|
|
false,
|
|
|
|
|
UI_NO_ICON_OVERLAY_TEXT);
|
2022-03-29 17:26:13 +02:00
|
|
|
}
|
|
|
|
|
|
2024-06-11 18:25:01 +02:00
|
|
|
static void vicon_layergroup_color_draw(
|
2025-04-15 23:01:01 +02:00
|
|
|
short color_tag, float x, float y, float w, float /*h*/, float /*alpha*/)
|
2024-06-11 18:25:01 +02:00
|
|
|
{
|
|
|
|
|
bTheme *btheme = UI_GetTheme();
|
|
|
|
|
const ThemeCollectionColor *layergroup_color = &btheme->collection_color[color_tag];
|
|
|
|
|
|
2025-04-15 23:01:01 +02:00
|
|
|
const float aspect = float(ICON_DEFAULT_WIDTH) / w;
|
2024-06-11 18:25:01 +02:00
|
|
|
|
|
|
|
|
UI_icon_draw_ex(x,
|
|
|
|
|
y,
|
2024-09-27 17:24:40 +02:00
|
|
|
ICON_GREASEPENCIL_LAYER_GROUP,
|
2024-06-11 18:25:01 +02:00
|
|
|
aspect,
|
|
|
|
|
1.0f,
|
|
|
|
|
0.0f,
|
|
|
|
|
layergroup_color->color,
|
2024-06-27 23:00:53 +02:00
|
|
|
btheme->tui.icon_border_intensity > 0.0f,
|
2024-06-11 18:25:01 +02:00
|
|
|
UI_NO_ICON_OVERLAY_TEXT);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
# define DEF_ICON_LAYERGROUP_COLOR_DRAW(index, color) \
|
2025-03-21 01:57:32 +01:00
|
|
|
static void vicon_layergroup_color_draw_##index( \
|
2025-04-15 23:01:01 +02:00
|
|
|
float x, float y, float w, float h, float alpha, const uchar * /*mono_rgba[4]*/) \
|
2024-06-11 18:25:01 +02:00
|
|
|
{ \
|
|
|
|
|
vicon_layergroup_color_draw(color, x, y, w, h, alpha); \
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
DEF_ICON_LAYERGROUP_COLOR_DRAW(01, LAYERGROUP_COLOR_01);
|
|
|
|
|
DEF_ICON_LAYERGROUP_COLOR_DRAW(02, LAYERGROUP_COLOR_02);
|
|
|
|
|
DEF_ICON_LAYERGROUP_COLOR_DRAW(03, LAYERGROUP_COLOR_03);
|
|
|
|
|
DEF_ICON_LAYERGROUP_COLOR_DRAW(04, LAYERGROUP_COLOR_04);
|
|
|
|
|
DEF_ICON_LAYERGROUP_COLOR_DRAW(05, LAYERGROUP_COLOR_05);
|
|
|
|
|
DEF_ICON_LAYERGROUP_COLOR_DRAW(06, LAYERGROUP_COLOR_06);
|
|
|
|
|
DEF_ICON_LAYERGROUP_COLOR_DRAW(07, LAYERGROUP_COLOR_07);
|
|
|
|
|
DEF_ICON_LAYERGROUP_COLOR_DRAW(08, LAYERGROUP_COLOR_08);
|
|
|
|
|
|
|
|
|
|
# undef DEF_ICON_LAYERGROUP_COLOR_DRAW
|
2025-03-25 18:11:27 +01:00
|
|
|
|
|
|
|
|
# define DEF_ICON_NODE_SOCKET_DRAW(name, socket_type) \
|
|
|
|
|
static void icon_node_socket_draw_##name( \
|
2025-04-15 23:01:01 +02:00
|
|
|
float x, float y, float w, float h, float alpha, const uchar * /*mono_rgba[4]*/) \
|
2025-03-25 18:11:27 +01:00
|
|
|
{ \
|
|
|
|
|
icon_node_socket_draw(socket_type, x, y, w, h, alpha); \
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
DEF_ICON_NODE_SOCKET_DRAW(float, eNodeSocketDatatype::SOCK_FLOAT)
|
|
|
|
|
DEF_ICON_NODE_SOCKET_DRAW(vector, eNodeSocketDatatype::SOCK_VECTOR)
|
|
|
|
|
DEF_ICON_NODE_SOCKET_DRAW(rgba, eNodeSocketDatatype::SOCK_RGBA)
|
|
|
|
|
DEF_ICON_NODE_SOCKET_DRAW(shader, eNodeSocketDatatype::SOCK_SHADER)
|
|
|
|
|
DEF_ICON_NODE_SOCKET_DRAW(boolean, eNodeSocketDatatype::SOCK_BOOLEAN)
|
|
|
|
|
DEF_ICON_NODE_SOCKET_DRAW(int, eNodeSocketDatatype::SOCK_INT)
|
|
|
|
|
DEF_ICON_NODE_SOCKET_DRAW(string, eNodeSocketDatatype::SOCK_STRING)
|
|
|
|
|
DEF_ICON_NODE_SOCKET_DRAW(object, eNodeSocketDatatype::SOCK_OBJECT)
|
|
|
|
|
DEF_ICON_NODE_SOCKET_DRAW(image, eNodeSocketDatatype::SOCK_IMAGE)
|
|
|
|
|
DEF_ICON_NODE_SOCKET_DRAW(geometry, eNodeSocketDatatype::SOCK_GEOMETRY)
|
|
|
|
|
DEF_ICON_NODE_SOCKET_DRAW(collection, eNodeSocketDatatype::SOCK_COLLECTION)
|
|
|
|
|
DEF_ICON_NODE_SOCKET_DRAW(texture, eNodeSocketDatatype::SOCK_TEXTURE)
|
|
|
|
|
DEF_ICON_NODE_SOCKET_DRAW(material, eNodeSocketDatatype::SOCK_MATERIAL)
|
|
|
|
|
DEF_ICON_NODE_SOCKET_DRAW(rotation, eNodeSocketDatatype::SOCK_ROTATION)
|
|
|
|
|
DEF_ICON_NODE_SOCKET_DRAW(menu, eNodeSocketDatatype::SOCK_MENU)
|
|
|
|
|
DEF_ICON_NODE_SOCKET_DRAW(matrix, eNodeSocketDatatype::SOCK_MATRIX)
|
2025-04-03 15:44:06 +02:00
|
|
|
DEF_ICON_NODE_SOCKET_DRAW(bundle, eNodeSocketDatatype::SOCK_BUNDLE)
|
|
|
|
|
DEF_ICON_NODE_SOCKET_DRAW(closure, eNodeSocketDatatype::SOCK_CLOSURE)
|
2025-03-25 18:11:27 +01:00
|
|
|
|
2018-07-31 10:22:19 +02:00
|
|
|
/* Dynamically render icon instead of rendering a plain color to a texture/buffer
|
2019-08-01 13:53:25 +10:00
|
|
|
* This is not strictly a "vicon", as it needs access to icon->obj to get the color info,
|
2018-07-31 10:22:19 +02:00
|
|
|
* but it works in a very similar way.
|
|
|
|
|
*/
|
|
|
|
|
static void vicon_gplayer_color_draw(Icon *icon, int x, int y, int w, int h)
|
|
|
|
|
{
|
|
|
|
|
bGPDlayer *gpl = (bGPDlayer *)icon->obj;
|
|
|
|
|
|
|
|
|
|
/* Just draw a colored rect - Like for vicon_colorset_draw() */
|
|
|
|
|
/* TODO: Make this have rounded corners, and maybe be a bit smaller.
|
|
|
|
|
* However, UI_draw_roundbox_aa() draws the colors too dark, so can't be used.
|
|
|
|
|
*/
|
|
|
|
|
uint pos = GPU_vertformat_attr_add(
|
|
|
|
|
immVertexFormat(), "pos", GPU_COMP_I32, 2, GPU_FETCH_INT_TO_FLOAT);
|
2022-09-01 09:31:07 -03:00
|
|
|
immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);
|
2018-07-31 10:22:19 +02:00
|
|
|
|
|
|
|
|
immUniformColor3fv(gpl->color);
|
|
|
|
|
immRecti(pos, x, y, x + w - 1, y + h - 1);
|
|
|
|
|
|
|
|
|
|
immUnbindProgram();
|
|
|
|
|
}
|
|
|
|
|
|
2022-12-29 12:01:32 -05:00
|
|
|
static DrawInfo *g_di_event_list = nullptr;
|
2018-07-08 11:57:59 +02:00
|
|
|
|
|
|
|
|
int UI_icon_from_event_type(short event_type, short event_value)
|
|
|
|
|
{
|
2020-03-18 10:38:37 -06:00
|
|
|
if (event_type == EVT_RIGHTSHIFTKEY) {
|
|
|
|
|
event_type = EVT_LEFTSHIFTKEY;
|
2018-07-08 11:57:59 +02:00
|
|
|
}
|
2020-03-18 10:38:37 -06:00
|
|
|
else if (event_type == EVT_RIGHTCTRLKEY) {
|
|
|
|
|
event_type = EVT_LEFTCTRLKEY;
|
2018-07-08 11:57:59 +02:00
|
|
|
}
|
2020-03-18 10:38:37 -06:00
|
|
|
else if (event_type == EVT_RIGHTALTKEY) {
|
|
|
|
|
event_type = EVT_LEFTALTKEY;
|
2018-07-08 11:57:59 +02:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-07-08 11:57:59 +02:00
|
|
|
DrawInfo *di = g_di_event_list;
|
|
|
|
|
do {
|
|
|
|
|
if (di->data.input.event_type == event_type) {
|
|
|
|
|
return di->data.input.icon;
|
|
|
|
|
}
|
|
|
|
|
} while ((di = di->data.input.next));
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-07-08 11:57:59 +02:00
|
|
|
if (event_type == LEFTMOUSE) {
|
2024-07-31 20:57:19 +02:00
|
|
|
if (event_value == KM_DBL_CLICK) {
|
|
|
|
|
return ICON_MOUSE_LMB_2X;
|
|
|
|
|
}
|
2024-05-06 23:52:37 +02:00
|
|
|
return (event_value == KM_CLICK_DRAG) ? ICON_MOUSE_LMB_DRAG : ICON_MOUSE_LMB;
|
2018-07-08 11:57:59 +02:00
|
|
|
}
|
2020-07-03 14:20:10 +02:00
|
|
|
if (event_type == MIDDLEMOUSE) {
|
2024-05-06 23:52:37 +02:00
|
|
|
return (event_value == KM_CLICK_DRAG) ? ICON_MOUSE_MMB_DRAG : ICON_MOUSE_MMB;
|
2018-07-08 11:57:59 +02:00
|
|
|
}
|
2020-07-03 14:20:10 +02:00
|
|
|
if (event_type == RIGHTMOUSE) {
|
2024-05-06 23:52:37 +02:00
|
|
|
return (event_value == KM_CLICK_DRAG) ? ICON_MOUSE_MMB_DRAG : ICON_MOUSE_RMB;
|
2018-07-08 11:57:59 +02:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-07-08 11:57:59 +02:00
|
|
|
return ICON_NONE;
|
|
|
|
|
}
|
|
|
|
|
|
2025-03-26 10:38:08 +11:00
|
|
|
int UI_icon_from_keymap_item(const wmKeyMapItem *kmi, int r_icon_mod[KM_MOD_NUM])
|
2018-07-08 11:57:59 +02:00
|
|
|
{
|
|
|
|
|
if (r_icon_mod) {
|
2025-03-26 10:38:08 +11:00
|
|
|
memset(r_icon_mod, 0x0, sizeof(int[KM_MOD_NUM]));
|
2018-07-08 11:57:59 +02:00
|
|
|
int i = 0;
|
2025-03-25 12:14:27 +11:00
|
|
|
if (kmi->ctrl == KM_MOD_HELD) {
|
2018-07-08 11:57:59 +02:00
|
|
|
r_icon_mod[i++] = ICON_EVENT_CTRL;
|
|
|
|
|
}
|
2025-03-25 12:14:27 +11:00
|
|
|
if (kmi->alt == KM_MOD_HELD) {
|
2018-07-08 11:57:59 +02:00
|
|
|
r_icon_mod[i++] = ICON_EVENT_ALT;
|
|
|
|
|
}
|
2025-03-25 12:14:27 +11:00
|
|
|
if (kmi->shift == KM_MOD_HELD) {
|
2018-07-08 11:57:59 +02:00
|
|
|
r_icon_mod[i++] = ICON_EVENT_SHIFT;
|
|
|
|
|
}
|
2025-03-25 12:14:27 +11:00
|
|
|
if (kmi->oskey == KM_MOD_HELD) {
|
2018-07-08 11:57:59 +02:00
|
|
|
r_icon_mod[i++] = ICON_EVENT_OS;
|
|
|
|
|
}
|
2025-03-25 23:32:41 +00:00
|
|
|
if (!ELEM(kmi->hyper, KM_NOTHING, KM_ANY)) {
|
|
|
|
|
r_icon_mod[i++] = ICON_EVENT_HYPER;
|
|
|
|
|
}
|
2018-07-08 11:57:59 +02:00
|
|
|
}
|
|
|
|
|
return UI_icon_from_event_type(kmi->type, kmi->val);
|
|
|
|
|
}
|
|
|
|
|
|
2022-12-29 12:01:32 -05:00
|
|
|
static void init_event_icons()
|
2018-07-08 11:57:59 +02:00
|
|
|
{
|
2022-12-29 12:01:32 -05:00
|
|
|
DrawInfo *di_next = nullptr;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-09-04 11:26:26 +02:00
|
|
|
# define INIT_EVENT_ICON(icon_id, type, value) \
|
|
|
|
|
{ \
|
2022-12-29 12:01:32 -05:00
|
|
|
DrawInfo *di = def_internal_icon(nullptr, icon_id, 0, 0, w, ICON_TYPE_EVENT, 0); \
|
2020-09-04 11:26:26 +02:00
|
|
|
di->data.input.event_type = type; \
|
|
|
|
|
di->data.input.event_value = value; \
|
|
|
|
|
di->data.input.icon = icon_id; \
|
|
|
|
|
di->data.input.next = di_next; \
|
|
|
|
|
di_next = di; \
|
|
|
|
|
} \
|
|
|
|
|
((void)0)
|
2018-07-08 11:57:59 +02:00
|
|
|
/* end INIT_EVENT_ICON */
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-07-08 11:57:59 +02:00
|
|
|
const int w = 16; /* DUMMY */
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-03-18 10:38:37 -06:00
|
|
|
INIT_EVENT_ICON(ICON_EVENT_A, EVT_AKEY, KM_ANY);
|
|
|
|
|
INIT_EVENT_ICON(ICON_EVENT_B, EVT_BKEY, KM_ANY);
|
|
|
|
|
INIT_EVENT_ICON(ICON_EVENT_C, EVT_CKEY, KM_ANY);
|
|
|
|
|
INIT_EVENT_ICON(ICON_EVENT_D, EVT_DKEY, KM_ANY);
|
|
|
|
|
INIT_EVENT_ICON(ICON_EVENT_E, EVT_EKEY, KM_ANY);
|
|
|
|
|
INIT_EVENT_ICON(ICON_EVENT_F, EVT_FKEY, KM_ANY);
|
|
|
|
|
INIT_EVENT_ICON(ICON_EVENT_G, EVT_GKEY, KM_ANY);
|
|
|
|
|
INIT_EVENT_ICON(ICON_EVENT_H, EVT_HKEY, KM_ANY);
|
|
|
|
|
INIT_EVENT_ICON(ICON_EVENT_I, EVT_IKEY, KM_ANY);
|
|
|
|
|
INIT_EVENT_ICON(ICON_EVENT_J, EVT_JKEY, KM_ANY);
|
|
|
|
|
INIT_EVENT_ICON(ICON_EVENT_K, EVT_KKEY, KM_ANY);
|
|
|
|
|
INIT_EVENT_ICON(ICON_EVENT_L, EVT_LKEY, KM_ANY);
|
|
|
|
|
INIT_EVENT_ICON(ICON_EVENT_M, EVT_MKEY, KM_ANY);
|
|
|
|
|
INIT_EVENT_ICON(ICON_EVENT_N, EVT_NKEY, KM_ANY);
|
|
|
|
|
INIT_EVENT_ICON(ICON_EVENT_O, EVT_OKEY, KM_ANY);
|
|
|
|
|
INIT_EVENT_ICON(ICON_EVENT_P, EVT_PKEY, KM_ANY);
|
|
|
|
|
INIT_EVENT_ICON(ICON_EVENT_Q, EVT_QKEY, KM_ANY);
|
|
|
|
|
INIT_EVENT_ICON(ICON_EVENT_R, EVT_RKEY, KM_ANY);
|
|
|
|
|
INIT_EVENT_ICON(ICON_EVENT_S, EVT_SKEY, KM_ANY);
|
|
|
|
|
INIT_EVENT_ICON(ICON_EVENT_T, EVT_TKEY, KM_ANY);
|
|
|
|
|
INIT_EVENT_ICON(ICON_EVENT_U, EVT_UKEY, KM_ANY);
|
|
|
|
|
INIT_EVENT_ICON(ICON_EVENT_V, EVT_VKEY, KM_ANY);
|
|
|
|
|
INIT_EVENT_ICON(ICON_EVENT_W, EVT_WKEY, KM_ANY);
|
|
|
|
|
INIT_EVENT_ICON(ICON_EVENT_X, EVT_XKEY, KM_ANY);
|
|
|
|
|
INIT_EVENT_ICON(ICON_EVENT_Y, EVT_YKEY, KM_ANY);
|
|
|
|
|
INIT_EVENT_ICON(ICON_EVENT_Z, EVT_ZKEY, KM_ANY);
|
|
|
|
|
INIT_EVENT_ICON(ICON_EVENT_SHIFT, EVT_LEFTSHIFTKEY, KM_ANY);
|
|
|
|
|
INIT_EVENT_ICON(ICON_EVENT_CTRL, EVT_LEFTCTRLKEY, KM_ANY);
|
|
|
|
|
INIT_EVENT_ICON(ICON_EVENT_ALT, EVT_LEFTALTKEY, KM_ANY);
|
|
|
|
|
INIT_EVENT_ICON(ICON_EVENT_OS, EVT_OSKEY, KM_ANY);
|
2025-03-25 23:32:41 +00:00
|
|
|
INIT_EVENT_ICON(ICON_EVENT_HYPER, EVT_HYPER, KM_ANY);
|
2020-03-18 10:38:37 -06:00
|
|
|
INIT_EVENT_ICON(ICON_EVENT_F1, EVT_F1KEY, KM_ANY);
|
|
|
|
|
INIT_EVENT_ICON(ICON_EVENT_F2, EVT_F2KEY, KM_ANY);
|
|
|
|
|
INIT_EVENT_ICON(ICON_EVENT_F3, EVT_F3KEY, KM_ANY);
|
|
|
|
|
INIT_EVENT_ICON(ICON_EVENT_F4, EVT_F4KEY, KM_ANY);
|
|
|
|
|
INIT_EVENT_ICON(ICON_EVENT_F5, EVT_F5KEY, KM_ANY);
|
|
|
|
|
INIT_EVENT_ICON(ICON_EVENT_F6, EVT_F6KEY, KM_ANY);
|
|
|
|
|
INIT_EVENT_ICON(ICON_EVENT_F7, EVT_F7KEY, KM_ANY);
|
|
|
|
|
INIT_EVENT_ICON(ICON_EVENT_F8, EVT_F8KEY, KM_ANY);
|
|
|
|
|
INIT_EVENT_ICON(ICON_EVENT_F9, EVT_F9KEY, KM_ANY);
|
|
|
|
|
INIT_EVENT_ICON(ICON_EVENT_F10, EVT_F10KEY, KM_ANY);
|
|
|
|
|
INIT_EVENT_ICON(ICON_EVENT_F11, EVT_F11KEY, KM_ANY);
|
|
|
|
|
INIT_EVENT_ICON(ICON_EVENT_F12, EVT_F12KEY, KM_ANY);
|
|
|
|
|
INIT_EVENT_ICON(ICON_EVENT_ESC, EVT_ESCKEY, KM_ANY);
|
|
|
|
|
INIT_EVENT_ICON(ICON_EVENT_TAB, EVT_TABKEY, KM_ANY);
|
|
|
|
|
INIT_EVENT_ICON(ICON_EVENT_PAGEUP, EVT_PAGEUPKEY, KM_ANY);
|
|
|
|
|
INIT_EVENT_ICON(ICON_EVENT_PAGEDOWN, EVT_PAGEDOWNKEY, KM_ANY);
|
|
|
|
|
INIT_EVENT_ICON(ICON_EVENT_RETURN, EVT_RETKEY, KM_ANY);
|
|
|
|
|
INIT_EVENT_ICON(ICON_EVENT_SPACEKEY, EVT_SPACEKEY, KM_ANY);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2024-04-02 21:52:57 +02:00
|
|
|
INIT_EVENT_ICON(ICON_EVENT_ZEROKEY, EVT_ZEROKEY, KM_ANY);
|
|
|
|
|
INIT_EVENT_ICON(ICON_EVENT_ONEKEY, EVT_ONEKEY, KM_ANY);
|
|
|
|
|
INIT_EVENT_ICON(ICON_EVENT_TWOKEY, EVT_TWOKEY, KM_ANY);
|
|
|
|
|
INIT_EVENT_ICON(ICON_EVENT_THREEKEY, EVT_THREEKEY, KM_ANY);
|
|
|
|
|
INIT_EVENT_ICON(ICON_EVENT_FOURKEY, EVT_FOURKEY, KM_ANY);
|
|
|
|
|
INIT_EVENT_ICON(ICON_EVENT_FIVEKEY, EVT_FIVEKEY, KM_ANY);
|
|
|
|
|
INIT_EVENT_ICON(ICON_EVENT_SIXKEY, EVT_SIXKEY, KM_ANY);
|
|
|
|
|
INIT_EVENT_ICON(ICON_EVENT_SEVENKEY, EVT_SEVENKEY, KM_ANY);
|
|
|
|
|
INIT_EVENT_ICON(ICON_EVENT_EIGHTKEY, EVT_EIGHTKEY, KM_ANY);
|
|
|
|
|
INIT_EVENT_ICON(ICON_EVENT_NINEKEY, EVT_NINEKEY, KM_ANY);
|
|
|
|
|
|
|
|
|
|
INIT_EVENT_ICON(ICON_EVENT_PAD0, EVT_PAD0, KM_ANY);
|
|
|
|
|
INIT_EVENT_ICON(ICON_EVENT_PAD1, EVT_PAD1, KM_ANY);
|
|
|
|
|
INIT_EVENT_ICON(ICON_EVENT_PAD2, EVT_PAD2, KM_ANY);
|
|
|
|
|
INIT_EVENT_ICON(ICON_EVENT_PAD3, EVT_PAD3, KM_ANY);
|
|
|
|
|
INIT_EVENT_ICON(ICON_EVENT_PAD4, EVT_PAD4, KM_ANY);
|
|
|
|
|
INIT_EVENT_ICON(ICON_EVENT_PAD5, EVT_PAD5, KM_ANY);
|
|
|
|
|
INIT_EVENT_ICON(ICON_EVENT_PAD6, EVT_PAD6, KM_ANY);
|
|
|
|
|
INIT_EVENT_ICON(ICON_EVENT_PAD7, EVT_PAD7, KM_ANY);
|
|
|
|
|
INIT_EVENT_ICON(ICON_EVENT_PAD8, EVT_PAD8, KM_ANY);
|
|
|
|
|
INIT_EVENT_ICON(ICON_EVENT_PAD9, EVT_PAD9, KM_ANY);
|
|
|
|
|
INIT_EVENT_ICON(ICON_EVENT_PADASTER, EVT_PADASTERKEY, KM_ANY);
|
|
|
|
|
INIT_EVENT_ICON(ICON_EVENT_PADSLASH, EVT_PADSLASHKEY, KM_ANY);
|
|
|
|
|
INIT_EVENT_ICON(ICON_EVENT_PADMINUS, EVT_PADMINUS, KM_ANY);
|
|
|
|
|
INIT_EVENT_ICON(ICON_EVENT_PADENTER, EVT_PADENTER, KM_ANY);
|
|
|
|
|
INIT_EVENT_ICON(ICON_EVENT_PADPLUS, EVT_PADPLUSKEY, KM_ANY);
|
|
|
|
|
INIT_EVENT_ICON(ICON_EVENT_PADPERIOD, EVT_PADPERIOD, KM_ANY);
|
|
|
|
|
|
|
|
|
|
INIT_EVENT_ICON(ICON_EVENT_MOUSE_4, BUTTON4MOUSE, KM_ANY);
|
|
|
|
|
INIT_EVENT_ICON(ICON_EVENT_MOUSE_5, BUTTON5MOUSE, KM_ANY);
|
|
|
|
|
INIT_EVENT_ICON(ICON_EVENT_MOUSE_6, BUTTON6MOUSE, KM_ANY);
|
|
|
|
|
INIT_EVENT_ICON(ICON_EVENT_MOUSE_7, BUTTON7MOUSE, KM_ANY);
|
|
|
|
|
INIT_EVENT_ICON(ICON_EVENT_TABLET_STYLUS, TABLET_STYLUS, KM_ANY);
|
|
|
|
|
INIT_EVENT_ICON(ICON_EVENT_TABLET_ERASER, TABLET_ERASER, KM_ANY);
|
|
|
|
|
INIT_EVENT_ICON(ICON_EVENT_LEFT_ARROW, EVT_LEFTARROWKEY, KM_ANY);
|
|
|
|
|
INIT_EVENT_ICON(ICON_EVENT_DOWN_ARROW, EVT_DOWNARROWKEY, KM_ANY);
|
|
|
|
|
INIT_EVENT_ICON(ICON_EVENT_RIGHT_ARROW, EVT_RIGHTARROWKEY, KM_ANY);
|
|
|
|
|
INIT_EVENT_ICON(ICON_EVENT_UP_ARROW, EVT_UPARROWKEY, KM_ANY);
|
|
|
|
|
INIT_EVENT_ICON(ICON_EVENT_PAUSE, EVT_PAUSEKEY, KM_ANY);
|
|
|
|
|
INIT_EVENT_ICON(ICON_EVENT_INSERT, EVT_INSERTKEY, KM_ANY);
|
|
|
|
|
INIT_EVENT_ICON(ICON_EVENT_HOME, EVT_HOMEKEY, KM_ANY);
|
|
|
|
|
INIT_EVENT_ICON(ICON_EVENT_END, EVT_ENDKEY, KM_ANY);
|
|
|
|
|
INIT_EVENT_ICON(ICON_EVENT_UNKNOWN, EVT_UNKNOWNKEY, KM_ANY);
|
|
|
|
|
INIT_EVENT_ICON(ICON_EVENT_GRLESS, EVT_GRLESSKEY, KM_ANY);
|
|
|
|
|
INIT_EVENT_ICON(ICON_EVENT_MEDIAPLAY, EVT_MEDIAPLAY, KM_ANY);
|
|
|
|
|
INIT_EVENT_ICON(ICON_EVENT_MEDIASTOP, EVT_MEDIASTOP, KM_ANY);
|
|
|
|
|
INIT_EVENT_ICON(ICON_EVENT_MEDIAFIRST, EVT_MEDIAFIRST, KM_ANY);
|
|
|
|
|
INIT_EVENT_ICON(ICON_EVENT_MEDIALAST, EVT_MEDIALAST, KM_ANY);
|
|
|
|
|
INIT_EVENT_ICON(ICON_EVENT_APP, EVT_APPKEY, KM_ANY);
|
|
|
|
|
INIT_EVENT_ICON(ICON_EVENT_CAPSLOCK, EVT_CAPSLOCKKEY, KM_ANY);
|
|
|
|
|
INIT_EVENT_ICON(ICON_EVENT_BACKSPACE, EVT_BACKSPACEKEY, KM_ANY);
|
|
|
|
|
INIT_EVENT_ICON(ICON_EVENT_DEL, EVT_DELKEY, KM_ANY);
|
|
|
|
|
INIT_EVENT_ICON(ICON_EVENT_SEMICOLON, EVT_SEMICOLONKEY, KM_ANY);
|
|
|
|
|
INIT_EVENT_ICON(ICON_EVENT_PERIOD, EVT_PERIODKEY, KM_ANY);
|
|
|
|
|
INIT_EVENT_ICON(ICON_EVENT_COMMA, EVT_COMMAKEY, KM_ANY);
|
|
|
|
|
INIT_EVENT_ICON(ICON_EVENT_QUOTE, EVT_QUOTEKEY, KM_ANY);
|
|
|
|
|
INIT_EVENT_ICON(ICON_EVENT_ACCENTGRAVE, EVT_ACCENTGRAVEKEY, KM_ANY);
|
|
|
|
|
INIT_EVENT_ICON(ICON_EVENT_MINUS, EVT_MINUSKEY, KM_ANY);
|
|
|
|
|
INIT_EVENT_ICON(ICON_EVENT_PLUS, EVT_PLUSKEY, KM_ANY);
|
|
|
|
|
INIT_EVENT_ICON(ICON_EVENT_SLASH, EVT_SLASHKEY, KM_ANY);
|
|
|
|
|
INIT_EVENT_ICON(ICON_EVENT_BACKSLASH, EVT_BACKSLASHKEY, KM_ANY);
|
|
|
|
|
INIT_EVENT_ICON(ICON_EVENT_EQUAL, EVT_EQUALKEY, KM_ANY);
|
|
|
|
|
INIT_EVENT_ICON(ICON_EVENT_LEFTBRACKET, EVT_LEFTBRACKETKEY, KM_ANY);
|
|
|
|
|
INIT_EVENT_ICON(ICON_EVENT_RIGHTBRACKET, EVT_RIGHTBRACKETKEY, KM_ANY);
|
|
|
|
|
|
|
|
|
|
INIT_EVENT_ICON(ICON_EVENT_F13, EVT_F13KEY, KM_ANY);
|
|
|
|
|
INIT_EVENT_ICON(ICON_EVENT_F14, EVT_F14KEY, KM_ANY);
|
|
|
|
|
INIT_EVENT_ICON(ICON_EVENT_F15, EVT_F15KEY, KM_ANY);
|
|
|
|
|
INIT_EVENT_ICON(ICON_EVENT_F16, EVT_F16KEY, KM_ANY);
|
|
|
|
|
INIT_EVENT_ICON(ICON_EVENT_F17, EVT_F17KEY, KM_ANY);
|
|
|
|
|
INIT_EVENT_ICON(ICON_EVENT_F18, EVT_F18KEY, KM_ANY);
|
|
|
|
|
INIT_EVENT_ICON(ICON_EVENT_F19, EVT_F19KEY, KM_ANY);
|
|
|
|
|
INIT_EVENT_ICON(ICON_EVENT_F20, EVT_F20KEY, KM_ANY);
|
|
|
|
|
INIT_EVENT_ICON(ICON_EVENT_F21, EVT_F21KEY, KM_ANY);
|
|
|
|
|
INIT_EVENT_ICON(ICON_EVENT_F22, EVT_F22KEY, KM_ANY);
|
|
|
|
|
INIT_EVENT_ICON(ICON_EVENT_F23, EVT_F23KEY, KM_ANY);
|
|
|
|
|
INIT_EVENT_ICON(ICON_EVENT_F24, EVT_F24KEY, KM_ANY);
|
|
|
|
|
|
|
|
|
|
INIT_EVENT_ICON(ICON_EVENT_NDOF_BUTTON_V1, NDOF_BUTTON_V1, KM_ANY);
|
|
|
|
|
INIT_EVENT_ICON(ICON_EVENT_NDOF_BUTTON_V2, NDOF_BUTTON_V2, KM_ANY);
|
|
|
|
|
INIT_EVENT_ICON(ICON_EVENT_NDOF_BUTTON_V3, NDOF_BUTTON_V3, KM_ANY);
|
2024-06-24 14:55:35 +02:00
|
|
|
INIT_EVENT_ICON(ICON_EVENT_NDOF_BUTTON_SAVE_V1, NDOF_BUTTON_SAVE_V1, KM_ANY);
|
|
|
|
|
INIT_EVENT_ICON(ICON_EVENT_NDOF_BUTTON_SAVE_V2, NDOF_BUTTON_SAVE_V2, KM_ANY);
|
|
|
|
|
INIT_EVENT_ICON(ICON_EVENT_NDOF_BUTTON_SAVE_V3, NDOF_BUTTON_SAVE_V3, KM_ANY);
|
2024-04-02 21:52:57 +02:00
|
|
|
INIT_EVENT_ICON(ICON_EVENT_NDOF_BUTTON_1, NDOF_BUTTON_1, KM_ANY);
|
|
|
|
|
INIT_EVENT_ICON(ICON_EVENT_NDOF_BUTTON_2, NDOF_BUTTON_2, KM_ANY);
|
|
|
|
|
INIT_EVENT_ICON(ICON_EVENT_NDOF_BUTTON_3, NDOF_BUTTON_3, KM_ANY);
|
|
|
|
|
INIT_EVENT_ICON(ICON_EVENT_NDOF_BUTTON_4, NDOF_BUTTON_4, KM_ANY);
|
|
|
|
|
INIT_EVENT_ICON(ICON_EVENT_NDOF_BUTTON_5, NDOF_BUTTON_5, KM_ANY);
|
|
|
|
|
INIT_EVENT_ICON(ICON_EVENT_NDOF_BUTTON_6, NDOF_BUTTON_6, KM_ANY);
|
|
|
|
|
INIT_EVENT_ICON(ICON_EVENT_NDOF_BUTTON_7, NDOF_BUTTON_7, KM_ANY);
|
|
|
|
|
INIT_EVENT_ICON(ICON_EVENT_NDOF_BUTTON_8, NDOF_BUTTON_8, KM_ANY);
|
|
|
|
|
INIT_EVENT_ICON(ICON_EVENT_NDOF_BUTTON_9, NDOF_BUTTON_9, KM_ANY);
|
|
|
|
|
INIT_EVENT_ICON(ICON_EVENT_NDOF_BUTTON_10, NDOF_BUTTON_10, KM_ANY);
|
2024-06-24 14:55:35 +02:00
|
|
|
INIT_EVENT_ICON(ICON_EVENT_NDOF_BUTTON_11, NDOF_BUTTON_11, KM_ANY);
|
|
|
|
|
INIT_EVENT_ICON(ICON_EVENT_NDOF_BUTTON_12, NDOF_BUTTON_12, KM_ANY);
|
2024-04-02 21:52:57 +02:00
|
|
|
INIT_EVENT_ICON(ICON_EVENT_NDOF_BUTTON_MENU, NDOF_BUTTON_MENU, KM_ANY);
|
|
|
|
|
INIT_EVENT_ICON(ICON_EVENT_NDOF_BUTTON_FIT, NDOF_BUTTON_FIT, KM_ANY);
|
|
|
|
|
INIT_EVENT_ICON(ICON_EVENT_NDOF_BUTTON_TOP, NDOF_BUTTON_TOP, KM_ANY);
|
|
|
|
|
INIT_EVENT_ICON(ICON_EVENT_NDOF_BUTTON_BOTTOM, NDOF_BUTTON_BOTTOM, KM_ANY);
|
|
|
|
|
INIT_EVENT_ICON(ICON_EVENT_NDOF_BUTTON_LEFT, NDOF_BUTTON_LEFT, KM_ANY);
|
|
|
|
|
INIT_EVENT_ICON(ICON_EVENT_NDOF_BUTTON_RIGHT, NDOF_BUTTON_RIGHT, KM_ANY);
|
|
|
|
|
INIT_EVENT_ICON(ICON_EVENT_NDOF_BUTTON_FRONT, NDOF_BUTTON_FRONT, KM_ANY);
|
|
|
|
|
INIT_EVENT_ICON(ICON_EVENT_NDOF_BUTTON_BACK, NDOF_BUTTON_BACK, KM_ANY);
|
|
|
|
|
INIT_EVENT_ICON(ICON_EVENT_NDOF_BUTTON_ISO1, NDOF_BUTTON_ISO1, KM_ANY);
|
|
|
|
|
INIT_EVENT_ICON(ICON_EVENT_NDOF_BUTTON_ISO2, NDOF_BUTTON_ISO2, KM_ANY);
|
|
|
|
|
INIT_EVENT_ICON(ICON_EVENT_NDOF_BUTTON_ROLL_CW, NDOF_BUTTON_ROLL_CW, KM_ANY);
|
|
|
|
|
INIT_EVENT_ICON(ICON_EVENT_NDOF_BUTTON_ROLL_CCW, NDOF_BUTTON_ROLL_CCW, KM_ANY);
|
|
|
|
|
INIT_EVENT_ICON(ICON_EVENT_NDOF_BUTTON_SPIN_CW, NDOF_BUTTON_SPIN_CW, KM_ANY);
|
|
|
|
|
INIT_EVENT_ICON(ICON_EVENT_NDOF_BUTTON_SPIN_CCW, NDOF_BUTTON_SPIN_CCW, KM_ANY);
|
|
|
|
|
INIT_EVENT_ICON(ICON_EVENT_NDOF_BUTTON_TILT_CW, NDOF_BUTTON_TILT_CW, KM_ANY);
|
|
|
|
|
INIT_EVENT_ICON(ICON_EVENT_NDOF_BUTTON_TILT_CCW, NDOF_BUTTON_TILT_CCW, KM_ANY);
|
|
|
|
|
INIT_EVENT_ICON(ICON_EVENT_NDOF_BUTTON_ROTATE, NDOF_BUTTON_ROTATE, KM_ANY);
|
|
|
|
|
INIT_EVENT_ICON(ICON_EVENT_NDOF_BUTTON_PANZOOM, NDOF_BUTTON_PANZOOM, KM_ANY);
|
|
|
|
|
INIT_EVENT_ICON(ICON_EVENT_NDOF_BUTTON_DOMINANT, NDOF_BUTTON_DOMINANT, KM_ANY);
|
|
|
|
|
INIT_EVENT_ICON(ICON_EVENT_NDOF_BUTTON_PLUS, NDOF_BUTTON_PLUS, KM_ANY);
|
|
|
|
|
INIT_EVENT_ICON(ICON_EVENT_NDOF_BUTTON_MINUS, NDOF_BUTTON_MINUS, KM_ANY);
|
|
|
|
|
|
2018-07-08 11:57:59 +02:00
|
|
|
g_di_event_list = di_next;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-09-04 11:26:26 +02:00
|
|
|
# undef INIT_EVENT_ICON
|
2018-07-08 11:57:59 +02:00
|
|
|
}
|
|
|
|
|
|
2013-01-22 11:18:41 +00:00
|
|
|
static void icon_verify_datatoc(IconImage *iimg)
|
|
|
|
|
{
|
|
|
|
|
/* if it has own rect, things are all OK */
|
2019-03-25 10:15:20 +11:00
|
|
|
if (iimg->rect) {
|
2013-01-22 11:18:41 +00:00
|
|
|
return;
|
2019-03-25 10:15:20 +11:00
|
|
|
}
|
2018-05-23 10:47:12 +02:00
|
|
|
|
2013-01-22 11:18:41 +00:00
|
|
|
if (iimg->datatoc_rect) {
|
2025-03-27 13:12:54 +01:00
|
|
|
ImBuf *bbuf = IMB_load_image_from_memory(
|
|
|
|
|
iimg->datatoc_rect, iimg->datatoc_size, IB_byte_data, "<matcap icon>");
|
2013-01-22 11:18:41 +00:00
|
|
|
/* w and h were set on initialize */
|
2019-03-25 10:15:20 +11:00
|
|
|
if (bbuf->x != iimg->h && bbuf->y != iimg->w) {
|
2024-08-19 16:50:05 +02:00
|
|
|
IMB_scale(bbuf, iimg->w, iimg->h, IMBScaleFilter::Box, false);
|
2019-03-25 10:15:20 +11:00
|
|
|
}
|
2018-05-23 10:47:12 +02:00
|
|
|
|
2023-05-18 10:19:01 +02:00
|
|
|
iimg->rect = IMB_steal_byte_buffer(bbuf);
|
2013-01-22 11:18:41 +00:00
|
|
|
IMB_freeImBuf(bbuf);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-12-29 12:01:32 -05:00
|
|
|
static void init_internal_icons()
|
2019-05-09 15:53:44 +02:00
|
|
|
{
|
|
|
|
|
/* Define icons. */
|
2024-06-28 05:25:18 +02:00
|
|
|
for (int x = ICON_NONE; x < ICON_BLANK_LAST_SVG_ITEM; x++) {
|
|
|
|
|
const IconType icontype = icontypes[x];
|
2024-07-17 22:15:09 +02:00
|
|
|
if (!ELEM(icontype.type, ICON_TYPE_SVG_MONO, ICON_TYPE_SVG_COLOR)) {
|
2024-06-28 05:25:18 +02:00
|
|
|
continue;
|
2019-05-09 15:53:44 +02:00
|
|
|
}
|
2024-06-28 05:25:18 +02:00
|
|
|
def_internal_icon(nullptr, x, 0, 0, 0, icontype.type, icontype.theme_color);
|
2019-04-17 06:17:24 +02:00
|
|
|
}
|
|
|
|
|
|
2025-03-21 01:57:32 +01:00
|
|
|
def_internal_vicon(ICON_RGB_RED, vicon_rgb_red_draw);
|
|
|
|
|
def_internal_vicon(ICON_RGB_GREEN, vicon_rgb_green_draw);
|
|
|
|
|
def_internal_vicon(ICON_RGB_BLUE, vicon_rgb_blue_draw);
|
|
|
|
|
|
2018-09-20 18:07:58 +02:00
|
|
|
def_internal_vicon(ICON_KEYTYPE_KEYFRAME_VEC, vicon_keytype_keyframe_draw);
|
|
|
|
|
def_internal_vicon(ICON_KEYTYPE_BREAKDOWN_VEC, vicon_keytype_breakdown_draw);
|
|
|
|
|
def_internal_vicon(ICON_KEYTYPE_EXTREME_VEC, vicon_keytype_extreme_draw);
|
|
|
|
|
def_internal_vicon(ICON_KEYTYPE_JITTER_VEC, vicon_keytype_jitter_draw);
|
|
|
|
|
def_internal_vicon(ICON_KEYTYPE_MOVING_HOLD_VEC, vicon_keytype_moving_hold_draw);
|
2024-04-15 10:42:54 +02:00
|
|
|
def_internal_vicon(ICON_KEYTYPE_GENERATED_VEC, vicon_keytype_generated_draw);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
Dope Sheet: new option to display keyframe interpolation mode and extremes.
With the new automatic handle algorithm, it is possible to do a lot
of the animation via keyframes without touching the curves. It is
however necessary to change the keyframe interpolation and handle
types in certain cases. Currently the dopesheet/action editor
allows changing the types, but does not show them in any way.
To fix, add a new menu option to display this information. For handle
type, it is represented using the shape of the key icons: diamond for
Free, clipped diamond for Aligned, square for Vector, circle for Auto
Clamp, and cirle with dot for Automatic.
Non-bezier interpolation is a property of intervals between keys,
so it is marked by drawing lines, similar to holds. In this initial
version, only the fact of non-bezier interpolation is displayed,
without distinguishing types. For summaries, the line is drawn at
half alpha if not all curves in the group are non-bezier.
In addition, it is sometimes helpful to know the general direction
of change of the curve, and which keys are extremes. This commit
also adds an option to highlight extremes, based on comparing the
keyed values with adjacent keys. Half-intensity display is used
for overshot bezier extremes, or non-uniform summaries.
Reviewers: brecht, aligorith, billreynish
Differential Revision: https://developer.blender.org/D3788
2018-10-19 18:55:19 +03:00
|
|
|
def_internal_vicon(ICON_HANDLETYPE_FREE_VEC, vicon_handletype_free_draw);
|
|
|
|
|
def_internal_vicon(ICON_HANDLETYPE_ALIGNED_VEC, vicon_handletype_aligned_draw);
|
|
|
|
|
def_internal_vicon(ICON_HANDLETYPE_VECTOR_VEC, vicon_handletype_vector_draw);
|
|
|
|
|
def_internal_vicon(ICON_HANDLETYPE_AUTO_VEC, vicon_handletype_auto_draw);
|
|
|
|
|
def_internal_vicon(ICON_HANDLETYPE_AUTO_CLAMP_VEC, vicon_handletype_auto_clamp_draw);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-09-20 18:07:58 +02:00
|
|
|
def_internal_vicon(ICON_COLORSET_01_VEC, vicon_colorset_draw_01);
|
|
|
|
|
def_internal_vicon(ICON_COLORSET_02_VEC, vicon_colorset_draw_02);
|
|
|
|
|
def_internal_vicon(ICON_COLORSET_03_VEC, vicon_colorset_draw_03);
|
|
|
|
|
def_internal_vicon(ICON_COLORSET_04_VEC, vicon_colorset_draw_04);
|
|
|
|
|
def_internal_vicon(ICON_COLORSET_05_VEC, vicon_colorset_draw_05);
|
|
|
|
|
def_internal_vicon(ICON_COLORSET_06_VEC, vicon_colorset_draw_06);
|
|
|
|
|
def_internal_vicon(ICON_COLORSET_07_VEC, vicon_colorset_draw_07);
|
|
|
|
|
def_internal_vicon(ICON_COLORSET_08_VEC, vicon_colorset_draw_08);
|
|
|
|
|
def_internal_vicon(ICON_COLORSET_09_VEC, vicon_colorset_draw_09);
|
|
|
|
|
def_internal_vicon(ICON_COLORSET_10_VEC, vicon_colorset_draw_10);
|
|
|
|
|
def_internal_vicon(ICON_COLORSET_11_VEC, vicon_colorset_draw_11);
|
|
|
|
|
def_internal_vicon(ICON_COLORSET_12_VEC, vicon_colorset_draw_12);
|
|
|
|
|
def_internal_vicon(ICON_COLORSET_13_VEC, vicon_colorset_draw_13);
|
|
|
|
|
def_internal_vicon(ICON_COLORSET_14_VEC, vicon_colorset_draw_14);
|
|
|
|
|
def_internal_vicon(ICON_COLORSET_15_VEC, vicon_colorset_draw_15);
|
|
|
|
|
def_internal_vicon(ICON_COLORSET_16_VEC, vicon_colorset_draw_16);
|
|
|
|
|
def_internal_vicon(ICON_COLORSET_17_VEC, vicon_colorset_draw_17);
|
|
|
|
|
def_internal_vicon(ICON_COLORSET_18_VEC, vicon_colorset_draw_18);
|
|
|
|
|
def_internal_vicon(ICON_COLORSET_19_VEC, vicon_colorset_draw_19);
|
|
|
|
|
def_internal_vicon(ICON_COLORSET_20_VEC, vicon_colorset_draw_20);
|
2020-09-15 12:13:03 -06:00
|
|
|
|
|
|
|
|
def_internal_vicon(ICON_COLLECTION_COLOR_01, vicon_collection_color_draw_01);
|
|
|
|
|
def_internal_vicon(ICON_COLLECTION_COLOR_02, vicon_collection_color_draw_02);
|
|
|
|
|
def_internal_vicon(ICON_COLLECTION_COLOR_03, vicon_collection_color_draw_03);
|
|
|
|
|
def_internal_vicon(ICON_COLLECTION_COLOR_04, vicon_collection_color_draw_04);
|
|
|
|
|
def_internal_vicon(ICON_COLLECTION_COLOR_05, vicon_collection_color_draw_05);
|
|
|
|
|
def_internal_vicon(ICON_COLLECTION_COLOR_06, vicon_collection_color_draw_06);
|
|
|
|
|
def_internal_vicon(ICON_COLLECTION_COLOR_07, vicon_collection_color_draw_07);
|
|
|
|
|
def_internal_vicon(ICON_COLLECTION_COLOR_08, vicon_collection_color_draw_08);
|
2021-09-29 14:29:32 +02:00
|
|
|
|
2025-01-07 16:05:12 +01:00
|
|
|
def_internal_vicon(ICON_STRIP_COLOR_01, vicon_strip_color_draw_01);
|
|
|
|
|
def_internal_vicon(ICON_STRIP_COLOR_02, vicon_strip_color_draw_02);
|
|
|
|
|
def_internal_vicon(ICON_STRIP_COLOR_03, vicon_strip_color_draw_03);
|
|
|
|
|
def_internal_vicon(ICON_STRIP_COLOR_04, vicon_strip_color_draw_04);
|
|
|
|
|
def_internal_vicon(ICON_STRIP_COLOR_05, vicon_strip_color_draw_05);
|
|
|
|
|
def_internal_vicon(ICON_STRIP_COLOR_06, vicon_strip_color_draw_06);
|
|
|
|
|
def_internal_vicon(ICON_STRIP_COLOR_07, vicon_strip_color_draw_07);
|
|
|
|
|
def_internal_vicon(ICON_STRIP_COLOR_08, vicon_strip_color_draw_08);
|
|
|
|
|
def_internal_vicon(ICON_STRIP_COLOR_09, vicon_strip_color_draw_09);
|
2022-03-29 14:36:06 +02:00
|
|
|
|
|
|
|
|
def_internal_vicon(ICON_LIBRARY_DATA_INDIRECT, vicon_strip_color_draw_library_data_indirect);
|
2022-03-29 17:26:13 +02:00
|
|
|
def_internal_vicon(ICON_LIBRARY_DATA_OVERRIDE_NONEDITABLE,
|
|
|
|
|
vicon_strip_color_draw_library_data_override_noneditable);
|
2024-06-11 18:25:01 +02:00
|
|
|
|
|
|
|
|
def_internal_vicon(ICON_LAYERGROUP_COLOR_01, vicon_layergroup_color_draw_01);
|
|
|
|
|
def_internal_vicon(ICON_LAYERGROUP_COLOR_02, vicon_layergroup_color_draw_02);
|
|
|
|
|
def_internal_vicon(ICON_LAYERGROUP_COLOR_03, vicon_layergroup_color_draw_03);
|
|
|
|
|
def_internal_vicon(ICON_LAYERGROUP_COLOR_04, vicon_layergroup_color_draw_04);
|
|
|
|
|
def_internal_vicon(ICON_LAYERGROUP_COLOR_05, vicon_layergroup_color_draw_05);
|
|
|
|
|
def_internal_vicon(ICON_LAYERGROUP_COLOR_06, vicon_layergroup_color_draw_06);
|
|
|
|
|
def_internal_vicon(ICON_LAYERGROUP_COLOR_07, vicon_layergroup_color_draw_07);
|
|
|
|
|
def_internal_vicon(ICON_LAYERGROUP_COLOR_08, vicon_layergroup_color_draw_08);
|
2025-03-25 18:11:27 +01:00
|
|
|
|
|
|
|
|
def_internal_vicon(ICON_NODE_SOCKET_FLOAT, icon_node_socket_draw_float);
|
|
|
|
|
def_internal_vicon(ICON_NODE_SOCKET_VECTOR, icon_node_socket_draw_vector);
|
|
|
|
|
def_internal_vicon(ICON_NODE_SOCKET_RGBA, icon_node_socket_draw_rgba);
|
|
|
|
|
def_internal_vicon(ICON_NODE_SOCKET_SHADER, icon_node_socket_draw_shader);
|
|
|
|
|
def_internal_vicon(ICON_NODE_SOCKET_BOOLEAN, icon_node_socket_draw_boolean);
|
|
|
|
|
def_internal_vicon(ICON_NODE_SOCKET_INT, icon_node_socket_draw_int);
|
|
|
|
|
def_internal_vicon(ICON_NODE_SOCKET_STRING, icon_node_socket_draw_string);
|
|
|
|
|
def_internal_vicon(ICON_NODE_SOCKET_OBJECT, icon_node_socket_draw_object);
|
|
|
|
|
def_internal_vicon(ICON_NODE_SOCKET_IMAGE, icon_node_socket_draw_image);
|
|
|
|
|
def_internal_vicon(ICON_NODE_SOCKET_GEOMETRY, icon_node_socket_draw_geometry);
|
|
|
|
|
def_internal_vicon(ICON_NODE_SOCKET_COLLECTION, icon_node_socket_draw_collection);
|
|
|
|
|
def_internal_vicon(ICON_NODE_SOCKET_TEXTURE, icon_node_socket_draw_texture);
|
|
|
|
|
def_internal_vicon(ICON_NODE_SOCKET_MATERIAL, icon_node_socket_draw_material);
|
|
|
|
|
def_internal_vicon(ICON_NODE_SOCKET_ROTATION, icon_node_socket_draw_rotation);
|
|
|
|
|
def_internal_vicon(ICON_NODE_SOCKET_MENU, icon_node_socket_draw_menu);
|
|
|
|
|
def_internal_vicon(ICON_NODE_SOCKET_MATRIX, icon_node_socket_draw_matrix);
|
2025-04-03 15:44:06 +02:00
|
|
|
def_internal_vicon(ICON_NODE_SOCKET_BUNDLE, icon_node_socket_draw_bundle);
|
|
|
|
|
def_internal_vicon(ICON_NODE_SOCKET_CLOSURE, icon_node_socket_draw_closure);
|
2008-11-25 18:27:41 +00:00
|
|
|
}
|
|
|
|
|
|
2019-05-22 10:34:34 +10:00
|
|
|
#else
|
|
|
|
|
|
2013-02-01 08:24:18 +00:00
|
|
|
#endif /* WITH_HEADLESS */
|
|
|
|
|
|
2022-12-29 12:01:32 -05:00
|
|
|
void UI_icons_free()
|
2008-11-25 18:27:41 +00:00
|
|
|
{
|
2020-04-21 21:43:25 +02:00
|
|
|
BKE_icons_free();
|
2023-09-04 18:02:16 +02:00
|
|
|
BKE_preview_images_free();
|
2008-11-25 18:27:41 +00:00
|
|
|
}
|
|
|
|
|
|
2008-11-25 19:23:54 +00:00
|
|
|
void UI_icons_free_drawinfo(void *drawinfo)
|
2008-11-25 18:27:41 +00:00
|
|
|
{
|
2022-11-25 23:48:02 -06:00
|
|
|
DrawInfo *di = static_cast<DrawInfo *>(drawinfo);
|
2008-11-25 18:27:41 +00:00
|
|
|
|
2022-12-29 12:01:32 -05:00
|
|
|
if (di == nullptr) {
|
2020-09-21 13:21:22 -05:00
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (di->type == ICON_TYPE_BUFFER) {
|
|
|
|
|
if (di->data.buffer.image) {
|
|
|
|
|
if (di->data.buffer.image->rect) {
|
|
|
|
|
MEM_freeN(di->data.buffer.image->rect);
|
Sorry, three commits in one, became difficult to untangle..
Editors Modules
* render/ module added in editors, moved the preview render code there and
also shading related operators.
* physics/ module made more consistent with other modules. renaming files,
making a single physics_ops.c for operators and keymaps. Also move all
particle related operators here now.
* space_buttons/ now should have only operators relevant to the buttons
specificially.
Updates & Notifiers
* Material/Texture/World/Lamp can now be passed to DAG_id_flush_update,
which will go back to a callback in editors. Eventually these should
be in the depsgraph itself, but for now this gives a unified call for
doing updates.
* GLSL materials are now refreshed on changes. There's still various
cases missing,
* Preview icons now hook into this system, solving various update cases
that were missed before.
* Also fixes issue in my last commit, where some preview would not render,
problem is avoided in the new system.
Icon Rendering
* On systems with support for non-power of two textures, an OpenGL texture
is now used instead of glDrawPixels. This avoids problems with icons get
clipped on region borders. On my Linux desktop, this gives an 1.1x speedup,
and on my Mac laptop a 2.3x speedup overall in redrawing the full window,
with the default setup. The glDrawPixels implementation on Mac seems to
have a lot of overhread.
* Preview icons are now drawn using proper premul alpha, and never faded so
you can see them clearly.
* Also tried to fix issue with texture node preview rendering, globals can't
be used with threads reliably.
2009-09-29 19:12:12 +00:00
|
|
|
}
|
2020-09-21 13:21:22 -05:00
|
|
|
MEM_freeN(di->data.buffer.image);
|
2008-11-25 18:27:41 +00:00
|
|
|
}
|
2020-09-21 13:21:22 -05:00
|
|
|
}
|
|
|
|
|
else if (di->type == ICON_TYPE_GEOM) {
|
|
|
|
|
if (di->data.geom.image_cache) {
|
|
|
|
|
IMB_freeImBuf(di->data.geom.image_cache);
|
2018-04-20 15:15:10 +02:00
|
|
|
}
|
2008-11-25 18:27:41 +00:00
|
|
|
}
|
2020-09-21 13:21:22 -05:00
|
|
|
|
|
|
|
|
MEM_freeN(di);
|
2008-11-25 18:27:41 +00:00
|
|
|
}
|
|
|
|
|
|
2018-04-20 15:15:10 +02:00
|
|
|
/**
|
|
|
|
|
* #Icon.data_type and #Icon.obj
|
|
|
|
|
*/
|
2018-05-11 16:55:14 +02:00
|
|
|
static DrawInfo *icon_create_drawinfo(Icon *icon)
|
2008-11-25 18:27:41 +00:00
|
|
|
{
|
2020-08-26 10:11:13 +10:00
|
|
|
const int icon_data_type = icon->obj_type;
|
2008-11-25 18:27:41 +00:00
|
|
|
|
2025-03-05 16:35:09 +01:00
|
|
|
DrawInfo *di = MEM_callocN<DrawInfo>("di_icon");
|
2008-11-25 18:27:41 +00:00
|
|
|
|
2018-04-20 15:15:10 +02:00
|
|
|
if (ELEM(icon_data_type, ICON_DATA_ID, ICON_DATA_PREVIEW)) {
|
|
|
|
|
di->type = ICON_TYPE_PREVIEW;
|
|
|
|
|
}
|
2020-12-14 13:21:58 +01:00
|
|
|
else if (icon_data_type == ICON_DATA_IMBUF) {
|
|
|
|
|
di->type = ICON_TYPE_IMBUF;
|
|
|
|
|
}
|
2018-04-20 15:15:10 +02:00
|
|
|
else if (icon_data_type == ICON_DATA_GEOM) {
|
|
|
|
|
di->type = ICON_TYPE_GEOM;
|
|
|
|
|
}
|
2018-05-11 16:55:14 +02:00
|
|
|
else if (icon_data_type == ICON_DATA_STUDIOLIGHT) {
|
|
|
|
|
di->type = ICON_TYPE_BUFFER;
|
|
|
|
|
}
|
2018-07-31 10:22:19 +02:00
|
|
|
else if (icon_data_type == ICON_DATA_GPLAYER) {
|
|
|
|
|
di->type = ICON_TYPE_GPLAYER;
|
|
|
|
|
}
|
2018-04-20 15:15:10 +02:00
|
|
|
else {
|
|
|
|
|
BLI_assert(0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return di;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static DrawInfo *icon_ensure_drawinfo(Icon *icon)
|
|
|
|
|
{
|
|
|
|
|
if (icon->drawinfo) {
|
2022-11-25 23:48:02 -06:00
|
|
|
return static_cast<DrawInfo *>(icon->drawinfo);
|
2018-04-20 15:15:10 +02:00
|
|
|
}
|
2018-05-11 16:55:14 +02:00
|
|
|
DrawInfo *di = icon_create_drawinfo(icon);
|
2018-04-20 15:15:10 +02:00
|
|
|
icon->drawinfo = di;
|
|
|
|
|
icon->drawinfo_free = UI_icons_free_drawinfo;
|
2008-11-25 18:27:41 +00:00
|
|
|
return di;
|
|
|
|
|
}
|
|
|
|
|
|
2019-05-09 17:37:26 +02:00
|
|
|
bool UI_icon_get_theme_color(int icon_id, uchar color[4])
|
|
|
|
|
{
|
|
|
|
|
Icon *icon = BKE_icon_get(icon_id);
|
2022-12-29 12:01:32 -05:00
|
|
|
if (icon == nullptr) {
|
2019-05-09 17:37:26 +02:00
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
DrawInfo *di = icon_ensure_drawinfo(icon);
|
|
|
|
|
return UI_GetIconThemeColor4ubv(di->data.texture.theme_color, color);
|
|
|
|
|
}
|
|
|
|
|
|
2018-07-24 12:43:21 +02:00
|
|
|
void UI_icons_init()
|
2008-11-25 18:27:41 +00:00
|
|
|
{
|
2015-05-16 06:18:04 +10:00
|
|
|
#ifndef WITH_HEADLESS
|
2008-11-25 18:27:41 +00:00
|
|
|
init_internal_icons();
|
2018-07-08 11:57:59 +02:00
|
|
|
init_event_icons();
|
2011-06-05 07:55:18 +00:00
|
|
|
#endif
|
2008-11-25 18:27:41 +00:00
|
|
|
}
|
|
|
|
|
|
2020-09-18 10:24:14 +10:00
|
|
|
int UI_icon_preview_to_render_size(enum eIconSizes size)
|
2008-12-11 19:35:27 +00:00
|
|
|
{
|
2011-05-16 18:37:54 +00:00
|
|
|
switch (size) {
|
2015-05-11 16:29:12 +02:00
|
|
|
case ICON_SIZE_ICON:
|
|
|
|
|
return ICON_RENDER_DEFAULT_HEIGHT;
|
|
|
|
|
case ICON_SIZE_PREVIEW:
|
|
|
|
|
return PREVIEW_RENDER_DEFAULT_HEIGHT;
|
|
|
|
|
default:
|
|
|
|
|
return 0;
|
2008-12-11 19:35:27 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2011-05-16 18:37:54 +00:00
|
|
|
/* Create rect for the icon
|
|
|
|
|
*/
|
2022-11-25 23:48:02 -06:00
|
|
|
static void icon_create_rect(PreviewImage *prv_img, enum eIconSizes size)
|
2008-11-25 18:27:41 +00:00
|
|
|
{
|
2020-09-18 10:24:14 +10:00
|
|
|
const uint render_size = UI_icon_preview_to_render_size(size);
|
2008-11-25 18:27:41 +00:00
|
|
|
|
|
|
|
|
if (!prv_img) {
|
2019-03-25 10:15:20 +11:00
|
|
|
if (G.debug & G_DEBUG) {
|
2011-09-27 17:04:38 +00:00
|
|
|
printf("%s, error: requested preview image does not exist", __func__);
|
2019-03-25 10:15:20 +11:00
|
|
|
}
|
2008-11-25 18:27:41 +00:00
|
|
|
}
|
2012-09-14 06:17:14 +00:00
|
|
|
else if (!prv_img->rect[size]) {
|
2021-11-24 11:20:35 +01:00
|
|
|
prv_img->flag[size] |= PRV_CHANGED;
|
2011-05-16 18:37:54 +00:00
|
|
|
prv_img->changed_timestamp[size] = 0;
|
2025-01-24 19:46:33 +01:00
|
|
|
if (!ED_preview_use_image_size(prv_img, size)) {
|
|
|
|
|
prv_img->w[size] = render_size;
|
|
|
|
|
prv_img->h[size] = render_size;
|
2025-04-12 17:17:24 +02:00
|
|
|
prv_img->rect[size] = MEM_calloc_arrayN<uint>(render_size * render_size, "prv_rect");
|
2025-01-24 19:46:33 +01:00
|
|
|
}
|
2008-11-25 18:27:41 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2016-07-12 21:08:38 +02:00
|
|
|
static void ui_id_preview_image_render_size(
|
|
|
|
|
const bContext *C, Scene *scene, ID *id, PreviewImage *pi, int size, const bool use_job);
|
|
|
|
|
|
2023-10-06 13:06:02 +02:00
|
|
|
static void ui_studiolight_icon_job_exec(void *customdata, wmJobWorkerStatus * /*worker_status*/)
|
2018-06-19 14:00:34 +02:00
|
|
|
{
|
|
|
|
|
Icon **tmp = (Icon **)customdata;
|
|
|
|
|
Icon *icon = *tmp;
|
|
|
|
|
DrawInfo *di = icon_ensure_drawinfo(icon);
|
2022-11-25 23:48:02 -06:00
|
|
|
StudioLight *sl = static_cast<StudioLight *>(icon->obj);
|
2023-05-18 10:19:01 +02:00
|
|
|
BKE_studiolight_preview(
|
|
|
|
|
reinterpret_cast<uint *>(di->data.buffer.image->rect), sl, icon->id_type);
|
2018-06-19 14:00:34 +02:00
|
|
|
}
|
|
|
|
|
|
2018-06-20 09:29:40 +02:00
|
|
|
static void ui_studiolight_kill_icon_preview_job(wmWindowManager *wm, int icon_id)
|
|
|
|
|
{
|
|
|
|
|
Icon *icon = BKE_icon_get(icon_id);
|
|
|
|
|
WM_jobs_kill_type(wm, icon, WM_JOB_TYPE_STUDIOLIGHT);
|
2022-12-29 12:01:32 -05:00
|
|
|
icon->obj = nullptr;
|
2018-06-20 09:29:40 +02:00
|
|
|
}
|
|
|
|
|
|
2018-06-26 08:35:35 +02:00
|
|
|
static void ui_studiolight_free_function(StudioLight *sl, void *data)
|
2018-06-20 09:29:40 +02:00
|
|
|
{
|
2022-11-25 23:48:02 -06:00
|
|
|
wmWindowManager *wm = static_cast<wmWindowManager *>(data);
|
2018-06-20 10:13:49 +02:00
|
|
|
|
2018-09-18 15:35:51 +02:00
|
|
|
/* Happens if job was canceled or already finished. */
|
2022-12-29 12:01:32 -05:00
|
|
|
if (wm == nullptr) {
|
2018-09-18 15:35:51 +02:00
|
|
|
return;
|
2019-03-25 10:15:20 +11:00
|
|
|
}
|
2018-09-18 15:35:51 +02:00
|
|
|
|
2018-06-20 09:29:40 +02:00
|
|
|
/* get icons_id, get icons and kill wm jobs */
|
|
|
|
|
if (sl->icon_id_radiance) {
|
|
|
|
|
ui_studiolight_kill_icon_preview_job(wm, sl->icon_id_radiance);
|
|
|
|
|
}
|
|
|
|
|
if (sl->icon_id_irradiance) {
|
|
|
|
|
ui_studiolight_kill_icon_preview_job(wm, sl->icon_id_irradiance);
|
|
|
|
|
}
|
|
|
|
|
if (sl->icon_id_matcap) {
|
|
|
|
|
ui_studiolight_kill_icon_preview_job(wm, sl->icon_id_matcap);
|
|
|
|
|
}
|
|
|
|
|
if (sl->icon_id_matcap_flipped) {
|
|
|
|
|
ui_studiolight_kill_icon_preview_job(wm, sl->icon_id_matcap_flipped);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2018-09-18 15:35:51 +02:00
|
|
|
static void ui_studiolight_icon_job_end(void *customdata)
|
|
|
|
|
{
|
|
|
|
|
Icon **tmp = (Icon **)customdata;
|
|
|
|
|
Icon *icon = *tmp;
|
2022-11-25 23:48:02 -06:00
|
|
|
StudioLight *sl = static_cast<StudioLight *>(icon->obj);
|
2022-12-29 12:01:32 -05:00
|
|
|
BKE_studiolight_set_free_function(sl, &ui_studiolight_free_function, nullptr);
|
2018-09-18 15:35:51 +02:00
|
|
|
}
|
|
|
|
|
|
2015-05-11 16:29:12 +02:00
|
|
|
void ui_icon_ensure_deferred(const bContext *C, const int icon_id, const bool big)
|
|
|
|
|
{
|
|
|
|
|
Icon *icon = BKE_icon_get(icon_id);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2022-12-29 12:01:32 -05:00
|
|
|
if (icon == nullptr) {
|
2020-09-21 13:21:22 -05:00
|
|
|
return;
|
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-09-21 13:21:22 -05:00
|
|
|
DrawInfo *di = icon_ensure_drawinfo(icon);
|
|
|
|
|
|
2022-12-29 12:01:32 -05:00
|
|
|
if (di == nullptr) {
|
2020-09-21 13:21:22 -05:00
|
|
|
return;
|
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-09-21 13:21:22 -05:00
|
|
|
switch (di->type) {
|
|
|
|
|
case ICON_TYPE_PREVIEW: {
|
2022-12-29 12:01:32 -05:00
|
|
|
ID *id = (icon->id_type != 0) ? static_cast<ID *>(icon->obj) : nullptr;
|
2022-11-25 23:48:02 -06:00
|
|
|
PreviewImage *prv = id ? BKE_previewimg_id_ensure(id) :
|
|
|
|
|
static_cast<PreviewImage *>(icon->obj);
|
2021-07-26 12:32:42 +10:00
|
|
|
/* Using jobs for screen previews crashes due to off-screen rendering.
|
|
|
|
|
* XXX: would be nicer if #PreviewImage could store if it supports jobs. */
|
2020-09-21 13:21:22 -05:00
|
|
|
const bool use_jobs = !id || (GS(id->name) != ID_SCR);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-09-21 13:21:22 -05:00
|
|
|
if (prv) {
|
|
|
|
|
const int size = big ? ICON_SIZE_PREVIEW : ICON_SIZE_ICON;
|
|
|
|
|
|
2024-05-20 14:25:44 +02:00
|
|
|
if (id || prv->runtime->deferred_loading_data) {
|
2022-12-29 12:01:32 -05:00
|
|
|
ui_id_preview_image_render_size(C, nullptr, id, prv, size, use_jobs);
|
2015-05-11 16:29:12 +02:00
|
|
|
}
|
2020-09-21 13:21:22 -05:00
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case ICON_TYPE_BUFFER: {
|
|
|
|
|
if (icon->obj_type == ICON_DATA_STUDIOLIGHT) {
|
2022-12-29 12:01:32 -05:00
|
|
|
if (di->data.buffer.image == nullptr) {
|
2020-09-21 13:21:22 -05:00
|
|
|
wmWindowManager *wm = CTX_wm_manager(C);
|
2022-11-25 23:48:02 -06:00
|
|
|
StudioLight *sl = static_cast<StudioLight *>(icon->obj);
|
2020-09-21 13:21:22 -05:00
|
|
|
BKE_studiolight_set_free_function(sl, &ui_studiolight_free_function, wm);
|
2025-03-05 16:35:09 +01:00
|
|
|
IconImage *img = MEM_callocN<IconImage>(__func__);
|
2020-09-21 13:21:22 -05:00
|
|
|
|
|
|
|
|
img->w = STUDIOLIGHT_ICON_SIZE;
|
|
|
|
|
img->h = STUDIOLIGHT_ICON_SIZE;
|
|
|
|
|
const size_t size = STUDIOLIGHT_ICON_SIZE * STUDIOLIGHT_ICON_SIZE * sizeof(uint);
|
2025-04-22 11:22:18 +02:00
|
|
|
img->rect = MEM_malloc_arrayN<uint8_t>(size, __func__);
|
2020-09-21 13:21:22 -05:00
|
|
|
memset(img->rect, 0, size);
|
|
|
|
|
di->data.buffer.image = img;
|
|
|
|
|
|
2022-11-25 23:48:02 -06:00
|
|
|
wmJob *wm_job = WM_jobs_get(wm,
|
|
|
|
|
CTX_wm_window(C),
|
|
|
|
|
icon,
|
|
|
|
|
"StudioLight Icon",
|
|
|
|
|
eWM_JobFlag(0),
|
|
|
|
|
WM_JOB_TYPE_STUDIOLIGHT);
|
2025-03-05 16:35:09 +01:00
|
|
|
Icon **tmp = MEM_callocN<Icon *>(__func__);
|
2020-09-21 13:21:22 -05:00
|
|
|
*tmp = icon;
|
|
|
|
|
WM_jobs_customdata_set(wm_job, tmp, MEM_freeN);
|
|
|
|
|
WM_jobs_timer(wm_job, 0.01, 0, NC_WINDOW);
|
|
|
|
|
WM_jobs_callbacks(
|
2022-12-29 12:01:32 -05:00
|
|
|
wm_job, ui_studiolight_icon_job_exec, nullptr, nullptr, ui_studiolight_icon_job_end);
|
2020-09-21 13:21:22 -05:00
|
|
|
WM_jobs_start(CTX_wm_manager(C), wm_job);
|
2018-06-19 14:00:34 +02:00
|
|
|
}
|
2015-05-11 16:29:12 +02:00
|
|
|
}
|
2020-09-21 13:21:22 -05:00
|
|
|
break;
|
2015-05-11 16:29:12 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2025-02-03 16:03:06 +01:00
|
|
|
bool ui_icon_is_preview_deferred_loading(const int icon_id, const bool big)
|
|
|
|
|
{
|
|
|
|
|
const Icon *icon = BKE_icon_get(icon_id);
|
|
|
|
|
if (icon == nullptr) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const DrawInfo *di = static_cast<DrawInfo *>(icon->drawinfo);
|
|
|
|
|
if (icon->drawinfo == nullptr) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (di->type == ICON_TYPE_PREVIEW) {
|
|
|
|
|
const ID *id = (icon->id_type != 0) ? static_cast<ID *>(icon->obj) : nullptr;
|
|
|
|
|
const PreviewImage *prv = id ? BKE_previewimg_id_get(id) :
|
|
|
|
|
static_cast<PreviewImage *>(icon->obj);
|
|
|
|
|
|
|
|
|
|
if (prv) {
|
|
|
|
|
const int size = big ? ICON_SIZE_PREVIEW : ICON_SIZE_ICON;
|
|
|
|
|
return (prv->flag[size] & PRV_RENDERING) != 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
2020-12-14 13:21:58 +01:00
|
|
|
/**
|
|
|
|
|
* * Only call with valid pointer from UI_icon_draw.
|
|
|
|
|
* * Only called when icon has changed.
|
|
|
|
|
*
|
|
|
|
|
* Note that if an ID doesn't support jobs for preview creation, \a use_job will be ignored.
|
|
|
|
|
*/
|
2015-01-12 14:44:54 +01:00
|
|
|
static void icon_set_image(const bContext *C,
|
|
|
|
|
Scene *scene,
|
|
|
|
|
ID *id,
|
|
|
|
|
PreviewImage *prv_img,
|
|
|
|
|
enum eIconSizes size,
|
|
|
|
|
const bool use_job)
|
2008-11-25 18:27:41 +00:00
|
|
|
{
|
|
|
|
|
if (!prv_img) {
|
2019-03-25 10:15:20 +11:00
|
|
|
if (G.debug & G_DEBUG) {
|
2011-09-27 17:04:38 +00:00
|
|
|
printf("%s: no preview image for this ID: %s\n", __func__, id->name);
|
2019-03-25 10:15:20 +11:00
|
|
|
}
|
2008-11-25 18:27:41 +00:00
|
|
|
return;
|
2012-10-21 05:46:41 +00:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2015-05-11 16:29:12 +02:00
|
|
|
if (prv_img->flag[size] & PRV_USER_EDITED) {
|
|
|
|
|
/* user-edited preview, do not auto-update! */
|
|
|
|
|
return;
|
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2022-12-29 12:01:32 -05:00
|
|
|
const bool delay = prv_img->rect[size] != nullptr;
|
2011-05-16 18:37:54 +00:00
|
|
|
icon_create_rect(prv_img, size);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-12-16 12:12:06 +01:00
|
|
|
if (use_job && (!id || BKE_previewimg_id_supports_jobs(id))) {
|
2015-01-07 12:31:25 +01:00
|
|
|
/* Job (background) version */
|
2022-02-18 18:11:16 +01:00
|
|
|
ED_preview_icon_job(C, prv_img, id, size, delay);
|
2015-01-07 12:31:25 +01:00
|
|
|
}
|
|
|
|
|
else {
|
2015-01-12 14:44:54 +01:00
|
|
|
if (!scene) {
|
|
|
|
|
scene = CTX_data_scene(C);
|
|
|
|
|
}
|
2015-01-07 12:31:25 +01:00
|
|
|
/* Immediate version */
|
2022-02-18 18:11:16 +01:00
|
|
|
ED_preview_icon_render(C, scene, prv_img, id, size);
|
2015-01-07 12:31:25 +01:00
|
|
|
}
|
2008-11-25 18:27:41 +00:00
|
|
|
}
|
|
|
|
|
|
2013-01-22 11:18:41 +00:00
|
|
|
PreviewImage *UI_icon_to_preview(int icon_id)
|
|
|
|
|
{
|
|
|
|
|
Icon *icon = BKE_icon_get(icon_id);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2022-12-29 12:01:32 -05:00
|
|
|
if (icon == nullptr) {
|
|
|
|
|
return nullptr;
|
2020-09-21 13:21:22 -05:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-09-21 13:21:22 -05:00
|
|
|
DrawInfo *di = (DrawInfo *)icon->drawinfo;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2022-12-29 12:01:32 -05:00
|
|
|
if (di == nullptr) {
|
|
|
|
|
return nullptr;
|
2020-09-21 13:21:22 -05:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-09-21 13:21:22 -05:00
|
|
|
if (di->type == ICON_TYPE_PREVIEW) {
|
2024-04-23 15:41:55 +10:00
|
|
|
const PreviewImage *prv = (icon->id_type != 0) ? BKE_previewimg_id_ensure((ID *)icon->obj) :
|
|
|
|
|
static_cast<const PreviewImage *>(icon->obj);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-09-21 13:21:22 -05:00
|
|
|
if (prv) {
|
|
|
|
|
return BKE_previewimg_copy(prv);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if (di->data.buffer.image) {
|
|
|
|
|
ImBuf *bbuf;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2025-03-27 13:12:54 +01:00
|
|
|
bbuf = IMB_load_image_from_memory(di->data.buffer.image->datatoc_rect,
|
|
|
|
|
di->data.buffer.image->datatoc_size,
|
|
|
|
|
IB_byte_data,
|
|
|
|
|
__func__);
|
2020-09-21 13:21:22 -05:00
|
|
|
if (bbuf) {
|
|
|
|
|
PreviewImage *prv = BKE_previewimg_create();
|
|
|
|
|
|
2023-05-18 10:19:01 +02:00
|
|
|
prv->rect[0] = reinterpret_cast<uint *>(IMB_steal_byte_buffer(bbuf));
|
2020-09-21 13:21:22 -05:00
|
|
|
|
|
|
|
|
prv->w[0] = bbuf->x;
|
|
|
|
|
prv->h[0] = bbuf->y;
|
|
|
|
|
|
|
|
|
|
IMB_freeImBuf(bbuf);
|
|
|
|
|
|
|
|
|
|
return prv;
|
2019-04-17 06:17:24 +02:00
|
|
|
}
|
2015-05-11 16:29:12 +02:00
|
|
|
}
|
2020-09-21 13:21:22 -05:00
|
|
|
|
2022-12-29 12:01:32 -05:00
|
|
|
return nullptr;
|
2013-01-22 11:18:41 +00:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-07-21 16:21:42 +00:00
|
|
|
static void icon_draw_rect(float x,
|
|
|
|
|
float y,
|
|
|
|
|
int w,
|
|
|
|
|
int h,
|
|
|
|
|
int rw,
|
|
|
|
|
int rh,
|
2023-07-13 10:09:16 +10:00
|
|
|
const uint8_t *rect,
|
2019-01-04 11:05:53 +11:00
|
|
|
float alpha,
|
|
|
|
|
const float desaturate)
|
2008-11-25 18:27:41 +00:00
|
|
|
{
|
2015-05-11 16:29:12 +02:00
|
|
|
int draw_w = w;
|
|
|
|
|
int draw_h = h;
|
|
|
|
|
int draw_x = x;
|
2021-11-05 16:32:35 -05:00
|
|
|
/* We need to round y, to avoid the icon jittering in some cases. */
|
|
|
|
|
int draw_y = round_fl_to_int(y);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2010-10-17 09:01:12 +00:00
|
|
|
/* sanity check */
|
2012-03-30 01:51:25 +00:00
|
|
|
if (w <= 0 || h <= 0 || w > 2000 || h > 2000) {
|
2011-09-27 17:04:38 +00:00
|
|
|
printf("%s: icons are %i x %i pixels?\n", __func__, w, h);
|
2021-07-15 18:23:28 +10:00
|
|
|
BLI_assert_msg(0, "invalid icon size");
|
2010-10-17 09:01:12 +00:00
|
|
|
return;
|
|
|
|
|
}
|
Sorry, three commits in one, became difficult to untangle..
Editors Modules
* render/ module added in editors, moved the preview render code there and
also shading related operators.
* physics/ module made more consistent with other modules. renaming files,
making a single physics_ops.c for operators and keymaps. Also move all
particle related operators here now.
* space_buttons/ now should have only operators relevant to the buttons
specificially.
Updates & Notifiers
* Material/Texture/World/Lamp can now be passed to DAG_id_flush_update,
which will go back to a callback in editors. Eventually these should
be in the depsgraph itself, but for now this gives a unified call for
doing updates.
* GLSL materials are now refreshed on changes. There's still various
cases missing,
* Preview icons now hook into this system, solving various update cases
that were missed before.
* Also fixes issue in my last commit, where some preview would not render,
problem is avoided in the new system.
Icon Rendering
* On systems with support for non-power of two textures, an OpenGL texture
is now used instead of glDrawPixels. This avoids problems with icons get
clipped on region borders. On my Linux desktop, this gives an 1.1x speedup,
and on my Mac laptop a 2.3x speedup overall in redrawing the full window,
with the default setup. The glDrawPixels implementation on Mac seems to
have a lot of overhread.
* Preview icons are now drawn using proper premul alpha, and never faded so
you can see them clearly.
* Also tried to fix issue with texture node preview rendering, globals can't
be used with threads reliably.
2009-09-29 19:12:12 +00:00
|
|
|
/* modulate color */
|
2020-08-26 10:11:13 +10:00
|
|
|
const float col[4] = {alpha, alpha, alpha, alpha};
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2022-01-17 18:02:29 +01:00
|
|
|
float scale_x = 1.0f;
|
|
|
|
|
float scale_y = 1.0f;
|
2025-03-21 00:51:50 +00:00
|
|
|
/* `rect` contains image in render-size, we only scale if needed. */
|
2015-05-11 16:29:12 +02:00
|
|
|
if (rw != w || rh != h) {
|
|
|
|
|
/* preserve aspect ratio and center */
|
|
|
|
|
if (rw > rh) {
|
|
|
|
|
draw_w = w;
|
2023-01-03 11:04:16 +11:00
|
|
|
draw_h = int((float(rh) / float(rw)) * float(w));
|
2015-05-11 16:29:12 +02:00
|
|
|
draw_y += (h - draw_h) / 2;
|
|
|
|
|
}
|
|
|
|
|
else if (rw < rh) {
|
2023-01-03 11:04:16 +11:00
|
|
|
draw_w = int((float(rw) / float(rh)) * float(h));
|
2015-05-11 16:29:12 +02:00
|
|
|
draw_h = h;
|
|
|
|
|
draw_x += (w - draw_w) / 2;
|
|
|
|
|
}
|
2022-12-08 13:04:50 +11:00
|
|
|
scale_x = draw_w / float(rw);
|
|
|
|
|
scale_y = draw_h / float(rh);
|
2021-07-07 12:55:19 +10:00
|
|
|
/* If the image is squared, the `draw_*` initialization values are good. */
|
2010-10-17 09:01:12 +00:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2010-10-18 00:25:32 +00:00
|
|
|
/* draw */
|
2019-01-23 14:15:43 +11:00
|
|
|
eGPUBuiltinShader shader;
|
2018-04-28 13:34:52 +02:00
|
|
|
if (desaturate != 0.0f) {
|
|
|
|
|
shader = GPU_SHADER_2D_IMAGE_DESATURATE_COLOR;
|
|
|
|
|
}
|
|
|
|
|
else {
|
2022-09-05 17:34:10 -03:00
|
|
|
shader = GPU_SHADER_3D_IMAGE_COLOR;
|
2018-04-28 13:34:52 +02:00
|
|
|
}
|
2018-04-26 15:42:08 +02:00
|
|
|
IMMDrawPixelsTexState state = immDrawPixelsTexSetup(shader);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-04-28 13:34:52 +02:00
|
|
|
if (shader == GPU_SHADER_2D_IMAGE_DESATURATE_COLOR) {
|
|
|
|
|
immUniform1f("factor", desaturate);
|
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2022-01-17 18:02:29 +01:00
|
|
|
immDrawPixelsTexScaledFullSize(
|
|
|
|
|
&state, draw_x, draw_y, rw, rh, GPU_RGBA8, true, rect, scale_x, scale_y, 1.0f, 1.0f, col);
|
Sorry, three commits in one, became difficult to untangle..
Editors Modules
* render/ module added in editors, moved the preview render code there and
also shading related operators.
* physics/ module made more consistent with other modules. renaming files,
making a single physics_ops.c for operators and keymaps. Also move all
particle related operators here now.
* space_buttons/ now should have only operators relevant to the buttons
specificially.
Updates & Notifiers
* Material/Texture/World/Lamp can now be passed to DAG_id_flush_update,
which will go back to a callback in editors. Eventually these should
be in the depsgraph itself, but for now this gives a unified call for
doing updates.
* GLSL materials are now refreshed on changes. There's still various
cases missing,
* Preview icons now hook into this system, solving various update cases
that were missed before.
* Also fixes issue in my last commit, where some preview would not render,
problem is avoided in the new system.
Icon Rendering
* On systems with support for non-power of two textures, an OpenGL texture
is now used instead of glDrawPixels. This avoids problems with icons get
clipped on region borders. On my Linux desktop, this gives an 1.1x speedup,
and on my Mac laptop a 2.3x speedup overall in redrawing the full window,
with the default setup. The glDrawPixels implementation on Mac seems to
have a lot of overhread.
* Preview icons are now drawn using proper premul alpha, and never faded so
you can see them clearly.
* Also tried to fix issue with texture node preview rendering, globals can't
be used with threads reliably.
2009-09-29 19:12:12 +00:00
|
|
|
}
|
|
|
|
|
|
2011-05-16 18:37:54 +00:00
|
|
|
/* Drawing size for preview images */
|
|
|
|
|
static int get_draw_size(enum eIconSizes size)
|
2008-11-25 18:27:41 +00:00
|
|
|
{
|
2011-05-16 18:37:54 +00:00
|
|
|
switch (size) {
|
2015-05-11 16:29:12 +02:00
|
|
|
case ICON_SIZE_ICON:
|
|
|
|
|
return ICON_DEFAULT_HEIGHT;
|
|
|
|
|
case ICON_SIZE_PREVIEW:
|
|
|
|
|
return PREVIEW_DEFAULT_HEIGHT;
|
|
|
|
|
default:
|
|
|
|
|
return 0;
|
2019-04-17 06:17:24 +02:00
|
|
|
}
|
2008-11-25 18:27:41 +00:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2024-08-11 20:10:32 +02:00
|
|
|
static void svg_replace_color_attributes(std::string &svg,
|
|
|
|
|
const std::string &name,
|
|
|
|
|
const size_t start,
|
|
|
|
|
const size_t end)
|
|
|
|
|
{
|
|
|
|
|
bTheme *btheme = UI_GetTheme();
|
|
|
|
|
|
|
|
|
|
uchar white[] = {255, 255, 255, 255};
|
|
|
|
|
uchar black[] = {0, 0, 0, 255};
|
|
|
|
|
uchar logo_orange[] = {232, 125, 13, 255};
|
|
|
|
|
uchar logo_blue[] = {38, 87, 135, 255};
|
|
|
|
|
|
|
|
|
|
/* Tool colors hardcoded for now. */
|
|
|
|
|
uchar tool_add[] = {117, 255, 175, 255};
|
|
|
|
|
uchar tool_remove[] = {245, 107, 91, 255};
|
|
|
|
|
uchar tool_select[] = {255, 176, 43, 255};
|
|
|
|
|
uchar tool_transform[] = {217, 175, 245, 255};
|
|
|
|
|
uchar tool_white[] = {255, 255, 255, 255};
|
|
|
|
|
uchar tool_red[] = {214, 45, 48, 255};
|
|
|
|
|
|
2025-02-05 14:31:14 +11:00
|
|
|
const struct ColorItem {
|
2024-08-11 20:10:32 +02:00
|
|
|
const char *name;
|
|
|
|
|
uchar *col = nullptr;
|
|
|
|
|
int colorid = TH_UNDEFINED;
|
|
|
|
|
int spacetype = SPACE_TYPE_ANY;
|
|
|
|
|
} items[] = {
|
2024-08-24 00:28:34 +02:00
|
|
|
{"blender_white", white},
|
|
|
|
|
{"blender_black", black},
|
|
|
|
|
{"blender_logo_orange", logo_orange},
|
|
|
|
|
{"blender_logo_blue", logo_blue},
|
|
|
|
|
{"blender_selected", btheme->tui.wcol_regular.inner},
|
|
|
|
|
{"blender_mesh_selected", btheme->space_view3d.vertex_select},
|
|
|
|
|
{"blender_back", nullptr, TH_BACK},
|
|
|
|
|
{"blender_text", nullptr, TH_TEXT},
|
|
|
|
|
{"blender_text_hi", nullptr, TH_TEXT_HI},
|
2025-02-12 20:59:47 +01:00
|
|
|
{"blender_red_alert", nullptr, TH_ERROR},
|
|
|
|
|
{"blender_error", nullptr, TH_ERROR},
|
|
|
|
|
{"blender_warning", nullptr, TH_WARNING},
|
|
|
|
|
{"blender_info", nullptr, TH_INFO},
|
2024-08-24 00:28:34 +02:00
|
|
|
{"blender_scene", nullptr, TH_ICON_SCENE},
|
|
|
|
|
{"blender_collection", nullptr, TH_ICON_COLLECTION},
|
|
|
|
|
{"blender_object", nullptr, TH_ICON_OBJECT},
|
|
|
|
|
{"blender_object_data", nullptr, TH_ICON_OBJECT_DATA},
|
|
|
|
|
{"blender_modifier", nullptr, TH_ICON_MODIFIER},
|
|
|
|
|
{"blender_shading", nullptr, TH_ICON_SHADING},
|
|
|
|
|
{"blender_folder", nullptr, TH_ICON_FOLDER},
|
|
|
|
|
{"blender_fund", nullptr, TH_ICON_FUND},
|
|
|
|
|
{"blender_autokey", nullptr, TH_ICON_AUTOKEY},
|
|
|
|
|
{"blender_tool_add", tool_add},
|
|
|
|
|
{"blender_tool_remove", tool_remove},
|
|
|
|
|
{"blender_tool_select", tool_select},
|
|
|
|
|
{"blender_tool_transform", tool_transform},
|
|
|
|
|
{"blender_tool_white", tool_white},
|
|
|
|
|
{"blender_tool_red", tool_red},
|
2024-08-11 20:10:32 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
for (const ColorItem &item : items) {
|
|
|
|
|
if (name != item.name) {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
uchar color[4];
|
|
|
|
|
if (item.col) {
|
|
|
|
|
memcpy(color, item.col, sizeof(color));
|
|
|
|
|
}
|
|
|
|
|
else if (item.colorid != TH_UNDEFINED) {
|
|
|
|
|
if (item.spacetype != SPACE_TYPE_ANY) {
|
|
|
|
|
UI_GetThemeColorType4ubv(item.colorid, item.spacetype, color);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
UI_GetThemeColor4ubv(item.colorid, color);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
std::string hexcolor = fmt::format(
|
|
|
|
|
"{:02x}{:02x}{:02x}{:02x}", color[0], color[1], color[2], color[3]);
|
|
|
|
|
|
|
|
|
|
size_t att_start = start;
|
2024-08-26 11:34:42 +10:00
|
|
|
while (true) {
|
2024-08-11 20:10:32 +02:00
|
|
|
constexpr static blender::StringRef key = "fill=\"";
|
|
|
|
|
att_start = svg.find(key, att_start);
|
|
|
|
|
if (att_start == std::string::npos || att_start > end) {
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
const size_t att_end = svg.find("\"", att_start + key.size());
|
|
|
|
|
if (att_end != std::string::npos && att_end < end) {
|
|
|
|
|
svg.replace(att_start, att_end - att_start, key + "#" + hexcolor);
|
|
|
|
|
}
|
|
|
|
|
att_start += blender::StringRef(key + "#rrggbbaa\"").size();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
att_start = start;
|
2024-08-26 11:34:42 +10:00
|
|
|
while (true) {
|
2024-08-11 20:10:32 +02:00
|
|
|
constexpr static blender::StringRef key = "fill:";
|
|
|
|
|
att_start = svg.find(key, att_start);
|
|
|
|
|
if (att_start == std::string::npos || att_start > end) {
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
const size_t att_end = svg.find(";", att_start + key.size());
|
|
|
|
|
if (att_end != std::string::npos && att_end - att_start < end) {
|
|
|
|
|
svg.replace(att_start, att_end - att_start, key + "#" + hexcolor);
|
|
|
|
|
}
|
|
|
|
|
att_start += blender::StringRef(key + "#rrggbbaa").size();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void icon_source_edit_cb(std::string &svg)
|
|
|
|
|
{
|
|
|
|
|
size_t g_start = 0;
|
|
|
|
|
|
|
|
|
|
/* Scan string, processing only groups with our keyword ids. */
|
|
|
|
|
|
2024-08-26 11:34:42 +10:00
|
|
|
while (true) {
|
2024-08-11 20:10:32 +02:00
|
|
|
/* Look for a blender id, quick exit if not found. */
|
|
|
|
|
constexpr static blender::StringRef key = "id=\"";
|
2024-08-24 00:28:34 +02:00
|
|
|
const size_t id_start = svg.find(key + "blender_", g_start);
|
2024-08-11 20:10:32 +02:00
|
|
|
if (id_start == std::string::npos) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Scan back to beginning of this group element. */
|
|
|
|
|
g_start = svg.rfind("<g", id_start);
|
|
|
|
|
if (g_start == std::string::npos) {
|
|
|
|
|
/* Malformed. */
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Scan forward to end of the group. */
|
|
|
|
|
const size_t g_end = svg.find("</g>", id_start);
|
|
|
|
|
if (g_end == std::string::npos) {
|
|
|
|
|
/* Malformed. */
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Get group id name. */
|
|
|
|
|
const size_t id_end = svg.find("\"", id_start + key.size());
|
|
|
|
|
if (id_end != std::string::npos) {
|
|
|
|
|
std::string id_name = svg.substr(id_start + key.size(), id_end - id_start - key.size());
|
|
|
|
|
/* Replace this group's colors. */
|
|
|
|
|
svg_replace_color_attributes(svg, id_name, g_start, g_end);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
g_start = g_end;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2015-05-05 03:13:47 +10:00
|
|
|
static void icon_draw_size(float x,
|
|
|
|
|
float y,
|
|
|
|
|
int icon_id,
|
|
|
|
|
float aspect,
|
|
|
|
|
float alpha,
|
2018-09-27 18:25:50 +02:00
|
|
|
enum eIconSizes size,
|
|
|
|
|
int draw_size,
|
|
|
|
|
const float desaturate,
|
2019-08-06 04:20:17 +10:00
|
|
|
const uchar mono_rgba[4],
|
2022-10-20 16:37:07 +02:00
|
|
|
const bool mono_border,
|
2024-05-06 23:52:37 +02:00
|
|
|
const IconTextOverlay *text_overlay,
|
|
|
|
|
const bool inverted = false)
|
2008-11-25 18:27:41 +00:00
|
|
|
{
|
2024-06-22 19:26:21 +02:00
|
|
|
if (icon_id == ICON_NONE) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2012-03-30 01:51:25 +00:00
|
|
|
bTheme *btheme = UI_GetTheme();
|
2022-12-08 13:04:50 +11:00
|
|
|
const float fdraw_size = float(draw_size);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-09-21 12:14:31 -05:00
|
|
|
Icon *icon = BKE_icon_get(icon_id);
|
2024-12-10 18:19:28 +01:00
|
|
|
|
2022-12-29 12:01:32 -05:00
|
|
|
if (icon == nullptr) {
|
2019-03-25 10:15:20 +11:00
|
|
|
if (G.debug & G_DEBUG) {
|
2011-09-27 17:04:38 +00:00
|
|
|
printf("%s: Internal error, no icon for icon ID: %d\n", __func__, icon_id);
|
2019-03-25 10:15:20 +11:00
|
|
|
}
|
2025-03-03 22:25:42 +01:00
|
|
|
icon_id = ICON_NOT_FOUND;
|
|
|
|
|
icon = BKE_icon_get(icon_id);
|
2008-11-25 18:27:41 +00:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2024-12-13 11:28:27 +01:00
|
|
|
if (icon->obj_type != ICON_DATA_STUDIOLIGHT) {
|
|
|
|
|
/* Icon alpha should not apply to MatCap/Studio lighting. #80356. */
|
|
|
|
|
alpha *= btheme->tui.icon_alpha;
|
|
|
|
|
}
|
|
|
|
|
|
2008-11-25 18:27:41 +00:00
|
|
|
/* scale width and height according to aspect */
|
2023-01-03 11:04:16 +11:00
|
|
|
int w = int(fdraw_size / aspect + 0.5f);
|
2022-12-08 13:04:50 +11:00
|
|
|
int h = int(fdraw_size / aspect + 0.5f);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-04-20 15:15:10 +02:00
|
|
|
DrawInfo *di = icon_ensure_drawinfo(icon);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-01-03 15:38:22 +01:00
|
|
|
/* We need to flush widget base first to ensure correct ordering. */
|
|
|
|
|
UI_widgetbase_draw_cache_flush();
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-12-14 13:21:58 +01:00
|
|
|
if (di->type == ICON_TYPE_IMBUF) {
|
2023-07-13 10:09:16 +10:00
|
|
|
const ImBuf *ibuf = static_cast<const ImBuf *>(icon->obj);
|
2020-12-14 13:21:58 +01:00
|
|
|
|
|
|
|
|
GPU_blend(GPU_BLEND_ALPHA_PREMULT);
|
2024-04-24 12:37:38 +02:00
|
|
|
icon_draw_rect(x, y, w, h, ibuf->x, ibuf->y, ibuf->byte_buffer.data, alpha, desaturate);
|
2020-12-14 13:21:58 +01:00
|
|
|
GPU_blend(GPU_BLEND_ALPHA);
|
|
|
|
|
}
|
|
|
|
|
else if (di->type == ICON_TYPE_VECTOR) {
|
2008-11-25 18:27:41 +00:00
|
|
|
/* vector icons use the uiBlock transformation, they are not drawn
|
2012-03-03 16:31:46 +00:00
|
|
|
* with untransformed coordinates like the other icons */
|
2025-04-15 23:01:01 +02:00
|
|
|
di->data.vector.func(
|
|
|
|
|
x, y, float(draw_size) / aspect, float(draw_size) / aspect, alpha, mono_rgba);
|
2012-10-21 05:46:41 +00:00
|
|
|
}
|
2018-04-20 15:15:10 +02:00
|
|
|
else if (di->type == ICON_TYPE_GEOM) {
|
2018-06-06 09:27:23 +02:00
|
|
|
#ifdef USE_UI_TOOLBAR_HACK
|
2023-02-09 11:30:25 +11:00
|
|
|
/* TODO(@ideasman42): scale icons up for toolbar,
|
2019-01-15 23:24:20 +11:00
|
|
|
* we need a way to detect larger buttons and do this automatic. */
|
2018-04-24 09:19:28 +02:00
|
|
|
{
|
2022-12-08 13:04:50 +11:00
|
|
|
float scale = float(ICON_DEFAULT_HEIGHT_TOOLBAR) / float(ICON_DEFAULT_HEIGHT);
|
2018-04-24 09:19:28 +02:00
|
|
|
y = (y + (h / 2)) - ((h * scale) / 2);
|
|
|
|
|
w *= scale;
|
|
|
|
|
h *= scale;
|
|
|
|
|
}
|
2018-04-25 21:01:36 +02:00
|
|
|
#endif
|
2018-04-24 09:19:28 +02:00
|
|
|
|
2020-02-03 17:47:04 +01:00
|
|
|
/* If the theme is light, we will adjust the icon colors. */
|
2025-01-21 09:21:36 +01:00
|
|
|
const bool invert = (srgb_to_grayscale_byte(btheme->tui.wcol_toolbar_item.inner) > 128);
|
2020-02-03 17:47:04 +01:00
|
|
|
const bool geom_inverted = di->data.geom.inverted;
|
|
|
|
|
|
2018-04-21 21:10:09 +02:00
|
|
|
/* This could re-generate often if rendered at different sizes in the one interface.
|
2023-02-09 11:30:25 +11:00
|
|
|
* TODO(@ideasman42): support caching multiple sizes. */
|
2018-04-21 21:10:09 +02:00
|
|
|
ImBuf *ibuf = di->data.geom.image_cache;
|
2022-12-29 12:01:32 -05:00
|
|
|
if ((ibuf == nullptr) || (ibuf->x != w) || (ibuf->y != h) || (invert != geom_inverted)) {
|
2018-04-21 21:10:09 +02:00
|
|
|
if (ibuf) {
|
|
|
|
|
IMB_freeImBuf(ibuf);
|
2018-04-20 15:15:10 +02:00
|
|
|
}
|
2020-02-03 17:47:04 +01:00
|
|
|
if (invert != geom_inverted) {
|
2022-11-25 23:48:02 -06:00
|
|
|
BKE_icon_geom_invert_lightness(static_cast<Icon_Geom *>(icon->obj));
|
2020-02-03 17:47:04 +01:00
|
|
|
}
|
2022-11-25 23:48:02 -06:00
|
|
|
ibuf = BKE_icon_geom_rasterize(static_cast<Icon_Geom *>(icon->obj), w, h);
|
2018-04-21 21:10:09 +02:00
|
|
|
di->data.geom.image_cache = ibuf;
|
2020-02-03 17:47:04 +01:00
|
|
|
di->data.geom.inverted = invert;
|
2018-04-20 15:15:10 +02:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-08-16 15:38:34 +02:00
|
|
|
GPU_blend(GPU_BLEND_ALPHA_PREMULT);
|
2024-04-24 12:37:38 +02:00
|
|
|
icon_draw_rect(x, y, w, h, w, h, ibuf->byte_buffer.data, alpha, desaturate);
|
2020-08-16 15:38:34 +02:00
|
|
|
GPU_blend(GPU_BLEND_ALPHA);
|
2018-04-20 15:15:10 +02:00
|
|
|
}
|
2018-07-08 11:57:59 +02:00
|
|
|
else if (di->type == ICON_TYPE_EVENT) {
|
2024-08-05 02:42:26 +02:00
|
|
|
icon_draw_rect_input(x, y, w, h, icon_id, aspect, alpha, inverted);
|
2018-07-08 11:57:59 +02:00
|
|
|
}
|
2024-07-17 22:15:09 +02:00
|
|
|
else if (ELEM(di->type, ICON_TYPE_SVG_MONO, ICON_TYPE_SVG_COLOR)) {
|
2024-06-27 23:00:53 +02:00
|
|
|
float outline_intensity = mono_border ? (btheme->tui.icon_border_intensity > 0.0f ?
|
|
|
|
|
btheme->tui.icon_border_intensity :
|
2024-08-18 22:11:53 +02:00
|
|
|
0.3f) :
|
2024-06-27 23:00:53 +02:00
|
|
|
0.0f;
|
2024-08-07 23:28:17 +02:00
|
|
|
float color[4];
|
2025-03-03 22:25:42 +01:00
|
|
|
if (icon_id == ICON_NOT_FOUND) {
|
|
|
|
|
UI_GetThemeColor4fv(TH_ERROR, color);
|
|
|
|
|
}
|
|
|
|
|
else if (mono_rgba) {
|
2025-01-26 20:08:00 +01:00
|
|
|
rgba_uchar_to_float(color, mono_rgba);
|
2018-10-02 19:04:38 +02:00
|
|
|
}
|
2019-05-09 15:53:44 +02:00
|
|
|
else {
|
2024-08-07 23:28:17 +02:00
|
|
|
UI_GetThemeColor4fv(TH_TEXT, color);
|
2019-05-09 15:53:44 +02:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2024-08-07 23:28:17 +02:00
|
|
|
color[3] *= alpha;
|
2024-08-11 20:10:32 +02:00
|
|
|
|
|
|
|
|
if (di->type == ICON_TYPE_SVG_COLOR) {
|
|
|
|
|
BLF_draw_svg_icon(uint(icon_id),
|
|
|
|
|
x,
|
|
|
|
|
y,
|
|
|
|
|
float(draw_size) / aspect,
|
|
|
|
|
color,
|
|
|
|
|
outline_intensity,
|
|
|
|
|
true,
|
|
|
|
|
icon_source_edit_cb);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
BLF_draw_svg_icon(uint(icon_id),
|
|
|
|
|
x,
|
|
|
|
|
y,
|
|
|
|
|
float(draw_size) / aspect,
|
|
|
|
|
color,
|
|
|
|
|
outline_intensity,
|
|
|
|
|
false,
|
|
|
|
|
nullptr);
|
|
|
|
|
}
|
2024-08-07 23:28:17 +02:00
|
|
|
|
2024-06-21 22:37:33 +02:00
|
|
|
if (text_overlay && text_overlay->text[0] != '\0') {
|
|
|
|
|
/* Handle the little numbers on top of the icon. */
|
|
|
|
|
uchar text_color[4];
|
|
|
|
|
if (text_overlay->color[3]) {
|
|
|
|
|
copy_v4_v4_uchar(text_color, text_overlay->color);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
UI_GetThemeColor4ubv(TH_TEXT, text_color);
|
|
|
|
|
}
|
2025-01-21 09:21:36 +01:00
|
|
|
const bool is_light = srgb_to_grayscale_byte(text_color) > 96;
|
2024-06-21 22:37:33 +02:00
|
|
|
const float zoom_factor = w / UI_ICON_SIZE;
|
|
|
|
|
uiFontStyle fstyle_small = *UI_FSTYLE_WIDGET;
|
|
|
|
|
fstyle_small.points *= zoom_factor * 0.8f;
|
2024-08-12 21:23:12 +02:00
|
|
|
fstyle_small.shadow = short(is_light ? FontShadowType::Outline : FontShadowType::None);
|
2024-06-21 22:37:33 +02:00
|
|
|
fstyle_small.shadx = 0;
|
|
|
|
|
fstyle_small.shady = 0;
|
|
|
|
|
rcti text_rect = {int(x), int(x + UI_UNIT_X * zoom_factor), int(y), int(y)};
|
|
|
|
|
uiFontStyleDraw_Params params = {UI_STYLE_TEXT_RIGHT, 0};
|
|
|
|
|
UI_fontstyle_draw(&fstyle_small,
|
|
|
|
|
&text_rect,
|
|
|
|
|
text_overlay->text,
|
|
|
|
|
sizeof(text_overlay->text),
|
|
|
|
|
text_color,
|
|
|
|
|
¶ms);
|
2019-05-09 15:53:44 +02:00
|
|
|
}
|
2018-07-02 15:28:47 +02:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-03-24 06:38:07 +00:00
|
|
|
else if (di->type == ICON_TYPE_BUFFER) {
|
2012-10-21 05:46:41 +00:00
|
|
|
/* it is a builtin icon */
|
2020-09-21 12:14:31 -05:00
|
|
|
IconImage *iimg = di->data.buffer.image;
|
2013-02-01 08:24:18 +00:00
|
|
|
#ifndef WITH_HEADLESS
|
2013-01-22 11:18:41 +00:00
|
|
|
icon_verify_datatoc(iimg);
|
2013-02-01 08:24:18 +00:00
|
|
|
#endif
|
2019-03-25 10:15:20 +11:00
|
|
|
if (!iimg->rect) {
|
|
|
|
|
/* something has gone wrong! */
|
|
|
|
|
return;
|
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2024-04-24 12:37:38 +02:00
|
|
|
icon_draw_rect(x, y, w, h, iimg->w, iimg->h, iimg->rect, alpha, desaturate);
|
2008-11-25 18:27:41 +00:00
|
|
|
}
|
2012-03-24 06:38:07 +00:00
|
|
|
else if (di->type == ICON_TYPE_PREVIEW) {
|
2018-04-19 12:52:32 +02:00
|
|
|
PreviewImage *pi = (icon->id_type != 0) ? BKE_previewimg_id_ensure((ID *)icon->obj) :
|
2022-11-25 23:48:02 -06:00
|
|
|
static_cast<PreviewImage *>(icon->obj);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-10-21 05:46:41 +00:00
|
|
|
if (pi) {
|
2009-06-25 15:41:27 +00:00
|
|
|
/* no create icon on this level in code */
|
2019-03-25 10:15:20 +11:00
|
|
|
if (!pi->rect[size]) {
|
|
|
|
|
/* Something has gone wrong! */
|
|
|
|
|
return;
|
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-01-02 20:10:48 +01:00
|
|
|
/* Preview images use premultiplied alpha. */
|
2020-08-16 15:38:34 +02:00
|
|
|
GPU_blend(GPU_BLEND_ALPHA_PREMULT);
|
2023-05-18 10:19:01 +02:00
|
|
|
icon_draw_rect(x,
|
|
|
|
|
y,
|
|
|
|
|
w,
|
|
|
|
|
h,
|
|
|
|
|
pi->w[size],
|
|
|
|
|
pi->h[size],
|
2023-07-13 10:09:16 +10:00
|
|
|
reinterpret_cast<const uint8_t *>(pi->rect[size]),
|
2023-05-18 10:19:01 +02:00
|
|
|
alpha,
|
|
|
|
|
desaturate);
|
2020-08-16 15:38:34 +02:00
|
|
|
GPU_blend(GPU_BLEND_ALPHA);
|
2008-11-25 18:27:41 +00:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
}
|
2018-07-31 10:22:19 +02:00
|
|
|
else if (di->type == ICON_TYPE_GPLAYER) {
|
2022-12-29 12:01:32 -05:00
|
|
|
BLI_assert(icon->obj != nullptr);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-07-31 10:22:19 +02:00
|
|
|
/* Just draw a colored rect - Like for vicon_colorset_draw() */
|
2018-11-12 09:18:45 +11:00
|
|
|
#ifndef WITH_HEADLESS
|
2022-12-08 13:04:50 +11:00
|
|
|
vicon_gplayer_color_draw(icon, int(x), int(y), w, h);
|
2018-11-12 09:18:45 +11:00
|
|
|
#endif
|
2018-07-31 10:22:19 +02:00
|
|
|
}
|
2008-11-25 18:27:41 +00:00
|
|
|
}
|
|
|
|
|
|
2015-01-12 14:44:54 +01:00
|
|
|
static void ui_id_preview_image_render_size(
|
|
|
|
|
const bContext *C, Scene *scene, ID *id, PreviewImage *pi, int size, const bool use_job)
|
2012-02-17 16:06:32 +00:00
|
|
|
{
|
2019-01-15 23:24:20 +11:00
|
|
|
/* changed only ever set by dynamic icons */
|
2025-01-28 19:32:54 +01:00
|
|
|
if ((pi->flag[size] & PRV_CHANGED) || (!pi->rect[size] && !BKE_previewimg_is_invalid(pi))) {
|
2012-02-17 16:06:32 +00:00
|
|
|
/* create the rect if necessary */
|
2022-11-25 23:48:02 -06:00
|
|
|
icon_set_image(C, scene, id, pi, eIconSizes(size), use_job);
|
2012-02-17 16:06:32 +00:00
|
|
|
|
2015-05-11 16:29:12 +02:00
|
|
|
pi->flag[size] &= ~PRV_CHANGED;
|
2012-02-17 16:06:32 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-01-26 15:05:31 +01:00
|
|
|
void UI_icon_render_id_ex(const bContext *C,
|
|
|
|
|
Scene *scene,
|
|
|
|
|
ID *id_to_render,
|
|
|
|
|
const enum eIconSizes size,
|
|
|
|
|
const bool use_job,
|
|
|
|
|
PreviewImage *r_preview_image)
|
|
|
|
|
{
|
|
|
|
|
ui_id_preview_image_render_size(C, scene, id_to_render, r_preview_image, size, use_job);
|
|
|
|
|
}
|
|
|
|
|
|
2021-01-02 15:29:01 +01:00
|
|
|
void UI_icon_render_id(
|
|
|
|
|
const bContext *C, Scene *scene, ID *id, const enum eIconSizes size, const bool use_job)
|
2011-01-19 17:10:05 +00:00
|
|
|
{
|
2015-05-11 16:29:12 +02:00
|
|
|
PreviewImage *pi = BKE_previewimg_id_ensure(id);
|
2022-12-29 12:01:32 -05:00
|
|
|
if (pi == nullptr) {
|
2020-09-21 13:21:22 -05:00
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2022-01-26 15:05:31 +01:00
|
|
|
ID *id_to_render = id;
|
|
|
|
|
|
2021-11-22 21:02:46 +01:00
|
|
|
/* For objects, first try if a preview can created via the object data. */
|
|
|
|
|
if (GS(id->name) == ID_OB) {
|
|
|
|
|
Object *ob = (Object *)id;
|
2022-11-25 23:48:02 -06:00
|
|
|
if (ED_preview_id_is_supported(static_cast<const ID *>(ob->data))) {
|
|
|
|
|
id_to_render = static_cast<ID *>(ob->data);
|
2021-11-22 21:02:46 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-01-26 15:05:31 +01:00
|
|
|
if (!ED_preview_id_is_supported(id_to_render)) {
|
2021-11-22 20:00:47 +01:00
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2022-01-26 15:05:31 +01:00
|
|
|
UI_icon_render_id_ex(C, scene, id_to_render, size, use_job, pi);
|
2011-01-19 17:10:05 +00:00
|
|
|
}
|
|
|
|
|
|
2016-12-01 16:43:57 +01:00
|
|
|
static void ui_id_icon_render(const bContext *C, ID *id, bool use_jobs)
|
2009-06-25 15:41:27 +00:00
|
|
|
{
|
2015-05-11 16:29:12 +02:00
|
|
|
PreviewImage *pi = BKE_previewimg_id_ensure(id);
|
2018-05-23 10:47:12 +02:00
|
|
|
|
2019-03-25 10:15:20 +11:00
|
|
|
if (!pi) {
|
2011-01-18 04:08:01 +00:00
|
|
|
return;
|
2019-03-25 10:15:20 +11:00
|
|
|
}
|
2018-05-23 10:47:12 +02:00
|
|
|
|
2022-11-25 23:48:02 -06:00
|
|
|
for (int i = 0; i < NUM_ICON_SIZES; i++) {
|
2022-12-29 12:01:32 -05:00
|
|
|
ui_id_preview_image_render_size(C, nullptr, id, pi, i, use_jobs);
|
2009-06-25 15:41:27 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2016-12-01 16:43:57 +01:00
|
|
|
static int ui_id_screen_get_icon(const bContext *C, ID *id)
|
|
|
|
|
{
|
|
|
|
|
BKE_icon_id_ensure(id);
|
2021-07-26 12:32:42 +10:00
|
|
|
/* Don't use jobs here, off-screen rendering doesn't like this and crashes. */
|
2016-12-01 16:43:57 +01:00
|
|
|
ui_id_icon_render(C, id, false);
|
|
|
|
|
|
|
|
|
|
return id->icon_id;
|
|
|
|
|
}
|
|
|
|
|
|
2015-01-01 23:26:03 +11:00
|
|
|
int ui_id_icon_get(const bContext *C, ID *id, const bool big)
|
2009-06-27 01:15:31 +00:00
|
|
|
{
|
2012-03-30 01:51:25 +00:00
|
|
|
int iconid = 0;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2009-06-27 01:15:31 +00:00
|
|
|
/* icon */
|
2012-03-30 01:51:25 +00:00
|
|
|
switch (GS(id->name)) {
|
2009-06-27 01:15:31 +00:00
|
|
|
case ID_MA: /* fall through */
|
|
|
|
|
case ID_TE: /* fall through */
|
|
|
|
|
case ID_IM: /* fall through */
|
|
|
|
|
case ID_WO: /* fall through */
|
|
|
|
|
case ID_LA: /* fall through */
|
2015-05-11 16:29:12 +02:00
|
|
|
iconid = BKE_icon_id_ensure(id);
|
2009-06-27 01:15:31 +00:00
|
|
|
/* checks if not exists, or changed */
|
2022-12-29 12:01:32 -05:00
|
|
|
UI_icon_render_id(C, nullptr, id, big ? ICON_SIZE_PREVIEW : ICON_SIZE_ICON, true);
|
2009-06-27 01:15:31 +00:00
|
|
|
break;
|
2016-12-01 16:43:57 +01:00
|
|
|
case ID_SCR:
|
|
|
|
|
iconid = ui_id_screen_get_icon(C, id);
|
|
|
|
|
break;
|
2020-09-15 12:22:03 -06:00
|
|
|
case ID_GR:
|
2020-09-18 10:24:14 +10:00
|
|
|
iconid = UI_icon_color_from_collection((Collection *)id);
|
2020-09-15 12:22:03 -06:00
|
|
|
break;
|
2009-06-27 01:15:31 +00:00
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2009-06-27 01:15:31 +00:00
|
|
|
return iconid;
|
|
|
|
|
}
|
2009-06-25 15:41:27 +00:00
|
|
|
|
2020-09-18 10:24:14 +10:00
|
|
|
int UI_icon_from_library(const ID *id)
|
2020-06-29 17:19:43 +02:00
|
|
|
{
|
|
|
|
|
if (ID_IS_LINKED(id)) {
|
2024-08-07 12:12:17 +02:00
|
|
|
if (id->tag & ID_TAG_MISSING) {
|
2020-06-29 17:19:43 +02:00
|
|
|
return ICON_LIBRARY_DATA_BROKEN;
|
|
|
|
|
}
|
2024-08-07 12:12:17 +02:00
|
|
|
if (id->tag & ID_TAG_INDIRECT) {
|
2020-06-29 17:19:43 +02:00
|
|
|
return ICON_LIBRARY_DATA_INDIRECT;
|
|
|
|
|
}
|
2020-07-03 14:20:10 +02:00
|
|
|
return ICON_LIBRARY_DATA_DIRECT;
|
2020-06-29 17:19:43 +02:00
|
|
|
}
|
2020-07-03 14:20:10 +02:00
|
|
|
if (ID_IS_OVERRIDE_LIBRARY(id)) {
|
2022-03-29 17:26:13 +02:00
|
|
|
if (!ID_IS_OVERRIDE_LIBRARY_REAL(id) ||
|
2023-05-02 16:13:02 +02:00
|
|
|
(id->override_library->flag & LIBOVERRIDE_FLAG_SYSTEM_DEFINED) != 0)
|
2022-03-29 17:26:13 +02:00
|
|
|
{
|
|
|
|
|
return ICON_LIBRARY_DATA_OVERRIDE_NONEDITABLE;
|
|
|
|
|
}
|
2020-06-29 17:19:43 +02:00
|
|
|
return ICON_LIBRARY_DATA_OVERRIDE;
|
|
|
|
|
}
|
2020-12-16 11:58:30 +01:00
|
|
|
if (ID_IS_ASSET(id)) {
|
2020-12-21 13:30:40 +01:00
|
|
|
return ICON_ASSET_MANAGER;
|
2020-12-16 11:58:30 +01:00
|
|
|
}
|
2020-06-29 17:19:43 +02:00
|
|
|
|
|
|
|
|
return ICON_NONE;
|
|
|
|
|
}
|
|
|
|
|
|
2021-07-13 18:05:16 +02:00
|
|
|
int UI_icon_from_rnaptr(const bContext *C, PointerRNA *ptr, int rnaicon, const bool big)
|
This commit frees list ui items from their dependencies to Panel, and hence from all the limitations this implied (mostly, the "only one list per panel" one).
It introduces a new (py-extendable and registrable) RNA type, UIList (roughly similar to Panel one), which currently contains only "standard" list's scroll pos and size (but may be expended to include e.g. some filtering data, etc.). This now makes lists completely independent from Panels!
This UIList has a draw_item callback which allows to customize items' drawing from python, that all addons can now use. Incidentally, this also greatly simplifies the C code of this widget, as we do not code any "special case" here anymore!
To make all this work, other changes were also necessary:
* Now all buttons (uiBut struct) have a 'custom_data' void pointer, used currently to store the uiList struct associated with a given uiLayoutListBox.
* DynamicPaintSurface now exposes a new bool, use_color_preview (readonly), saying whether that surface has some 3D view preview data or not.
* UILayout class has now four new (static) functions, to get the actual icon of any RNA object (important e.g. with materials or textures), and to get an enum item's UI name, description and icon.
* UILayout's label() func now takes an optional 'icon_value' integer parameter, which if not zero will override the 'icon' one (mandatory to use "custom" icons as generated for material/texture/... previews).
Note: not sure whether we should add that one to all UILayout's prop funcs?
Note: will update addons using template list asap.
2012-12-28 09:20:16 +00:00
|
|
|
{
|
2022-12-29 12:01:32 -05:00
|
|
|
ID *id = nullptr;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-03-25 10:15:20 +11:00
|
|
|
if (!ptr->data) {
|
This commit frees list ui items from their dependencies to Panel, and hence from all the limitations this implied (mostly, the "only one list per panel" one).
It introduces a new (py-extendable and registrable) RNA type, UIList (roughly similar to Panel one), which currently contains only "standard" list's scroll pos and size (but may be expended to include e.g. some filtering data, etc.). This now makes lists completely independent from Panels!
This UIList has a draw_item callback which allows to customize items' drawing from python, that all addons can now use. Incidentally, this also greatly simplifies the C code of this widget, as we do not code any "special case" here anymore!
To make all this work, other changes were also necessary:
* Now all buttons (uiBut struct) have a 'custom_data' void pointer, used currently to store the uiList struct associated with a given uiLayoutListBox.
* DynamicPaintSurface now exposes a new bool, use_color_preview (readonly), saying whether that surface has some 3D view preview data or not.
* UILayout class has now four new (static) functions, to get the actual icon of any RNA object (important e.g. with materials or textures), and to get an enum item's UI name, description and icon.
* UILayout's label() func now takes an optional 'icon_value' integer parameter, which if not zero will override the 'icon' one (mandatory to use "custom" icons as generated for material/texture/... previews).
Note: not sure whether we should add that one to all UILayout's prop funcs?
Note: will update addons using template list asap.
2012-12-28 09:20:16 +00:00
|
|
|
return rnaicon;
|
2019-03-25 10:15:20 +11:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2022-12-13 12:34:32 +11:00
|
|
|
/* Try ID, material, texture or dynamic-paint slot. */
|
This commit frees list ui items from their dependencies to Panel, and hence from all the limitations this implied (mostly, the "only one list per panel" one).
It introduces a new (py-extendable and registrable) RNA type, UIList (roughly similar to Panel one), which currently contains only "standard" list's scroll pos and size (but may be expended to include e.g. some filtering data, etc.). This now makes lists completely independent from Panels!
This UIList has a draw_item callback which allows to customize items' drawing from python, that all addons can now use. Incidentally, this also greatly simplifies the C code of this widget, as we do not code any "special case" here anymore!
To make all this work, other changes were also necessary:
* Now all buttons (uiBut struct) have a 'custom_data' void pointer, used currently to store the uiList struct associated with a given uiLayoutListBox.
* DynamicPaintSurface now exposes a new bool, use_color_preview (readonly), saying whether that surface has some 3D view preview data or not.
* UILayout class has now four new (static) functions, to get the actual icon of any RNA object (important e.g. with materials or textures), and to get an enum item's UI name, description and icon.
* UILayout's label() func now takes an optional 'icon_value' integer parameter, which if not zero will override the 'icon' one (mandatory to use "custom" icons as generated for material/texture/... previews).
Note: not sure whether we should add that one to all UILayout's prop funcs?
Note: will update addons using template list asap.
2012-12-28 09:20:16 +00:00
|
|
|
if (RNA_struct_is_ID(ptr->type)) {
|
2019-08-23 09:52:12 +02:00
|
|
|
id = ptr->owner_id;
|
This commit frees list ui items from their dependencies to Panel, and hence from all the limitations this implied (mostly, the "only one list per panel" one).
It introduces a new (py-extendable and registrable) RNA type, UIList (roughly similar to Panel one), which currently contains only "standard" list's scroll pos and size (but may be expended to include e.g. some filtering data, etc.). This now makes lists completely independent from Panels!
This UIList has a draw_item callback which allows to customize items' drawing from python, that all addons can now use. Incidentally, this also greatly simplifies the C code of this widget, as we do not code any "special case" here anymore!
To make all this work, other changes were also necessary:
* Now all buttons (uiBut struct) have a 'custom_data' void pointer, used currently to store the uiList struct associated with a given uiLayoutListBox.
* DynamicPaintSurface now exposes a new bool, use_color_preview (readonly), saying whether that surface has some 3D view preview data or not.
* UILayout class has now four new (static) functions, to get the actual icon of any RNA object (important e.g. with materials or textures), and to get an enum item's UI name, description and icon.
* UILayout's label() func now takes an optional 'icon_value' integer parameter, which if not zero will override the 'icon' one (mandatory to use "custom" icons as generated for material/texture/... previews).
Note: not sure whether we should add that one to all UILayout's prop funcs?
Note: will update addons using template list asap.
2012-12-28 09:20:16 +00:00
|
|
|
}
|
|
|
|
|
else if (RNA_struct_is_a(ptr->type, &RNA_MaterialSlot)) {
|
2022-11-25 23:48:02 -06:00
|
|
|
id = static_cast<ID *>(RNA_pointer_get(ptr, "material").data);
|
This commit frees list ui items from their dependencies to Panel, and hence from all the limitations this implied (mostly, the "only one list per panel" one).
It introduces a new (py-extendable and registrable) RNA type, UIList (roughly similar to Panel one), which currently contains only "standard" list's scroll pos and size (but may be expended to include e.g. some filtering data, etc.). This now makes lists completely independent from Panels!
This UIList has a draw_item callback which allows to customize items' drawing from python, that all addons can now use. Incidentally, this also greatly simplifies the C code of this widget, as we do not code any "special case" here anymore!
To make all this work, other changes were also necessary:
* Now all buttons (uiBut struct) have a 'custom_data' void pointer, used currently to store the uiList struct associated with a given uiLayoutListBox.
* DynamicPaintSurface now exposes a new bool, use_color_preview (readonly), saying whether that surface has some 3D view preview data or not.
* UILayout class has now four new (static) functions, to get the actual icon of any RNA object (important e.g. with materials or textures), and to get an enum item's UI name, description and icon.
* UILayout's label() func now takes an optional 'icon_value' integer parameter, which if not zero will override the 'icon' one (mandatory to use "custom" icons as generated for material/texture/... previews).
Note: not sure whether we should add that one to all UILayout's prop funcs?
Note: will update addons using template list asap.
2012-12-28 09:20:16 +00:00
|
|
|
}
|
|
|
|
|
else if (RNA_struct_is_a(ptr->type, &RNA_TextureSlot)) {
|
2022-11-25 23:48:02 -06:00
|
|
|
id = static_cast<ID *>(RNA_pointer_get(ptr, "texture").data);
|
This commit frees list ui items from their dependencies to Panel, and hence from all the limitations this implied (mostly, the "only one list per panel" one).
It introduces a new (py-extendable and registrable) RNA type, UIList (roughly similar to Panel one), which currently contains only "standard" list's scroll pos and size (but may be expended to include e.g. some filtering data, etc.). This now makes lists completely independent from Panels!
This UIList has a draw_item callback which allows to customize items' drawing from python, that all addons can now use. Incidentally, this also greatly simplifies the C code of this widget, as we do not code any "special case" here anymore!
To make all this work, other changes were also necessary:
* Now all buttons (uiBut struct) have a 'custom_data' void pointer, used currently to store the uiList struct associated with a given uiLayoutListBox.
* DynamicPaintSurface now exposes a new bool, use_color_preview (readonly), saying whether that surface has some 3D view preview data or not.
* UILayout class has now four new (static) functions, to get the actual icon of any RNA object (important e.g. with materials or textures), and to get an enum item's UI name, description and icon.
* UILayout's label() func now takes an optional 'icon_value' integer parameter, which if not zero will override the 'icon' one (mandatory to use "custom" icons as generated for material/texture/... previews).
Note: not sure whether we should add that one to all UILayout's prop funcs?
Note: will update addons using template list asap.
2012-12-28 09:20:16 +00:00
|
|
|
}
|
2019-12-06 13:10:30 -08:00
|
|
|
else if (RNA_struct_is_a(ptr->type, &RNA_FileBrowserFSMenuEntry)) {
|
|
|
|
|
return RNA_int_get(ptr, "icon");
|
|
|
|
|
}
|
This commit frees list ui items from their dependencies to Panel, and hence from all the limitations this implied (mostly, the "only one list per panel" one).
It introduces a new (py-extendable and registrable) RNA type, UIList (roughly similar to Panel one), which currently contains only "standard" list's scroll pos and size (but may be expended to include e.g. some filtering data, etc.). This now makes lists completely independent from Panels!
This UIList has a draw_item callback which allows to customize items' drawing from python, that all addons can now use. Incidentally, this also greatly simplifies the C code of this widget, as we do not code any "special case" here anymore!
To make all this work, other changes were also necessary:
* Now all buttons (uiBut struct) have a 'custom_data' void pointer, used currently to store the uiList struct associated with a given uiLayoutListBox.
* DynamicPaintSurface now exposes a new bool, use_color_preview (readonly), saying whether that surface has some 3D view preview data or not.
* UILayout class has now four new (static) functions, to get the actual icon of any RNA object (important e.g. with materials or textures), and to get an enum item's UI name, description and icon.
* UILayout's label() func now takes an optional 'icon_value' integer parameter, which if not zero will override the 'icon' one (mandatory to use "custom" icons as generated for material/texture/... previews).
Note: not sure whether we should add that one to all UILayout's prop funcs?
Note: will update addons using template list asap.
2012-12-28 09:20:16 +00:00
|
|
|
else if (RNA_struct_is_a(ptr->type, &RNA_DynamicPaintSurface)) {
|
2024-04-23 15:41:55 +10:00
|
|
|
const DynamicPaintSurface *surface = static_cast<const DynamicPaintSurface *>(ptr->data);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-03-25 10:15:20 +11:00
|
|
|
if (surface->format == MOD_DPAINT_SURFACE_F_PTEX) {
|
2018-10-28 17:51:40 +01:00
|
|
|
return ICON_SHADING_TEXTURE;
|
2019-03-25 10:15:20 +11:00
|
|
|
}
|
2020-07-03 14:20:10 +02:00
|
|
|
if (surface->format == MOD_DPAINT_SURFACE_F_VERTEX) {
|
This commit frees list ui items from their dependencies to Panel, and hence from all the limitations this implied (mostly, the "only one list per panel" one).
It introduces a new (py-extendable and registrable) RNA type, UIList (roughly similar to Panel one), which currently contains only "standard" list's scroll pos and size (but may be expended to include e.g. some filtering data, etc.). This now makes lists completely independent from Panels!
This UIList has a draw_item callback which allows to customize items' drawing from python, that all addons can now use. Incidentally, this also greatly simplifies the C code of this widget, as we do not code any "special case" here anymore!
To make all this work, other changes were also necessary:
* Now all buttons (uiBut struct) have a 'custom_data' void pointer, used currently to store the uiList struct associated with a given uiLayoutListBox.
* DynamicPaintSurface now exposes a new bool, use_color_preview (readonly), saying whether that surface has some 3D view preview data or not.
* UILayout class has now four new (static) functions, to get the actual icon of any RNA object (important e.g. with materials or textures), and to get an enum item's UI name, description and icon.
* UILayout's label() func now takes an optional 'icon_value' integer parameter, which if not zero will override the 'icon' one (mandatory to use "custom" icons as generated for material/texture/... previews).
Note: not sure whether we should add that one to all UILayout's prop funcs?
Note: will update addons using template list asap.
2012-12-28 09:20:16 +00:00
|
|
|
return ICON_OUTLINER_DATA_MESH;
|
2019-03-25 10:15:20 +11:00
|
|
|
}
|
2020-07-03 14:20:10 +02:00
|
|
|
if (surface->format == MOD_DPAINT_SURFACE_F_IMAGESEQ) {
|
This commit frees list ui items from their dependencies to Panel, and hence from all the limitations this implied (mostly, the "only one list per panel" one).
It introduces a new (py-extendable and registrable) RNA type, UIList (roughly similar to Panel one), which currently contains only "standard" list's scroll pos and size (but may be expended to include e.g. some filtering data, etc.). This now makes lists completely independent from Panels!
This UIList has a draw_item callback which allows to customize items' drawing from python, that all addons can now use. Incidentally, this also greatly simplifies the C code of this widget, as we do not code any "special case" here anymore!
To make all this work, other changes were also necessary:
* Now all buttons (uiBut struct) have a 'custom_data' void pointer, used currently to store the uiList struct associated with a given uiLayoutListBox.
* DynamicPaintSurface now exposes a new bool, use_color_preview (readonly), saying whether that surface has some 3D view preview data or not.
* UILayout class has now four new (static) functions, to get the actual icon of any RNA object (important e.g. with materials or textures), and to get an enum item's UI name, description and icon.
* UILayout's label() func now takes an optional 'icon_value' integer parameter, which if not zero will override the 'icon' one (mandatory to use "custom" icons as generated for material/texture/... previews).
Note: not sure whether we should add that one to all UILayout's prop funcs?
Note: will update addons using template list asap.
2012-12-28 09:20:16 +00:00
|
|
|
return ICON_FILE_IMAGE;
|
2019-03-25 10:15:20 +11:00
|
|
|
}
|
This commit frees list ui items from their dependencies to Panel, and hence from all the limitations this implied (mostly, the "only one list per panel" one).
It introduces a new (py-extendable and registrable) RNA type, UIList (roughly similar to Panel one), which currently contains only "standard" list's scroll pos and size (but may be expended to include e.g. some filtering data, etc.). This now makes lists completely independent from Panels!
This UIList has a draw_item callback which allows to customize items' drawing from python, that all addons can now use. Incidentally, this also greatly simplifies the C code of this widget, as we do not code any "special case" here anymore!
To make all this work, other changes were also necessary:
* Now all buttons (uiBut struct) have a 'custom_data' void pointer, used currently to store the uiList struct associated with a given uiLayoutListBox.
* DynamicPaintSurface now exposes a new bool, use_color_preview (readonly), saying whether that surface has some 3D view preview data or not.
* UILayout class has now four new (static) functions, to get the actual icon of any RNA object (important e.g. with materials or textures), and to get an enum item's UI name, description and icon.
* UILayout's label() func now takes an optional 'icon_value' integer parameter, which if not zero will override the 'icon' one (mandatory to use "custom" icons as generated for material/texture/... previews).
Note: not sure whether we should add that one to all UILayout's prop funcs?
Note: will update addons using template list asap.
2012-12-28 09:20:16 +00:00
|
|
|
}
|
2018-06-14 10:38:17 +02:00
|
|
|
else if (RNA_struct_is_a(ptr->type, &RNA_StudioLight)) {
|
2022-11-25 23:48:02 -06:00
|
|
|
StudioLight *sl = static_cast<StudioLight *>(ptr->data);
|
2018-06-15 20:55:37 +02:00
|
|
|
switch (sl->flag & STUDIOLIGHT_FLAG_ORIENTATIONS) {
|
2018-11-28 22:16:56 +01:00
|
|
|
case STUDIOLIGHT_TYPE_STUDIO:
|
2018-06-14 10:38:17 +02:00
|
|
|
return sl->icon_id_irradiance;
|
2018-11-28 22:16:56 +01:00
|
|
|
case STUDIOLIGHT_TYPE_WORLD:
|
2018-06-14 10:38:17 +02:00
|
|
|
default:
|
|
|
|
|
return sl->icon_id_radiance;
|
2018-11-28 22:16:56 +01:00
|
|
|
case STUDIOLIGHT_TYPE_MATCAP:
|
2018-06-14 10:38:17 +02:00
|
|
|
return sl->icon_id_matcap;
|
|
|
|
|
}
|
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
This commit frees list ui items from their dependencies to Panel, and hence from all the limitations this implied (mostly, the "only one list per panel" one).
It introduces a new (py-extendable and registrable) RNA type, UIList (roughly similar to Panel one), which currently contains only "standard" list's scroll pos and size (but may be expended to include e.g. some filtering data, etc.). This now makes lists completely independent from Panels!
This UIList has a draw_item callback which allows to customize items' drawing from python, that all addons can now use. Incidentally, this also greatly simplifies the C code of this widget, as we do not code any "special case" here anymore!
To make all this work, other changes were also necessary:
* Now all buttons (uiBut struct) have a 'custom_data' void pointer, used currently to store the uiList struct associated with a given uiLayoutListBox.
* DynamicPaintSurface now exposes a new bool, use_color_preview (readonly), saying whether that surface has some 3D view preview data or not.
* UILayout class has now four new (static) functions, to get the actual icon of any RNA object (important e.g. with materials or textures), and to get an enum item's UI name, description and icon.
* UILayout's label() func now takes an optional 'icon_value' integer parameter, which if not zero will override the 'icon' one (mandatory to use "custom" icons as generated for material/texture/... previews).
Note: not sure whether we should add that one to all UILayout's prop funcs?
Note: will update addons using template list asap.
2012-12-28 09:20:16 +00:00
|
|
|
/* get icon from ID */
|
|
|
|
|
if (id) {
|
2020-08-26 10:11:13 +10:00
|
|
|
const int icon = ui_id_icon_get(C, id, big);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
This commit frees list ui items from their dependencies to Panel, and hence from all the limitations this implied (mostly, the "only one list per panel" one).
It introduces a new (py-extendable and registrable) RNA type, UIList (roughly similar to Panel one), which currently contains only "standard" list's scroll pos and size (but may be expended to include e.g. some filtering data, etc.). This now makes lists completely independent from Panels!
This UIList has a draw_item callback which allows to customize items' drawing from python, that all addons can now use. Incidentally, this also greatly simplifies the C code of this widget, as we do not code any "special case" here anymore!
To make all this work, other changes were also necessary:
* Now all buttons (uiBut struct) have a 'custom_data' void pointer, used currently to store the uiList struct associated with a given uiLayoutListBox.
* DynamicPaintSurface now exposes a new bool, use_color_preview (readonly), saying whether that surface has some 3D view preview data or not.
* UILayout class has now four new (static) functions, to get the actual icon of any RNA object (important e.g. with materials or textures), and to get an enum item's UI name, description and icon.
* UILayout's label() func now takes an optional 'icon_value' integer parameter, which if not zero will override the 'icon' one (mandatory to use "custom" icons as generated for material/texture/... previews).
Note: not sure whether we should add that one to all UILayout's prop funcs?
Note: will update addons using template list asap.
2012-12-28 09:20:16 +00:00
|
|
|
return icon ? icon : rnaicon;
|
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
This commit frees list ui items from their dependencies to Panel, and hence from all the limitations this implied (mostly, the "only one list per panel" one).
It introduces a new (py-extendable and registrable) RNA type, UIList (roughly similar to Panel one), which currently contains only "standard" list's scroll pos and size (but may be expended to include e.g. some filtering data, etc.). This now makes lists completely independent from Panels!
This UIList has a draw_item callback which allows to customize items' drawing from python, that all addons can now use. Incidentally, this also greatly simplifies the C code of this widget, as we do not code any "special case" here anymore!
To make all this work, other changes were also necessary:
* Now all buttons (uiBut struct) have a 'custom_data' void pointer, used currently to store the uiList struct associated with a given uiLayoutListBox.
* DynamicPaintSurface now exposes a new bool, use_color_preview (readonly), saying whether that surface has some 3D view preview data or not.
* UILayout class has now four new (static) functions, to get the actual icon of any RNA object (important e.g. with materials or textures), and to get an enum item's UI name, description and icon.
* UILayout's label() func now takes an optional 'icon_value' integer parameter, which if not zero will override the 'icon' one (mandatory to use "custom" icons as generated for material/texture/... previews).
Note: not sure whether we should add that one to all UILayout's prop funcs?
Note: will update addons using template list asap.
2012-12-28 09:20:16 +00:00
|
|
|
return rnaicon;
|
|
|
|
|
}
|
|
|
|
|
|
2020-09-18 10:24:14 +10:00
|
|
|
int UI_icon_from_idcode(const int idcode)
|
2015-08-10 17:26:37 +02:00
|
|
|
{
|
2020-09-18 11:06:41 +10:00
|
|
|
switch ((ID_Type)idcode) {
|
2015-08-10 17:26:37 +02:00
|
|
|
case ID_AC:
|
2018-03-13 01:44:03 +13:00
|
|
|
return ICON_ACTION;
|
2015-08-10 17:26:37 +02:00
|
|
|
case ID_AR:
|
|
|
|
|
return ICON_ARMATURE_DATA;
|
|
|
|
|
case ID_BR:
|
|
|
|
|
return ICON_BRUSH_DATA;
|
|
|
|
|
case ID_CA:
|
|
|
|
|
return ICON_CAMERA_DATA;
|
Basic Alembic support
All in all, this patch adds an Alembic importer, an Alembic exporter,
and a new CacheFile data block which, for now, wraps around an Alembic
archive. This data block is made available through a new modifier ("Mesh
Sequence Cache") as well as a new constraint ("Transform Cache") to
somewhat properly support respectively geometric and transformation data
streaming from alembic caches.
A more in-depth documentation is to be found on the wiki, as well as a
guide to compile alembic: https://wiki.blender.org/index.php/
User:Kevindietrich/AlembicBasicIo.
Many thanks to everyone involved in this little project, and huge shout
out to "cgstrive" for the thorough testings with Maya, 3ds Max, Houdini
and Realflow as well as @fjuhec, @jensverwiebe and @jasperge for the
custom builds and compile fixes.
Reviewers: sergey, campbellbarton, mont29
Reviewed By: sergey, campbellbarton, mont29
Differential Revision: https://developer.blender.org/D2060
2016-08-06 06:20:37 +02:00
|
|
|
case ID_CF:
|
|
|
|
|
return ICON_FILE;
|
2022-02-18 09:50:29 -06:00
|
|
|
case ID_CU_LEGACY:
|
2015-08-10 17:26:37 +02:00
|
|
|
return ICON_CURVE_DATA;
|
2023-03-08 12:35:58 +01:00
|
|
|
case ID_GD_LEGACY:
|
2020-11-17 19:01:44 -07:00
|
|
|
return ICON_OUTLINER_DATA_GREASEPENCIL;
|
2015-08-10 17:26:37 +02:00
|
|
|
case ID_GR:
|
2020-11-13 18:39:19 -07:00
|
|
|
return ICON_OUTLINER_COLLECTION;
|
2015-08-10 17:26:37 +02:00
|
|
|
case ID_IM:
|
|
|
|
|
return ICON_IMAGE_DATA;
|
|
|
|
|
case ID_LA:
|
2018-06-27 14:41:53 +02:00
|
|
|
return ICON_LIGHT_DATA;
|
2015-08-10 17:26:37 +02:00
|
|
|
case ID_LS:
|
|
|
|
|
return ICON_LINE_DATA;
|
|
|
|
|
case ID_LT:
|
|
|
|
|
return ICON_LATTICE_DATA;
|
|
|
|
|
case ID_MA:
|
|
|
|
|
return ICON_MATERIAL_DATA;
|
|
|
|
|
case ID_MB:
|
|
|
|
|
return ICON_META_DATA;
|
|
|
|
|
case ID_MC:
|
2018-12-31 13:50:56 +01:00
|
|
|
return ICON_TRACKER;
|
2015-08-10 17:26:37 +02:00
|
|
|
case ID_ME:
|
|
|
|
|
return ICON_MESH_DATA;
|
|
|
|
|
case ID_MSK:
|
2021-07-03 23:08:40 +10:00
|
|
|
return ICON_MOD_MASK; /* TODO: this would need its own icon! */
|
2015-08-10 17:26:37 +02:00
|
|
|
case ID_NT:
|
|
|
|
|
return ICON_NODETREE;
|
|
|
|
|
case ID_OB:
|
|
|
|
|
return ICON_OBJECT_DATA;
|
2016-12-28 17:30:58 +01:00
|
|
|
case ID_PA:
|
|
|
|
|
return ICON_PARTICLE_DATA;
|
2015-08-10 17:26:37 +02:00
|
|
|
case ID_PAL:
|
2021-07-03 23:08:40 +10:00
|
|
|
return ICON_COLOR; /* TODO: this would need its own icon! */
|
2015-08-10 17:26:37 +02:00
|
|
|
case ID_PC:
|
2021-07-03 23:08:40 +10:00
|
|
|
return ICON_CURVE_BEZCURVE; /* TODO: this would need its own icon! */
|
2017-06-12 20:59:54 +10:00
|
|
|
case ID_LP:
|
2019-05-06 11:54:46 +02:00
|
|
|
return ICON_OUTLINER_DATA_LIGHTPROBE;
|
2015-08-10 17:26:37 +02:00
|
|
|
case ID_SCE:
|
|
|
|
|
return ICON_SCENE_DATA;
|
|
|
|
|
case ID_SPK:
|
|
|
|
|
return ICON_SPEAKER;
|
|
|
|
|
case ID_SO:
|
|
|
|
|
return ICON_SOUND;
|
|
|
|
|
case ID_TE:
|
|
|
|
|
return ICON_TEXTURE_DATA;
|
|
|
|
|
case ID_TXT:
|
|
|
|
|
return ICON_TEXT;
|
|
|
|
|
case ID_VF:
|
|
|
|
|
return ICON_FONT_DATA;
|
Curves: Rename "Hair" types, variables, and functions to "Curves"
Based on discussions from T95355 and T94193, the plan is to use
the name "Curves" to describe the data-block container for multiple
curves. Eventually this will replace the existing "Curve" data-block.
However, it will be a while before the curve data-block can be replaced
so in order to distinguish the two curve types in the UI, "Hair Curves"
will be used, but eventually changed back to "Curves".
This patch renames "hair-related" files, functions, types, and variable
names to this convention. A deep rename is preferred to keep code
consistent and to avoid any "hair" terminology from leaking, since the
new data-block is meant for all curve types, not just hair use cases.
The downside of this naming is that the difference between "Curve"
and "Curves" has become important. That was considered during
design discussons and deemed acceptable, especially given the
non-permanent nature of the somewhat common conflict.
Some points of interest:
- All DNA compatibility is lost, just like rBf59767ff9729.
- I renamed `ID_HA` to `ID_CV` so there is no complete mismatch.
- `hair_curves` is used where necessary to distinguish from the
existing "curves" plural.
- I didn't rename any of the cycles/rendering code function names,
since that is also used by the old hair particle system.
Differential Revision: https://developer.blender.org/D14007
2022-02-07 11:55:54 -06:00
|
|
|
case ID_CV:
|
|
|
|
|
return ICON_CURVES_DATA;
|
2020-03-17 14:41:48 +01:00
|
|
|
case ID_PT:
|
|
|
|
|
return ICON_POINTCLOUD_DATA;
|
|
|
|
|
case ID_VO:
|
|
|
|
|
return ICON_VOLUME_DATA;
|
2015-08-10 17:26:37 +02:00
|
|
|
case ID_WO:
|
|
|
|
|
return ICON_WORLD_DATA;
|
UI: File Browser Design Overhaul
This is a general redesign of the File Browser GUI and interaction
methods. For screenshots, check patch D5601.
Main changes in short:
* File Browser as floating window
* New layout of regions
* Popovers for view and filter options
* Vertical list view with interactive column header
* New and updated icons
* Keymap consistency fixes
* Many tweaks and fixes to the drawing of views
----
General:
* The file browser now opens as temporary floating window. It closes on
Esc. The header is hidden then.
* When the file browser is opened as regular editor, the header remains
visible.
* All file browser regions are now defined in Python (the button
layout).
* Adjusted related operator UI names.
Keymap:
Keymap is now consistent with other list-based views in Blender, such as
the Outliner.
* Left click to select, double-click to open
* Right-click context menus
* Shift-click to fill selection
* Ctrl-click to extend selection
Operator options:
These previously overlapped with the source list, which caused numerous
issues with resizing and presenting many settings in a small panel area.
It was also generally inconsistent with Blender.
* Moved to new sidebar, which can easily be shown or hidden using a
prominent Options toggle.
* IO operators have new layouts to match this new sidebar, using
sub-panels. This will have to be committed separately (Add-on
repository).
* If operators want to show the options by default, they have the option
to do so (see `WM_FILESEL_SHOW_PROPS`, `hide_props_region`), otherwise
they are hidden by default.
General Layout:
The layout has been changed to be simpler, more standard, and fits
better in with Blender 2.8.
* More conventional layout (file path at top, file name at the bottom,
execute/cancel buttons in bottom right).
* Use of popovers to group controls, and allow for more descriptive
naming.
* Search box is always live now, just like Outliner.
Views:
* Date Modified column combines both date and time, also uses user
friendly strings for recent dates (i.e. "Yesterday", "Today").
* Details columns (file size, modification date/time) are now toggleable
for all display types, they are not hardcoded per display type.
* File sizes now show as B, KB, MB, ... rather than B, KiB, MiB, … They
are now also calculated using base 10 of course.
* Option to sort in inverse order.
Vertical List View:
* This view now used a much simpler single vertical list with columns
for information.
* Users can click on the headers of these columns to order by that
category, and click again to reverse the ordering.
Icons:
* Updated icons by Jendrzych, with better centering.
* Files and folders have new icons in Icon view.
* Both files and folders have reworked superimposed icons that show
users the file/folder type.
* 3D file documents correctly use the 3d file icon, which was unused
previously.
* Workspaces now show their icon on Link/Append - also when listed in
the Outliner.
Minor Python-API breakage:
* `bpy.types.FileSelectParams.display_type`: `LIST_SHORT` and
`LIST_LONG` are replaced by `LIST_VERTICAL` and `LIST_HORIZONTAL`.
Removes the feature where directories would automatically be created if
they are entered into the file path text button, but don't exist. We
were not sure if users use it enough to keep it. We can definitely bring
it back.
----
//Combined effort by @billreynish, @harley, @jendrzych, my university
colleague Brian Meisenheimer and myself.//
Differential Revision: https://developer.blender.org/D5601
Reviewers: Brecht, Bastien
2019-09-03 15:43:38 +02:00
|
|
|
case ID_WS:
|
|
|
|
|
return ICON_WORKSPACE;
|
2023-05-30 11:14:16 +02:00
|
|
|
case ID_GP:
|
|
|
|
|
return ICON_OUTLINER_DATA_GREASEPENCIL;
|
2020-09-18 11:06:41 +10:00
|
|
|
|
|
|
|
|
/* No icons for these ID-types. */
|
|
|
|
|
case ID_LI:
|
|
|
|
|
case ID_IP:
|
|
|
|
|
case ID_KE:
|
|
|
|
|
case ID_SCR:
|
|
|
|
|
case ID_WM:
|
|
|
|
|
break;
|
2019-04-17 06:17:24 +02:00
|
|
|
}
|
2020-09-18 11:06:41 +10:00
|
|
|
return ICON_NONE;
|
2015-08-10 17:26:37 +02:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-09-18 10:24:14 +10:00
|
|
|
int UI_icon_from_object_mode(const int mode)
|
2020-09-10 08:35:58 -06:00
|
|
|
{
|
2020-09-18 11:06:41 +10:00
|
|
|
switch ((eObjectMode)mode) {
|
2020-09-10 08:35:58 -06:00
|
|
|
case OB_MODE_OBJECT:
|
|
|
|
|
return ICON_OBJECT_DATAMODE;
|
|
|
|
|
case OB_MODE_EDIT:
|
2023-07-03 15:15:54 +02:00
|
|
|
case OB_MODE_EDIT_GPENCIL_LEGACY:
|
2020-09-10 08:35:58 -06:00
|
|
|
return ICON_EDITMODE_HLT;
|
|
|
|
|
case OB_MODE_SCULPT:
|
2024-10-04 19:20:00 +02:00
|
|
|
case OB_MODE_SCULPT_GREASE_PENCIL:
|
2022-02-15 12:32:15 +01:00
|
|
|
case OB_MODE_SCULPT_CURVES:
|
2020-09-10 08:35:58 -06:00
|
|
|
return ICON_SCULPTMODE_HLT;
|
|
|
|
|
case OB_MODE_VERTEX_PAINT:
|
2024-10-04 19:20:00 +02:00
|
|
|
case OB_MODE_VERTEX_GREASE_PENCIL:
|
2020-09-10 08:35:58 -06:00
|
|
|
return ICON_VPAINT_HLT;
|
|
|
|
|
case OB_MODE_WEIGHT_PAINT:
|
2024-10-04 19:20:00 +02:00
|
|
|
case OB_MODE_WEIGHT_GREASE_PENCIL:
|
2020-09-10 08:35:58 -06:00
|
|
|
return ICON_WPAINT_HLT;
|
|
|
|
|
case OB_MODE_TEXTURE_PAINT:
|
|
|
|
|
return ICON_TPAINT_HLT;
|
|
|
|
|
case OB_MODE_PARTICLE_EDIT:
|
|
|
|
|
return ICON_PARTICLEMODE;
|
|
|
|
|
case OB_MODE_POSE:
|
|
|
|
|
return ICON_POSE_HLT;
|
2024-10-04 19:20:00 +02:00
|
|
|
case OB_MODE_PAINT_GREASE_PENCIL:
|
2020-09-10 08:35:58 -06:00
|
|
|
return ICON_GREASEPENCIL;
|
|
|
|
|
}
|
2020-09-18 11:06:41 +10:00
|
|
|
return ICON_NONE;
|
2020-09-10 08:35:58 -06:00
|
|
|
}
|
|
|
|
|
|
2020-09-18 10:24:14 +10:00
|
|
|
int UI_icon_color_from_collection(const Collection *collection)
|
2020-09-15 12:13:03 -06:00
|
|
|
{
|
|
|
|
|
int icon = ICON_OUTLINER_COLLECTION;
|
|
|
|
|
|
|
|
|
|
if (collection->color_tag != COLLECTION_COLOR_NONE) {
|
|
|
|
|
icon = ICON_COLLECTION_COLOR_01 + collection->color_tag;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return icon;
|
|
|
|
|
}
|
|
|
|
|
|
2008-11-25 19:23:54 +00:00
|
|
|
void UI_icon_draw(float x, float y, int icon_id)
|
2008-11-25 18:27:41 +00:00
|
|
|
{
|
2022-12-29 12:01:32 -05:00
|
|
|
UI_icon_draw_ex(
|
2023-03-17 04:19:05 +01:00
|
|
|
x, y, icon_id, UI_INV_SCALE_FAC, 1.0f, 0.0f, nullptr, false, UI_NO_ICON_OVERLAY_TEXT);
|
2008-11-25 18:27:41 +00:00
|
|
|
}
|
|
|
|
|
|
2017-02-22 16:02:43 +01:00
|
|
|
void UI_icon_draw_alpha(float x, float y, int icon_id, float alpha)
|
|
|
|
|
{
|
2022-12-29 12:01:32 -05:00
|
|
|
UI_icon_draw_ex(
|
2023-03-17 04:19:05 +01:00
|
|
|
x, y, icon_id, UI_INV_SCALE_FAC, alpha, 0.0f, nullptr, false, UI_NO_ICON_OVERLAY_TEXT);
|
2017-02-22 16:02:43 +01:00
|
|
|
}
|
|
|
|
|
|
2019-05-09 19:19:52 +02:00
|
|
|
void UI_icon_draw_preview(float x, float y, int icon_id, float aspect, float alpha, int size)
|
2009-01-06 14:42:54 +00:00
|
|
|
{
|
2022-10-20 16:37:07 +02:00
|
|
|
icon_draw_size(x,
|
|
|
|
|
y,
|
|
|
|
|
icon_id,
|
|
|
|
|
aspect,
|
|
|
|
|
alpha,
|
|
|
|
|
ICON_SIZE_PREVIEW,
|
|
|
|
|
size,
|
|
|
|
|
false,
|
2022-12-29 12:01:32 -05:00
|
|
|
nullptr,
|
2022-10-20 16:37:07 +02:00
|
|
|
false,
|
|
|
|
|
UI_NO_ICON_OVERLAY_TEXT);
|
2009-01-06 14:42:54 +00:00
|
|
|
}
|
|
|
|
|
|
2019-05-09 19:19:52 +02:00
|
|
|
void UI_icon_draw_ex(float x,
|
|
|
|
|
float y,
|
|
|
|
|
int icon_id,
|
|
|
|
|
float aspect,
|
|
|
|
|
float alpha,
|
|
|
|
|
float desaturate,
|
2019-08-06 04:20:17 +10:00
|
|
|
const uchar mono_color[4],
|
2022-10-20 16:37:07 +02:00
|
|
|
const bool mono_border,
|
2024-05-06 23:52:37 +02:00
|
|
|
const IconTextOverlay *text_overlay,
|
|
|
|
|
const bool inverted)
|
2010-01-03 08:37:18 +00:00
|
|
|
{
|
2020-08-26 10:11:13 +10:00
|
|
|
const int draw_size = get_draw_size(ICON_SIZE_ICON);
|
2019-05-09 17:37:26 +02:00
|
|
|
icon_draw_size(x,
|
|
|
|
|
y,
|
|
|
|
|
icon_id,
|
|
|
|
|
aspect,
|
|
|
|
|
alpha,
|
|
|
|
|
ICON_SIZE_ICON,
|
|
|
|
|
draw_size,
|
|
|
|
|
desaturate,
|
|
|
|
|
mono_color,
|
2022-10-20 16:37:07 +02:00
|
|
|
mono_border,
|
2024-05-06 23:52:37 +02:00
|
|
|
text_overlay,
|
|
|
|
|
inverted);
|
2022-10-20 16:37:07 +02:00
|
|
|
}
|
|
|
|
|
|
2024-08-13 03:31:43 +02:00
|
|
|
ImBuf *UI_svg_icon_bitmap(uint icon_id, float size, bool multicolor)
|
|
|
|
|
{
|
|
|
|
|
if (icon_id >= ICON_BLANK_LAST_SVG_ITEM) {
|
|
|
|
|
return nullptr;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ImBuf *ibuf = nullptr;
|
|
|
|
|
int width;
|
|
|
|
|
int height;
|
|
|
|
|
blender::Array<uchar> bitmap;
|
|
|
|
|
|
|
|
|
|
if (multicolor) {
|
|
|
|
|
bitmap = BLF_svg_icon_bitmap(icon_id, size, &width, &height, true, icon_source_edit_cb);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
bitmap = BLF_svg_icon_bitmap(icon_id, size, &width, &height, false, nullptr);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!bitmap.is_empty()) {
|
|
|
|
|
ibuf = IMB_allocFromBuffer(bitmap.data(), nullptr, width, height, 4);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (ibuf) {
|
|
|
|
|
IMB_flipy(ibuf);
|
|
|
|
|
if (multicolor) {
|
|
|
|
|
IMB_premultiply_alpha(ibuf);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return ibuf;
|
|
|
|
|
}
|
|
|
|
|
|
2022-10-20 16:37:07 +02:00
|
|
|
void UI_icon_text_overlay_init_from_count(IconTextOverlay *text_overlay,
|
|
|
|
|
const int icon_indicator_number)
|
|
|
|
|
{
|
|
|
|
|
/* The icon indicator is used as an aggregator, no need to show if it is 1. */
|
|
|
|
|
if (icon_indicator_number < 2) {
|
|
|
|
|
text_overlay->text[0] = '\0';
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
BLI_str_format_integer_unit(text_overlay->text, icon_indicator_number);
|
2008-11-25 18:27:41 +00:00
|
|
|
}
|
2020-03-18 13:29:49 +01:00
|
|
|
|
|
|
|
|
/* ********** Alert Icons ********** */
|
|
|
|
|
|
2024-06-26 20:54:20 +02:00
|
|
|
ImBuf *UI_icon_alert_imbuf_get(eAlertIcon icon, float size)
|
2020-03-18 13:29:49 +01:00
|
|
|
{
|
|
|
|
|
#ifdef WITH_HEADLESS
|
2024-06-26 20:54:20 +02:00
|
|
|
UNUSED_VARS(icon, size);
|
2022-12-29 12:01:32 -05:00
|
|
|
return nullptr;
|
2020-03-18 13:29:49 +01:00
|
|
|
#else
|
2024-06-26 20:54:20 +02:00
|
|
|
|
|
|
|
|
int icon_id = ICON_NONE;
|
|
|
|
|
switch (icon) {
|
|
|
|
|
case ALERT_ICON_WARNING:
|
|
|
|
|
icon_id = ICON_WARNING_LARGE;
|
|
|
|
|
break;
|
|
|
|
|
case ALERT_ICON_QUESTION:
|
|
|
|
|
icon_id = ICON_QUESTION_LARGE;
|
|
|
|
|
break;
|
|
|
|
|
case ALERT_ICON_ERROR:
|
|
|
|
|
icon_id = ICON_CANCEL_LARGE;
|
|
|
|
|
break;
|
|
|
|
|
case ALERT_ICON_INFO:
|
|
|
|
|
icon_id = ICON_INFO_LARGE;
|
|
|
|
|
break;
|
2024-06-27 01:35:45 +02:00
|
|
|
default:
|
|
|
|
|
icon_id = ICON_NONE;
|
2024-06-26 20:54:20 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (icon_id == ICON_NONE) {
|
|
|
|
|
return nullptr;
|
|
|
|
|
}
|
|
|
|
|
|
2024-08-13 03:31:43 +02:00
|
|
|
return UI_svg_icon_bitmap(icon_id, size, false);
|
2020-03-18 13:29:49 +01:00
|
|
|
#endif
|
|
|
|
|
}
|