Blender V5.0
interface_icons.cc
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2001-2002 NaN Holding BV. All rights reserved.
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
8
9#include "MEM_guardedalloc.h"
10
11#include "GPU_immediate.hh"
12#include "GPU_state.hh"
13
14#include "BLF_api.hh"
15
16#include "BLI_math_color.h"
17#include "BLI_math_vector.h"
18#include "BLI_string.h"
19
20#include "BLT_translation.hh"
21
26#include "DNA_screen_types.h"
27#include "DNA_sequence_types.h"
28
29#include "RNA_access.hh"
30#include "RNA_prototypes.hh"
31
32#include "BKE_context.hh"
33#include "BKE_global.hh"
34#include "BKE_icons.h"
35#include "BKE_paint.hh"
36#include "BKE_preview_image.hh"
37#include "BKE_studiolight.h"
38
39#include "IMB_imbuf.hh"
40#include "IMB_thumbs.hh"
41
42#include "BIF_glutil.hh"
43
44#include "ED_keyframes_draw.hh"
46#include "ED_node.hh"
47#include "ED_render.hh"
48
49#include "UI_interface_icons.hh"
50
51#include "WM_api.hh"
52
53#include "CLG_log.h"
54
55#include "interface_intern.hh"
56
57#include <fmt/format.h>
58
59static CLG_LogRef LOG = {"ui.icon"};
60
61struct IconImage {
62 int w;
63 int h;
64 uint8_t *rect;
67};
68
70 void (*)(float x, float y, float w, float h, float alpha, const uchar mono_rgba[4]);
71
72#define ICON_TYPE_PREVIEW 0
73#define ICON_TYPE_SVG_COLOR 1
74#define ICON_TYPE_SVG_MONO 2
75#define ICON_TYPE_BUFFER 3
76#define ICON_TYPE_IMBUF 4
77#define ICON_TYPE_VECTOR 5
78#define ICON_TYPE_GEOM 6
79#define ICON_TYPE_EVENT 7 /* draw keymap entries using custom renderer. */
80#define ICON_TYPE_GPLAYER 8
81#define ICON_TYPE_BLANK 9
82
83struct DrawInfo {
84 int type;
85
86 union {
87 /* type specific data */
88 struct {
91 struct {
95 struct {
98 struct {
101 struct {
102 /* Can be packed into a single int. */
105 int icon;
106 /* Allow lookups. */
110};
111
112struct IconType {
113 int type;
115};
116
117#ifndef WITH_HEADLESS
118
119static const IconType icontypes[] = {
120# define DEF_ICON(name) {ICON_TYPE_SVG_MONO, 0},
121# define DEF_ICON_COLOR(name) {ICON_TYPE_SVG_COLOR, 0},
122# define DEF_ICON_SCENE(name) {ICON_TYPE_SVG_MONO, TH_ICON_SCENE},
123# define DEF_ICON_COLLECTION(name) {ICON_TYPE_SVG_MONO, TH_ICON_COLLECTION},
124# define DEF_ICON_OBJECT(name) {ICON_TYPE_SVG_MONO, TH_ICON_OBJECT},
125# define DEF_ICON_OBJECT_DATA(name) {ICON_TYPE_SVG_MONO, TH_ICON_OBJECT_DATA},
126# define DEF_ICON_MODIFIER(name) {ICON_TYPE_SVG_MONO, TH_ICON_MODIFIER},
127# define DEF_ICON_SHADING(name) {ICON_TYPE_SVG_MONO, TH_ICON_SHADING},
128# define DEF_ICON_FOLDER(name) {ICON_TYPE_SVG_MONO, TH_ICON_FOLDER},
129# define DEF_ICON_FUND(name) {ICON_TYPE_SVG_MONO, TH_ICON_FUND},
130# define DEF_ICON_VECTOR(name) {ICON_TYPE_VECTOR, 0},
131# define DEF_ICON_BLANK(name) {ICON_TYPE_BLANK, 0},
132# include "UI_icons.hh"
133};
134
135/* **************************************************** */
136
138 ImBuf *bbuf, int icon_id, int xofs, int yofs, int size, int type, int theme_color)
139{
140 Icon *new_icon = MEM_callocN<Icon>(__func__);
141
142 new_icon->obj = nullptr; /* icon is not for library object */
143 new_icon->id_type = 0;
144
145 DrawInfo *di = MEM_callocN<DrawInfo>(__func__);
146 di->type = type;
147
148 if (type == ICON_TYPE_SVG_MONO) {
149 di->data.texture.theme_color = theme_color;
150 }
151 else if (type == ICON_TYPE_BUFFER) {
152 IconImage *iimg = MEM_callocN<IconImage>(__func__);
153 iimg->w = size;
154 iimg->h = size;
155
156 /* icon buffers can get initialized runtime now, via datatoc */
157 if (bbuf) {
158 int y, imgsize;
159
160 iimg->rect = MEM_malloc_arrayN<uint8_t>(size * size * sizeof(uint), __func__);
161
162 /* Here we store the rect in the icon - same as before */
163 if (size == bbuf->x && size == bbuf->y && xofs == 0 && yofs == 0) {
164 memcpy(iimg->rect, bbuf->byte_buffer.data, size * size * 4 * sizeof(uint8_t));
165 }
166 else {
167 /* this code assumes square images */
168 imgsize = bbuf->x;
169 for (y = 0; y < size; y++) {
170 memcpy(&iimg->rect[y * size],
171 &bbuf->byte_buffer.data[(y + yofs) * imgsize + xofs],
172 size * 4 * sizeof(uint8_t));
173 }
174 }
175 }
176 di->data.buffer.image = iimg;
177 }
178
180 new_icon->drawinfo = di;
181
182 BKE_icon_set(icon_id, new_icon);
183
184 return di;
185}
186
187static void def_internal_vicon(int icon_id, VectorDrawFunc drawFunc)
188{
189 Icon *new_icon = MEM_callocN<Icon>("texicon");
190
191 new_icon->obj = nullptr; /* icon is not for library object */
192 new_icon->id_type = 0;
193
194 DrawInfo *di = MEM_callocN<DrawInfo>("drawinfo");
196 di->data.vector.func = drawFunc;
197
198 new_icon->drawinfo_free = nullptr;
199 new_icon->drawinfo = di;
200
201 BKE_icon_set(icon_id, new_icon);
202}
203
204/* Vector Icon Drawing Routines */
205
207 float x, float y, float w, float h, const float color[4], float bg_alpha)
208{
209 rctf rect = {x, x + w, y, y + h};
210 const float color_bg[4] = {color[0], color[1], color[2], bg_alpha};
212 UI_draw_roundbox_4fv_ex(&rect, color_bg, nullptr, 1.0f, color, U.pixelsize, 2.0f * UI_SCALE_FAC);
213}
214
216 float x, float y, float w, float h, const char *str, const uchar mono_rgba[4])
217{
218 const int font_id = BLF_default();
219 const size_t len = strlen(str);
220 BLF_size(font_id, float(h - 3 * UI_SCALE_FAC));
221 float width, height;
222 BLF_width_and_height(font_id, str, len, &width, &height);
223 const float pos_x = x + (w - width) / 2.0f;
224 const float pos_y = y + (h - height) / 2.0f;
225 BLF_position(font_id, pos_x, pos_y, 0);
226 BLF_color4ubv(font_id, mono_rgba);
227 BLF_draw(font_id, str, len);
228}
229
231 float x, float y, float w, float h, float alpha, const uchar mono_rgba[4])
232{
233 const float color[4] = {0.5f, 0.0f, 0.0f, 1.0f * alpha};
234 vicon_rgb_color_draw(x, y, w, h, color, 0.25f * alpha);
235 const char *text = CTX_IFACE_(BLT_I18NCONTEXT_COLOR, "R");
236 vicon_rgb_text_draw(x, y, w, h, text, mono_rgba);
237}
238
240 float x, float y, float w, float h, float alpha, const uchar mono_rgba[4])
241{
242 const float color[4] = {0.0f, 0.4f, 0.0f, 1.0f * alpha};
243 vicon_rgb_color_draw(x, y, w, h, color, 0.2f * alpha);
244 const char *text = CTX_IFACE_(BLT_I18NCONTEXT_COLOR, "G");
245 vicon_rgb_text_draw(x, y, w, h, text, mono_rgba);
246}
247
249 float x, float y, float w, float h, float alpha, const uchar mono_rgba[4])
250{
251 const float color[4] = {0.0f, 0.0f, 1.0f, 1.0f * alpha};
252 vicon_rgb_color_draw(x, y, w, h, color, 0.3f * alpha);
253 const char *text = CTX_IFACE_(BLT_I18NCONTEXT_COLOR, "B");
254 vicon_rgb_text_draw(x, y, w, h, text, mono_rgba);
255}
256
257/* Utilities */
258
259static void vicon_keytype_draw_wrapper(const float x,
260 const float y,
261 const float w,
262 const float h,
263 const float alpha,
264 const eBezTriple_KeyframeType key_type,
265 const short handle_type)
266{
267 /* Initialize dummy theme state for Action Editor - where these colors are defined
268 * (since we're doing this off-screen, free from any particular space_id). */
269 bThemeState theme_state;
270
271 UI_Theme_Store(&theme_state);
273
274 /* The "x" and "y" given are the bottom-left coordinates of the icon,
275 * while the #draw_keyframe_shape() function needs the midpoint for the keyframe. */
276 const float xco = x + (w / 2.0f);
277 const float yco = y + (h / 2.0f);
278
280 KeyframeShaderBindings sh_bindings;
281 sh_bindings.pos_id = GPU_vertformat_attr_add(
282 format, "pos", blender::gpu::VertAttrType::SFLOAT_32_32);
283 sh_bindings.size_id = GPU_vertformat_attr_add(
284 format, "size", blender::gpu::VertAttrType::SFLOAT_32);
285 sh_bindings.color_id = GPU_vertformat_attr_add(
286 format, "color", blender::gpu::VertAttrType::UNORM_8_8_8_8);
288 format, "outlineColor", blender::gpu::VertAttrType::UNORM_8_8_8_8);
289 sh_bindings.flags_id = GPU_vertformat_attr_add(
290 format, "flags", blender::gpu::VertAttrType::UINT_32);
291
294 immUniform1f("outline_scale", 1.0f);
295 immUniform2f("ViewportSize", -1.0f, -1.0f);
297
298 /* draw keyframe
299 * - size: (default icon size == 16, default dope-sheet icon size == 10)
300 * - sel: true unless in handle-type icons
301 * (so that "keyframe" state shows the iconic yellow icon).
302 */
303 const bool sel = (handle_type == KEYFRAME_HANDLE_NONE);
304
306 yco,
307 (10.0f / 16.0f) * h,
308 sel,
309 key_type,
311 alpha,
312 &sh_bindings,
313 handle_type,
315
316 immEnd();
319
320 UI_Theme_Restore(&theme_state);
321}
322
324 float x, float y, float w, float h, float alpha, const uchar * /*mono_rgba[4]*/)
325{
327}
328
330 float x, float y, float w, float h, float alpha, const uchar * /*mono_rgba[4]*/)
331{
333}
334
336 float x, float y, float w, float h, float alpha, const uchar * /*mono_rgba[4]*/)
337{
339}
340
342 float x, float y, float w, float h, float alpha, const uchar * /*mono_rgba[4]*/)
343{
345}
346
348 float x, float y, float w, float h, float alpha, const uchar * /*mono_rgba[4]*/)
349{
351}
352
354 float x, float y, float w, float h, float alpha, const uchar * /*mono_rgba[4]*/)
355{
357}
358
360 float x, float y, float w, float h, float alpha, const uchar * /*mono_rgba[4]*/)
361{
363}
364
366 float x, float y, float w, float h, float alpha, const uchar * /*mono_rgba[4]*/)
367{
369}
370
372 float x, float y, float w, float h, float alpha, const uchar * /*mono_rgba[4]*/)
373{
375}
376
378 float x, float y, float w, float h, float alpha, const uchar * /*mono_rgba[4]*/)
379{
381}
382
384 float x, float y, float w, float h, float alpha, const uchar * /*mono_rgba[4]*/)
385{
387}
388
390 int socket_type, float x, float y, float w, float h, float /*alpha*/)
391{
392 /* Factor to account for the draw function of the node socket being based on the widget unit,
393 * which is 10 pixels by default, which differs from icons. */
394 constexpr float size_factor = 10.0f / float(ICON_DEFAULT_WIDTH);
395
396 const float socket_radius = w * 0.5f * size_factor;
397 const blender::float2 center = {x + 0.5f * w, y + 0.5f * h};
398 const rctf rect = {
399 center.x - socket_radius,
400 center.x + socket_radius,
401 center.y - socket_radius,
402 center.y + socket_radius,
403 };
404
405 float color_inner[4];
407
408 float color_outer[4] = {0};
410 color_outer[3] = 1.0f;
411
413 &rect, color_inner, color_outer, U.pixelsize, SOCK_DISPLAY_SHAPE_CIRCLE, 1.0f);
414}
415
416static void vicon_colorset_draw(int index, int x, int y, int w, int h, float /*alpha*/)
417{
418 bTheme *btheme = UI_GetTheme();
419 const ThemeWireColor *cs = &btheme->tarm[index];
420
421 /* Draw three bands of color: One per color
422 * x-----a-----b-----c
423 * | N | S | A |
424 * x-----a-----b-----c
425 */
426 const int a = x + w / 3;
427 const int b = x + w / 3 * 2;
428 const int c = x + w;
429
431 immVertexFormat(), "pos", blender::gpu::VertAttrType::SFLOAT_32_32);
433
434 /* XXX: Include alpha into this... */
435 /* normal */
437 immRectf(pos, x, y, a, y + h);
438
439 /* selected */
441 immRectf(pos, a, y, b, y + h);
442
443 /* active */
445 immRectf(pos, b, y, c, y + h);
446
448}
449
450# define DEF_ICON_VECTOR_COLORSET_DRAW_NTH(prefix, index) \
451 static void vicon_colorset_draw_##prefix( \
452 float x, float y, float w, float h, float alpha, const uchar * /*mono_rgba[4]*/) \
453 { \
454 vicon_colorset_draw(index, int(x), int(y), int(w), int(h), alpha); \
455 }
456
477
478# undef DEF_ICON_VECTOR_COLORSET_DRAW_NTH
479
481 short color_tag, float x, float y, float w, float /*h*/, float /*alpha*/)
482{
483 bTheme *btheme = UI_GetTheme();
484 const ThemeStripColor *strip_color = &btheme->strip_color[color_tag];
485
486 const float aspect = float(ICON_DEFAULT_WIDTH) / w;
487
489 y,
490 ICON_SNAP_FACE,
491 aspect,
492 1.0f,
493 0.0f,
494 strip_color->color,
495 btheme->tui.icon_border_intensity > 0.0f,
497}
498
499# define DEF_ICON_STRIP_COLOR_DRAW(index, color) \
500 static void vicon_strip_color_draw_##index( \
501 float x, float y, float w, float h, float alpha, const uchar * /*mono_rgba[4]*/) \
502 { \
503 vicon_strip_color_draw(color, x, y, w, h, alpha); \
504 }
505
515
516# undef DEF_ICON_STRIP_COLOR_DRAW
517
518# define ICON_INDIRECT_DATA_ALPHA 0.6f
519
521 float x, float y, float w, float /*h*/, float alpha, const uchar * /*mono_rgba[4]*/)
522{
523 const float aspect = float(ICON_DEFAULT_WIDTH) / w;
524
526 y,
527 ICON_LIBRARY_DATA_DIRECT,
528 aspect,
530 0.0f,
531 nullptr,
532 false,
534}
535
537 float x, float y, float w, float /*h*/, float alpha, const uchar * /*mono_rgba[4]*/)
538{
539 const float aspect = float(ICON_DEFAULT_WIDTH) / w;
540
542 y,
543 ICON_LIBRARY_DATA_OVERRIDE,
544 aspect,
545 ICON_INDIRECT_DATA_ALPHA * alpha * 0.75f,
546 0.0f,
547 nullptr,
548 false,
550}
551
553 short color_tag, float x, float y, float w, float /*h*/, float /*alpha*/)
554{
555 bTheme *btheme = UI_GetTheme();
556 const ThemeCollectionColor *layergroup_color = &btheme->collection_color[color_tag];
557
558 const float aspect = float(ICON_DEFAULT_WIDTH) / w;
559
561 y,
562 ICON_GREASEPENCIL_LAYER_GROUP,
563 aspect,
564 1.0f,
565 0.0f,
566 layergroup_color->color,
567 btheme->tui.icon_border_intensity > 0.0f,
569}
570
571# define DEF_ICON_LAYERGROUP_COLOR_DRAW(index, color) \
572 static void vicon_layergroup_color_draw_##index( \
573 float x, float y, float w, float h, float alpha, const uchar * /*mono_rgba[4]*/) \
574 { \
575 vicon_layergroup_color_draw(color, x, y, w, h, alpha); \
576 }
577
586
587# undef DEF_ICON_LAYERGROUP_COLOR_DRAW
588
589# define DEF_ICON_NODE_SOCKET_DRAW(name, socket_type) \
590 static void icon_node_socket_draw_##name( \
591 float x, float y, float w, float h, float alpha, const uchar * /*mono_rgba[4]*/) \
592 { \
593 icon_node_socket_draw(socket_type, x, y, w, h, alpha); \
594 }
595
596DEF_ICON_NODE_SOCKET_DRAW(float, eNodeSocketDatatype::SOCK_FLOAT)
597DEF_ICON_NODE_SOCKET_DRAW(vector, eNodeSocketDatatype::SOCK_VECTOR)
598DEF_ICON_NODE_SOCKET_DRAW(rgba, eNodeSocketDatatype::SOCK_RGBA)
599DEF_ICON_NODE_SOCKET_DRAW(shader, eNodeSocketDatatype::SOCK_SHADER)
600DEF_ICON_NODE_SOCKET_DRAW(boolean, eNodeSocketDatatype::SOCK_BOOLEAN)
601DEF_ICON_NODE_SOCKET_DRAW(int, eNodeSocketDatatype::SOCK_INT)
602DEF_ICON_NODE_SOCKET_DRAW(string, eNodeSocketDatatype::SOCK_STRING)
603DEF_ICON_NODE_SOCKET_DRAW(object, eNodeSocketDatatype::SOCK_OBJECT)
604DEF_ICON_NODE_SOCKET_DRAW(image, eNodeSocketDatatype::SOCK_IMAGE)
605DEF_ICON_NODE_SOCKET_DRAW(geometry, eNodeSocketDatatype::SOCK_GEOMETRY)
606DEF_ICON_NODE_SOCKET_DRAW(collection, eNodeSocketDatatype::SOCK_COLLECTION)
607DEF_ICON_NODE_SOCKET_DRAW(texture, eNodeSocketDatatype::SOCK_TEXTURE)
608DEF_ICON_NODE_SOCKET_DRAW(material, eNodeSocketDatatype::SOCK_MATERIAL)
609DEF_ICON_NODE_SOCKET_DRAW(rotation, eNodeSocketDatatype::SOCK_ROTATION)
610DEF_ICON_NODE_SOCKET_DRAW(menu, eNodeSocketDatatype::SOCK_MENU)
611DEF_ICON_NODE_SOCKET_DRAW(matrix, eNodeSocketDatatype::SOCK_MATRIX)
612DEF_ICON_NODE_SOCKET_DRAW(bundle, eNodeSocketDatatype::SOCK_BUNDLE)
613DEF_ICON_NODE_SOCKET_DRAW(closure, eNodeSocketDatatype::SOCK_CLOSURE)
614
615/* Dynamically render icon instead of rendering a plain color to a texture/buffer
616 * This is not strictly a "vicon", as it needs access to icon->obj to get the color info,
617 * but it works in a very similar way.
618 */
619static void vicon_gplayer_color_draw(Icon *icon, int x, int y, int w, int h)
620{
621 bGPDlayer *gpl = (bGPDlayer *)icon->obj;
622
623 /* Just draw a colored rect - Like for vicon_colorset_draw() */
624 /* TODO: Make this have rounded corners, and maybe be a bit smaller.
625 * However, UI_draw_roundbox_aa() draws the colors too dark, so can't be used.
626 */
628 immVertexFormat(), "pos", blender::gpu::VertAttrType::SFLOAT_32_32);
630
632 immRectf(pos, x, y, x + w - 1, y + h - 1);
633
635}
636
637static DrawInfo *g_di_event_list = nullptr;
638
639int UI_icon_from_event_type(short event_type, short event_value)
640{
641 if (event_type == EVT_RIGHTSHIFTKEY) {
642 event_type = EVT_LEFTSHIFTKEY;
643 }
644 else if (event_type == EVT_RIGHTCTRLKEY) {
645 event_type = EVT_LEFTCTRLKEY;
646 }
647 else if (event_type == EVT_RIGHTALTKEY) {
648 event_type = EVT_LEFTALTKEY;
649 }
650
652 do {
653 if (di->data.input.event_type == event_type) {
654 return di->data.input.icon;
655 }
656 } while ((di = di->data.input.next));
657
658 if (event_type == LEFTMOUSE) {
659 if (event_value == KM_DBL_CLICK) {
660 return ICON_MOUSE_LMB_2X;
661 }
662 return (event_value == KM_PRESS_DRAG) ? ICON_MOUSE_LMB_DRAG : ICON_MOUSE_LMB;
663 }
664 if (event_type == MIDDLEMOUSE) {
665 return (event_value == KM_PRESS_DRAG) ? ICON_MOUSE_MMB_DRAG : ICON_MOUSE_MMB;
666 }
667 if (event_type == RIGHTMOUSE) {
668 return (event_value == KM_PRESS_DRAG) ? ICON_MOUSE_MMB_DRAG : ICON_MOUSE_RMB;
669 }
670
671 return ICON_NONE;
672}
673
674int UI_icon_from_keymap_item(const wmKeyMapItem *kmi, int r_icon_mod[KM_MOD_NUM])
675{
676 if (r_icon_mod) {
677 memset(r_icon_mod, 0x0, sizeof(int[KM_MOD_NUM]));
678 int i = 0;
679 if (kmi->ctrl == KM_MOD_HELD) {
680 r_icon_mod[i++] = ICON_EVENT_CTRL;
681 }
682 if (kmi->alt == KM_MOD_HELD) {
683 r_icon_mod[i++] = ICON_EVENT_ALT;
684 }
685 if (kmi->shift == KM_MOD_HELD) {
686 r_icon_mod[i++] = ICON_EVENT_SHIFT;
687 }
688 if (kmi->oskey == KM_MOD_HELD) {
689 r_icon_mod[i++] = ICON_EVENT_OS;
690 }
691 if (!ELEM(kmi->hyper, KM_NOTHING, KM_ANY)) {
692 r_icon_mod[i++] = ICON_EVENT_HYPER;
693 }
694 }
695 return UI_icon_from_event_type(kmi->type, kmi->val);
696}
697
698static void init_event_icons()
699{
700 DrawInfo *di_next = nullptr;
701
702# define INIT_EVENT_ICON(icon_id, type, value) \
703 { \
704 DrawInfo *di = def_internal_icon(nullptr, icon_id, 0, 0, w, ICON_TYPE_EVENT, 0); \
705 di->data.input.event_type = type; \
706 di->data.input.event_value = value; \
707 di->data.input.icon = icon_id; \
708 di->data.input.next = di_next; \
709 di_next = di; \
710 } \
711 ((void)0)
712 /* end INIT_EVENT_ICON */
713
714 const int w = 16; /* DUMMY */
715
716 INIT_EVENT_ICON(ICON_EVENT_A, EVT_AKEY, KM_ANY);
717 INIT_EVENT_ICON(ICON_EVENT_B, EVT_BKEY, KM_ANY);
718 INIT_EVENT_ICON(ICON_EVENT_C, EVT_CKEY, KM_ANY);
719 INIT_EVENT_ICON(ICON_EVENT_D, EVT_DKEY, KM_ANY);
720 INIT_EVENT_ICON(ICON_EVENT_E, EVT_EKEY, KM_ANY);
721 INIT_EVENT_ICON(ICON_EVENT_F, EVT_FKEY, KM_ANY);
722 INIT_EVENT_ICON(ICON_EVENT_G, EVT_GKEY, KM_ANY);
723 INIT_EVENT_ICON(ICON_EVENT_H, EVT_HKEY, KM_ANY);
724 INIT_EVENT_ICON(ICON_EVENT_I, EVT_IKEY, KM_ANY);
725 INIT_EVENT_ICON(ICON_EVENT_J, EVT_JKEY, KM_ANY);
726 INIT_EVENT_ICON(ICON_EVENT_K, EVT_KKEY, KM_ANY);
727 INIT_EVENT_ICON(ICON_EVENT_L, EVT_LKEY, KM_ANY);
728 INIT_EVENT_ICON(ICON_EVENT_M, EVT_MKEY, KM_ANY);
729 INIT_EVENT_ICON(ICON_EVENT_N, EVT_NKEY, KM_ANY);
730 INIT_EVENT_ICON(ICON_EVENT_O, EVT_OKEY, KM_ANY);
731 INIT_EVENT_ICON(ICON_EVENT_P, EVT_PKEY, KM_ANY);
732 INIT_EVENT_ICON(ICON_EVENT_Q, EVT_QKEY, KM_ANY);
733 INIT_EVENT_ICON(ICON_EVENT_R, EVT_RKEY, KM_ANY);
734 INIT_EVENT_ICON(ICON_EVENT_S, EVT_SKEY, KM_ANY);
735 INIT_EVENT_ICON(ICON_EVENT_T, EVT_TKEY, KM_ANY);
736 INIT_EVENT_ICON(ICON_EVENT_U, EVT_UKEY, KM_ANY);
737 INIT_EVENT_ICON(ICON_EVENT_V, EVT_VKEY, KM_ANY);
738 INIT_EVENT_ICON(ICON_EVENT_W, EVT_WKEY, KM_ANY);
739 INIT_EVENT_ICON(ICON_EVENT_X, EVT_XKEY, KM_ANY);
740 INIT_EVENT_ICON(ICON_EVENT_Y, EVT_YKEY, KM_ANY);
741 INIT_EVENT_ICON(ICON_EVENT_Z, EVT_ZKEY, KM_ANY);
742 INIT_EVENT_ICON(ICON_EVENT_SHIFT, EVT_LEFTSHIFTKEY, KM_ANY);
743 INIT_EVENT_ICON(ICON_EVENT_CTRL, EVT_LEFTCTRLKEY, KM_ANY);
744 INIT_EVENT_ICON(ICON_EVENT_ALT, EVT_LEFTALTKEY, KM_ANY);
745 INIT_EVENT_ICON(ICON_EVENT_OS, EVT_OSKEY, KM_ANY);
746 INIT_EVENT_ICON(ICON_EVENT_HYPER, EVT_HYPER, KM_ANY);
747 INIT_EVENT_ICON(ICON_EVENT_F1, EVT_F1KEY, KM_ANY);
748 INIT_EVENT_ICON(ICON_EVENT_F2, EVT_F2KEY, KM_ANY);
749 INIT_EVENT_ICON(ICON_EVENT_F3, EVT_F3KEY, KM_ANY);
750 INIT_EVENT_ICON(ICON_EVENT_F4, EVT_F4KEY, KM_ANY);
751 INIT_EVENT_ICON(ICON_EVENT_F5, EVT_F5KEY, KM_ANY);
752 INIT_EVENT_ICON(ICON_EVENT_F6, EVT_F6KEY, KM_ANY);
753 INIT_EVENT_ICON(ICON_EVENT_F7, EVT_F7KEY, KM_ANY);
754 INIT_EVENT_ICON(ICON_EVENT_F8, EVT_F8KEY, KM_ANY);
755 INIT_EVENT_ICON(ICON_EVENT_F9, EVT_F9KEY, KM_ANY);
756 INIT_EVENT_ICON(ICON_EVENT_F10, EVT_F10KEY, KM_ANY);
757 INIT_EVENT_ICON(ICON_EVENT_F11, EVT_F11KEY, KM_ANY);
758 INIT_EVENT_ICON(ICON_EVENT_F12, EVT_F12KEY, KM_ANY);
759 INIT_EVENT_ICON(ICON_EVENT_ESC, EVT_ESCKEY, KM_ANY);
760 INIT_EVENT_ICON(ICON_EVENT_TAB, EVT_TABKEY, KM_ANY);
761 INIT_EVENT_ICON(ICON_EVENT_PAGEUP, EVT_PAGEUPKEY, KM_ANY);
762 INIT_EVENT_ICON(ICON_EVENT_PAGEDOWN, EVT_PAGEDOWNKEY, KM_ANY);
763 INIT_EVENT_ICON(ICON_EVENT_RETURN, EVT_RETKEY, KM_ANY);
764 INIT_EVENT_ICON(ICON_EVENT_SPACEKEY, EVT_SPACEKEY, KM_ANY);
765
766 INIT_EVENT_ICON(ICON_EVENT_ZEROKEY, EVT_ZEROKEY, KM_ANY);
767 INIT_EVENT_ICON(ICON_EVENT_ONEKEY, EVT_ONEKEY, KM_ANY);
768 INIT_EVENT_ICON(ICON_EVENT_TWOKEY, EVT_TWOKEY, KM_ANY);
769 INIT_EVENT_ICON(ICON_EVENT_THREEKEY, EVT_THREEKEY, KM_ANY);
770 INIT_EVENT_ICON(ICON_EVENT_FOURKEY, EVT_FOURKEY, KM_ANY);
771 INIT_EVENT_ICON(ICON_EVENT_FIVEKEY, EVT_FIVEKEY, KM_ANY);
772 INIT_EVENT_ICON(ICON_EVENT_SIXKEY, EVT_SIXKEY, KM_ANY);
773 INIT_EVENT_ICON(ICON_EVENT_SEVENKEY, EVT_SEVENKEY, KM_ANY);
774 INIT_EVENT_ICON(ICON_EVENT_EIGHTKEY, EVT_EIGHTKEY, KM_ANY);
775 INIT_EVENT_ICON(ICON_EVENT_NINEKEY, EVT_NINEKEY, KM_ANY);
776
777 INIT_EVENT_ICON(ICON_EVENT_PAD0, EVT_PAD0, KM_ANY);
778 INIT_EVENT_ICON(ICON_EVENT_PAD1, EVT_PAD1, KM_ANY);
779 INIT_EVENT_ICON(ICON_EVENT_PAD2, EVT_PAD2, KM_ANY);
780 INIT_EVENT_ICON(ICON_EVENT_PAD3, EVT_PAD3, KM_ANY);
781 INIT_EVENT_ICON(ICON_EVENT_PAD4, EVT_PAD4, KM_ANY);
782 INIT_EVENT_ICON(ICON_EVENT_PAD5, EVT_PAD5, KM_ANY);
783 INIT_EVENT_ICON(ICON_EVENT_PAD6, EVT_PAD6, KM_ANY);
784 INIT_EVENT_ICON(ICON_EVENT_PAD7, EVT_PAD7, KM_ANY);
785 INIT_EVENT_ICON(ICON_EVENT_PAD8, EVT_PAD8, KM_ANY);
786 INIT_EVENT_ICON(ICON_EVENT_PAD9, EVT_PAD9, KM_ANY);
787 INIT_EVENT_ICON(ICON_EVENT_PADASTER, EVT_PADASTERKEY, KM_ANY);
788 INIT_EVENT_ICON(ICON_EVENT_PADSLASH, EVT_PADSLASHKEY, KM_ANY);
789 INIT_EVENT_ICON(ICON_EVENT_PADMINUS, EVT_PADMINUS, KM_ANY);
790 INIT_EVENT_ICON(ICON_EVENT_PADENTER, EVT_PADENTER, KM_ANY);
791 INIT_EVENT_ICON(ICON_EVENT_PADPLUS, EVT_PADPLUSKEY, KM_ANY);
792 INIT_EVENT_ICON(ICON_EVENT_PADPERIOD, EVT_PADPERIOD, KM_ANY);
793
794 INIT_EVENT_ICON(ICON_EVENT_MOUSE_4, BUTTON4MOUSE, KM_ANY);
795 INIT_EVENT_ICON(ICON_EVENT_MOUSE_5, BUTTON5MOUSE, KM_ANY);
796 INIT_EVENT_ICON(ICON_EVENT_MOUSE_6, BUTTON6MOUSE, KM_ANY);
797 INIT_EVENT_ICON(ICON_EVENT_MOUSE_7, BUTTON7MOUSE, KM_ANY);
798 INIT_EVENT_ICON(ICON_EVENT_TABLET_STYLUS, TABLET_STYLUS, KM_ANY);
799 INIT_EVENT_ICON(ICON_EVENT_TABLET_ERASER, TABLET_ERASER, KM_ANY);
800 INIT_EVENT_ICON(ICON_EVENT_LEFT_ARROW, EVT_LEFTARROWKEY, KM_ANY);
801 INIT_EVENT_ICON(ICON_EVENT_DOWN_ARROW, EVT_DOWNARROWKEY, KM_ANY);
802 INIT_EVENT_ICON(ICON_EVENT_RIGHT_ARROW, EVT_RIGHTARROWKEY, KM_ANY);
803 INIT_EVENT_ICON(ICON_EVENT_UP_ARROW, EVT_UPARROWKEY, KM_ANY);
804 INIT_EVENT_ICON(ICON_EVENT_PAUSE, EVT_PAUSEKEY, KM_ANY);
805 INIT_EVENT_ICON(ICON_EVENT_INSERT, EVT_INSERTKEY, KM_ANY);
806 INIT_EVENT_ICON(ICON_EVENT_HOME, EVT_HOMEKEY, KM_ANY);
807 INIT_EVENT_ICON(ICON_EVENT_END, EVT_ENDKEY, KM_ANY);
808 INIT_EVENT_ICON(ICON_EVENT_UNKNOWN, EVT_UNKNOWNKEY, KM_ANY);
809 INIT_EVENT_ICON(ICON_EVENT_GRLESS, EVT_GRLESSKEY, KM_ANY);
810 INIT_EVENT_ICON(ICON_EVENT_MEDIAPLAY, EVT_MEDIAPLAY, KM_ANY);
811 INIT_EVENT_ICON(ICON_EVENT_MEDIASTOP, EVT_MEDIASTOP, KM_ANY);
812 INIT_EVENT_ICON(ICON_EVENT_MEDIAFIRST, EVT_MEDIAFIRST, KM_ANY);
813 INIT_EVENT_ICON(ICON_EVENT_MEDIALAST, EVT_MEDIALAST, KM_ANY);
814 INIT_EVENT_ICON(ICON_EVENT_APP, EVT_APPKEY, KM_ANY);
815 INIT_EVENT_ICON(ICON_EVENT_CAPSLOCK, EVT_CAPSLOCKKEY, KM_ANY);
816 INIT_EVENT_ICON(ICON_EVENT_BACKSPACE, EVT_BACKSPACEKEY, KM_ANY);
817 INIT_EVENT_ICON(ICON_EVENT_DEL, EVT_DELKEY, KM_ANY);
818 INIT_EVENT_ICON(ICON_EVENT_SEMICOLON, EVT_SEMICOLONKEY, KM_ANY);
819 INIT_EVENT_ICON(ICON_EVENT_PERIOD, EVT_PERIODKEY, KM_ANY);
820 INIT_EVENT_ICON(ICON_EVENT_COMMA, EVT_COMMAKEY, KM_ANY);
821 INIT_EVENT_ICON(ICON_EVENT_QUOTE, EVT_QUOTEKEY, KM_ANY);
822 INIT_EVENT_ICON(ICON_EVENT_ACCENTGRAVE, EVT_ACCENTGRAVEKEY, KM_ANY);
823 INIT_EVENT_ICON(ICON_EVENT_MINUS, EVT_MINUSKEY, KM_ANY);
824 INIT_EVENT_ICON(ICON_EVENT_PLUS, EVT_PLUSKEY, KM_ANY);
825 INIT_EVENT_ICON(ICON_EVENT_SLASH, EVT_SLASHKEY, KM_ANY);
826 INIT_EVENT_ICON(ICON_EVENT_BACKSLASH, EVT_BACKSLASHKEY, KM_ANY);
827 INIT_EVENT_ICON(ICON_EVENT_EQUAL, EVT_EQUALKEY, KM_ANY);
828 INIT_EVENT_ICON(ICON_EVENT_LEFTBRACKET, EVT_LEFTBRACKETKEY, KM_ANY);
829 INIT_EVENT_ICON(ICON_EVENT_RIGHTBRACKET, EVT_RIGHTBRACKETKEY, KM_ANY);
830
831 INIT_EVENT_ICON(ICON_EVENT_PAD_PAN, MOUSEPAN, KM_ANY);
832 INIT_EVENT_ICON(ICON_EVENT_PAD_ROTATE, MOUSEROTATE, KM_ANY);
833 INIT_EVENT_ICON(ICON_EVENT_PAD_ZOOM, MOUSEZOOM, KM_ANY);
834
835 INIT_EVENT_ICON(ICON_EVENT_F13, EVT_F13KEY, KM_ANY);
836 INIT_EVENT_ICON(ICON_EVENT_F14, EVT_F14KEY, KM_ANY);
837 INIT_EVENT_ICON(ICON_EVENT_F15, EVT_F15KEY, KM_ANY);
838 INIT_EVENT_ICON(ICON_EVENT_F16, EVT_F16KEY, KM_ANY);
839 INIT_EVENT_ICON(ICON_EVENT_F17, EVT_F17KEY, KM_ANY);
840 INIT_EVENT_ICON(ICON_EVENT_F18, EVT_F18KEY, KM_ANY);
841 INIT_EVENT_ICON(ICON_EVENT_F19, EVT_F19KEY, KM_ANY);
842 INIT_EVENT_ICON(ICON_EVENT_F20, EVT_F20KEY, KM_ANY);
843 INIT_EVENT_ICON(ICON_EVENT_F21, EVT_F21KEY, KM_ANY);
844 INIT_EVENT_ICON(ICON_EVENT_F22, EVT_F22KEY, KM_ANY);
845 INIT_EVENT_ICON(ICON_EVENT_F23, EVT_F23KEY, KM_ANY);
846 INIT_EVENT_ICON(ICON_EVENT_F24, EVT_F24KEY, KM_ANY);
847
848 INIT_EVENT_ICON(ICON_EVENT_NDOF_BUTTON_V1, NDOF_BUTTON_V1, KM_ANY);
849 INIT_EVENT_ICON(ICON_EVENT_NDOF_BUTTON_V2, NDOF_BUTTON_V2, KM_ANY);
850 INIT_EVENT_ICON(ICON_EVENT_NDOF_BUTTON_V3, NDOF_BUTTON_V3, KM_ANY);
851 INIT_EVENT_ICON(ICON_EVENT_NDOF_BUTTON_SAVE_V1, NDOF_BUTTON_SAVE_V1, KM_ANY);
852 INIT_EVENT_ICON(ICON_EVENT_NDOF_BUTTON_SAVE_V2, NDOF_BUTTON_SAVE_V2, KM_ANY);
853 INIT_EVENT_ICON(ICON_EVENT_NDOF_BUTTON_SAVE_V3, NDOF_BUTTON_SAVE_V3, KM_ANY);
854 INIT_EVENT_ICON(ICON_EVENT_NDOF_BUTTON_1, NDOF_BUTTON_1, KM_ANY);
855 INIT_EVENT_ICON(ICON_EVENT_NDOF_BUTTON_2, NDOF_BUTTON_2, KM_ANY);
856 INIT_EVENT_ICON(ICON_EVENT_NDOF_BUTTON_3, NDOF_BUTTON_3, KM_ANY);
857 INIT_EVENT_ICON(ICON_EVENT_NDOF_BUTTON_4, NDOF_BUTTON_4, KM_ANY);
858 INIT_EVENT_ICON(ICON_EVENT_NDOF_BUTTON_5, NDOF_BUTTON_5, KM_ANY);
859 INIT_EVENT_ICON(ICON_EVENT_NDOF_BUTTON_6, NDOF_BUTTON_6, KM_ANY);
860 INIT_EVENT_ICON(ICON_EVENT_NDOF_BUTTON_7, NDOF_BUTTON_7, KM_ANY);
861 INIT_EVENT_ICON(ICON_EVENT_NDOF_BUTTON_8, NDOF_BUTTON_8, KM_ANY);
862 INIT_EVENT_ICON(ICON_EVENT_NDOF_BUTTON_9, NDOF_BUTTON_9, KM_ANY);
863 INIT_EVENT_ICON(ICON_EVENT_NDOF_BUTTON_10, NDOF_BUTTON_10, KM_ANY);
864 INIT_EVENT_ICON(ICON_EVENT_NDOF_BUTTON_11, NDOF_BUTTON_11, KM_ANY);
865 INIT_EVENT_ICON(ICON_EVENT_NDOF_BUTTON_12, NDOF_BUTTON_12, KM_ANY);
866 INIT_EVENT_ICON(ICON_EVENT_NDOF_BUTTON_MENU, NDOF_BUTTON_MENU, KM_ANY);
867 INIT_EVENT_ICON(ICON_EVENT_NDOF_BUTTON_FIT, NDOF_BUTTON_FIT, KM_ANY);
868 INIT_EVENT_ICON(ICON_EVENT_NDOF_BUTTON_TOP, NDOF_BUTTON_TOP, KM_ANY);
869 INIT_EVENT_ICON(ICON_EVENT_NDOF_BUTTON_BOTTOM, NDOF_BUTTON_BOTTOM, KM_ANY);
870 INIT_EVENT_ICON(ICON_EVENT_NDOF_BUTTON_LEFT, NDOF_BUTTON_LEFT, KM_ANY);
871 INIT_EVENT_ICON(ICON_EVENT_NDOF_BUTTON_RIGHT, NDOF_BUTTON_RIGHT, KM_ANY);
872 INIT_EVENT_ICON(ICON_EVENT_NDOF_BUTTON_FRONT, NDOF_BUTTON_FRONT, KM_ANY);
873 INIT_EVENT_ICON(ICON_EVENT_NDOF_BUTTON_BACK, NDOF_BUTTON_BACK, KM_ANY);
874 INIT_EVENT_ICON(ICON_EVENT_NDOF_BUTTON_ISO1, NDOF_BUTTON_ISO1, KM_ANY);
875 INIT_EVENT_ICON(ICON_EVENT_NDOF_BUTTON_ISO2, NDOF_BUTTON_ISO2, KM_ANY);
876 INIT_EVENT_ICON(ICON_EVENT_NDOF_BUTTON_ROLL_CW, NDOF_BUTTON_ROLL_CW, KM_ANY);
877 INIT_EVENT_ICON(ICON_EVENT_NDOF_BUTTON_ROLL_CCW, NDOF_BUTTON_ROLL_CCW, KM_ANY);
878 INIT_EVENT_ICON(ICON_EVENT_NDOF_BUTTON_SPIN_CW, NDOF_BUTTON_SPIN_CW, KM_ANY);
879 INIT_EVENT_ICON(ICON_EVENT_NDOF_BUTTON_SPIN_CCW, NDOF_BUTTON_SPIN_CCW, KM_ANY);
880 INIT_EVENT_ICON(ICON_EVENT_NDOF_BUTTON_TILT_CW, NDOF_BUTTON_TILT_CW, KM_ANY);
881 INIT_EVENT_ICON(ICON_EVENT_NDOF_BUTTON_TILT_CCW, NDOF_BUTTON_TILT_CCW, KM_ANY);
882 INIT_EVENT_ICON(ICON_EVENT_NDOF_BUTTON_ROTATE, NDOF_BUTTON_ROTATE, KM_ANY);
883 INIT_EVENT_ICON(ICON_EVENT_NDOF_BUTTON_PANZOOM, NDOF_BUTTON_PANZOOM, KM_ANY);
884 INIT_EVENT_ICON(ICON_EVENT_NDOF_BUTTON_DOMINANT, NDOF_BUTTON_DOMINANT, KM_ANY);
885 INIT_EVENT_ICON(ICON_EVENT_NDOF_BUTTON_PLUS, NDOF_BUTTON_PLUS, KM_ANY);
886 INIT_EVENT_ICON(ICON_EVENT_NDOF_BUTTON_MINUS, NDOF_BUTTON_MINUS, KM_ANY);
887
888 g_di_event_list = di_next;
889
890# undef INIT_EVENT_ICON
891}
892
894{
895 /* if it has own rect, things are all OK */
896 if (iimg->rect) {
897 return;
898 }
899
900 if (iimg->datatoc_rect) {
902 iimg->datatoc_rect, iimg->datatoc_size, IB_byte_data, "<matcap icon>");
903 /* w and h were set on initialize */
904 if (bbuf->x != iimg->h && bbuf->y != iimg->w) {
905 IMB_scale(bbuf, iimg->w, iimg->h, IMBScaleFilter::Box, false);
906 }
907
908 iimg->rect = IMB_steal_byte_buffer(bbuf);
909 IMB_freeImBuf(bbuf);
910 }
911}
912
914{
915 /* Define icons. */
916 for (int x = ICON_NONE; x < ICON_BLANK_LAST_SVG_ITEM; x++) {
917 const IconType icontype = icontypes[x];
919 continue;
920 }
921 def_internal_icon(nullptr, x, 0, 0, 0, icontype.type, icontype.theme_color);
922 }
923
927
928 def_internal_vicon(ICON_KEYTYPE_KEYFRAME_VEC, vicon_keytype_keyframe_draw);
929 def_internal_vicon(ICON_KEYTYPE_BREAKDOWN_VEC, vicon_keytype_breakdown_draw);
930 def_internal_vicon(ICON_KEYTYPE_EXTREME_VEC, vicon_keytype_extreme_draw);
931 def_internal_vicon(ICON_KEYTYPE_JITTER_VEC, vicon_keytype_jitter_draw);
932 def_internal_vicon(ICON_KEYTYPE_MOVING_HOLD_VEC, vicon_keytype_moving_hold_draw);
933 def_internal_vicon(ICON_KEYTYPE_GENERATED_VEC, vicon_keytype_generated_draw);
934
935 def_internal_vicon(ICON_HANDLETYPE_FREE_VEC, vicon_handletype_free_draw);
936 def_internal_vicon(ICON_HANDLETYPE_ALIGNED_VEC, vicon_handletype_aligned_draw);
937 def_internal_vicon(ICON_HANDLETYPE_VECTOR_VEC, vicon_handletype_vector_draw);
938 def_internal_vicon(ICON_HANDLETYPE_AUTO_VEC, vicon_handletype_auto_draw);
939 def_internal_vicon(ICON_HANDLETYPE_AUTO_CLAMP_VEC, vicon_handletype_auto_clamp_draw);
940
941 def_internal_vicon(ICON_COLORSET_01_VEC, vicon_colorset_draw_01);
942 def_internal_vicon(ICON_COLORSET_02_VEC, vicon_colorset_draw_02);
943 def_internal_vicon(ICON_COLORSET_03_VEC, vicon_colorset_draw_03);
944 def_internal_vicon(ICON_COLORSET_04_VEC, vicon_colorset_draw_04);
945 def_internal_vicon(ICON_COLORSET_05_VEC, vicon_colorset_draw_05);
946 def_internal_vicon(ICON_COLORSET_06_VEC, vicon_colorset_draw_06);
947 def_internal_vicon(ICON_COLORSET_07_VEC, vicon_colorset_draw_07);
948 def_internal_vicon(ICON_COLORSET_08_VEC, vicon_colorset_draw_08);
949 def_internal_vicon(ICON_COLORSET_09_VEC, vicon_colorset_draw_09);
950 def_internal_vicon(ICON_COLORSET_10_VEC, vicon_colorset_draw_10);
951 def_internal_vicon(ICON_COLORSET_11_VEC, vicon_colorset_draw_11);
952 def_internal_vicon(ICON_COLORSET_12_VEC, vicon_colorset_draw_12);
953 def_internal_vicon(ICON_COLORSET_13_VEC, vicon_colorset_draw_13);
954 def_internal_vicon(ICON_COLORSET_14_VEC, vicon_colorset_draw_14);
955 def_internal_vicon(ICON_COLORSET_15_VEC, vicon_colorset_draw_15);
956 def_internal_vicon(ICON_COLORSET_16_VEC, vicon_colorset_draw_16);
957 def_internal_vicon(ICON_COLORSET_17_VEC, vicon_colorset_draw_17);
958 def_internal_vicon(ICON_COLORSET_18_VEC, vicon_colorset_draw_18);
959 def_internal_vicon(ICON_COLORSET_19_VEC, vicon_colorset_draw_19);
960 def_internal_vicon(ICON_COLORSET_20_VEC, vicon_colorset_draw_20);
961
962 def_internal_vicon(ICON_STRIP_COLOR_01, vicon_strip_color_draw_01);
963 def_internal_vicon(ICON_STRIP_COLOR_02, vicon_strip_color_draw_02);
964 def_internal_vicon(ICON_STRIP_COLOR_03, vicon_strip_color_draw_03);
965 def_internal_vicon(ICON_STRIP_COLOR_04, vicon_strip_color_draw_04);
966 def_internal_vicon(ICON_STRIP_COLOR_05, vicon_strip_color_draw_05);
967 def_internal_vicon(ICON_STRIP_COLOR_06, vicon_strip_color_draw_06);
968 def_internal_vicon(ICON_STRIP_COLOR_07, vicon_strip_color_draw_07);
969 def_internal_vicon(ICON_STRIP_COLOR_08, vicon_strip_color_draw_08);
970 def_internal_vicon(ICON_STRIP_COLOR_09, vicon_strip_color_draw_09);
971
973 def_internal_vicon(ICON_LIBRARY_DATA_OVERRIDE_NONEDITABLE,
975
976 def_internal_vicon(ICON_LAYERGROUP_COLOR_01, vicon_layergroup_color_draw_01);
977 def_internal_vicon(ICON_LAYERGROUP_COLOR_02, vicon_layergroup_color_draw_02);
978 def_internal_vicon(ICON_LAYERGROUP_COLOR_03, vicon_layergroup_color_draw_03);
979 def_internal_vicon(ICON_LAYERGROUP_COLOR_04, vicon_layergroup_color_draw_04);
980 def_internal_vicon(ICON_LAYERGROUP_COLOR_05, vicon_layergroup_color_draw_05);
981 def_internal_vicon(ICON_LAYERGROUP_COLOR_06, vicon_layergroup_color_draw_06);
982 def_internal_vicon(ICON_LAYERGROUP_COLOR_07, vicon_layergroup_color_draw_07);
983 def_internal_vicon(ICON_LAYERGROUP_COLOR_08, vicon_layergroup_color_draw_08);
984
985 def_internal_vicon(ICON_NODE_SOCKET_FLOAT, icon_node_socket_draw_float);
986 def_internal_vicon(ICON_NODE_SOCKET_VECTOR, icon_node_socket_draw_vector);
987 def_internal_vicon(ICON_NODE_SOCKET_RGBA, icon_node_socket_draw_rgba);
988 def_internal_vicon(ICON_NODE_SOCKET_SHADER, icon_node_socket_draw_shader);
989 def_internal_vicon(ICON_NODE_SOCKET_BOOLEAN, icon_node_socket_draw_boolean);
990 def_internal_vicon(ICON_NODE_SOCKET_INT, icon_node_socket_draw_int);
991 def_internal_vicon(ICON_NODE_SOCKET_STRING, icon_node_socket_draw_string);
992 def_internal_vicon(ICON_NODE_SOCKET_OBJECT, icon_node_socket_draw_object);
993 def_internal_vicon(ICON_NODE_SOCKET_IMAGE, icon_node_socket_draw_image);
994 def_internal_vicon(ICON_NODE_SOCKET_GEOMETRY, icon_node_socket_draw_geometry);
995 def_internal_vicon(ICON_NODE_SOCKET_COLLECTION, icon_node_socket_draw_collection);
996 def_internal_vicon(ICON_NODE_SOCKET_TEXTURE, icon_node_socket_draw_texture);
997 def_internal_vicon(ICON_NODE_SOCKET_MATERIAL, icon_node_socket_draw_material);
998 def_internal_vicon(ICON_NODE_SOCKET_ROTATION, icon_node_socket_draw_rotation);
999 def_internal_vicon(ICON_NODE_SOCKET_MENU, icon_node_socket_draw_menu);
1000 def_internal_vicon(ICON_NODE_SOCKET_MATRIX, icon_node_socket_draw_matrix);
1001 def_internal_vicon(ICON_NODE_SOCKET_BUNDLE, icon_node_socket_draw_bundle);
1002 def_internal_vicon(ICON_NODE_SOCKET_CLOSURE, icon_node_socket_draw_closure);
1003}
1004
1005#else
1006
1007#endif /* WITH_HEADLESS */
1008
1010{
1013}
1014
1015void UI_icons_free_drawinfo(void *drawinfo)
1016{
1017 DrawInfo *di = static_cast<DrawInfo *>(drawinfo);
1018
1019 if (di == nullptr) {
1020 return;
1021 }
1022
1023 if (di->type == ICON_TYPE_BUFFER) {
1024 if (di->data.buffer.image) {
1025 if (di->data.buffer.image->rect) {
1027 }
1029 }
1030 }
1031 else if (di->type == ICON_TYPE_GEOM) {
1032 if (di->data.geom.image_cache) {
1034 }
1035 }
1036
1037 MEM_freeN(di);
1038}
1039
1044{
1045 const int icon_data_type = icon->obj_type;
1046
1047 DrawInfo *di = MEM_callocN<DrawInfo>("di_icon");
1048
1049 if (ELEM(icon_data_type, ICON_DATA_ID, ICON_DATA_PREVIEW)) {
1050 di->type = ICON_TYPE_PREVIEW;
1051 }
1052 else if (icon_data_type == ICON_DATA_IMBUF) {
1053 di->type = ICON_TYPE_IMBUF;
1054 }
1055 else if (icon_data_type == ICON_DATA_GEOM) {
1056 di->type = ICON_TYPE_GEOM;
1057 }
1058 else if (icon_data_type == ICON_DATA_STUDIOLIGHT) {
1059 di->type = ICON_TYPE_BUFFER;
1060 }
1061 else if (icon_data_type == ICON_DATA_GPLAYER) {
1062 di->type = ICON_TYPE_GPLAYER;
1063 }
1064 else {
1065 BLI_assert(0);
1066 }
1067
1068 return di;
1069}
1070
1072{
1073 if (icon->drawinfo) {
1074 return static_cast<DrawInfo *>(icon->drawinfo);
1075 }
1076 DrawInfo *di = icon_create_drawinfo(icon);
1077 icon->drawinfo = di;
1079 return di;
1080}
1081
1082bool UI_icon_get_theme_color(int icon_id, uchar color[4])
1083{
1084 Icon *icon = BKE_icon_get(icon_id);
1085 if (icon == nullptr) {
1086 return false;
1087 }
1088
1089 DrawInfo *di = icon_ensure_drawinfo(icon);
1091}
1092
1094{
1095#ifndef WITH_HEADLESS
1098#endif
1099}
1100
1102{
1103 switch (size) {
1104 case ICON_SIZE_ICON:
1106 case ICON_SIZE_PREVIEW:
1108 default:
1109 return 0;
1110 }
1111}
1112
1113/* Create rect for the icon
1114 */
1116{
1117 const uint render_size = UI_icon_preview_to_render_size(size);
1118
1119 if (!prv_img) {
1120 if (G.debug & G_DEBUG) {
1121 CLOG_WARN(&LOG, "%s, error: requested preview image does not exist", __func__);
1122 }
1123 }
1124 else if (!prv_img->rect[size]) {
1125 prv_img->flag[size] |= PRV_CHANGED;
1126 prv_img->changed_timestamp[size] = 0;
1127 if (!ED_preview_use_image_size(prv_img, size)) {
1128 prv_img->w[size] = render_size;
1129 prv_img->h[size] = render_size;
1130 prv_img->rect[size] = MEM_calloc_arrayN<uint>(render_size * render_size, "prv_rect");
1131 }
1132 }
1133}
1134
1136 const bContext *C, Scene *scene, ID *id, PreviewImage *pi, int size, const bool use_job);
1137
1138static void ui_studiolight_icon_job_exec(void *customdata, wmJobWorkerStatus * /*worker_status*/)
1139{
1140 Icon **tmp = (Icon **)customdata;
1141 Icon *icon = *tmp;
1142 DrawInfo *di = icon_ensure_drawinfo(icon);
1143 StudioLight *sl = static_cast<StudioLight *>(icon->obj);
1145 reinterpret_cast<uint *>(di->data.buffer.image->rect), sl, icon->id_type);
1146}
1147
1149{
1150 Icon *icon = BKE_icon_get(icon_id);
1152 icon->obj = nullptr;
1153}
1154
1156{
1157 wmWindowManager *wm = static_cast<wmWindowManager *>(data);
1158
1159 /* Happens if job was canceled or already finished. */
1160 if (wm == nullptr) {
1161 return;
1162 }
1163
1164 /* get icons_id, get icons and kill wm jobs */
1165 if (sl->icon_id_radiance) {
1167 }
1168 if (sl->icon_id_irradiance) {
1170 }
1171 if (sl->icon_id_matcap) {
1173 }
1174 if (sl->icon_id_matcap_flipped) {
1176 }
1177}
1178
1179static void ui_studiolight_icon_job_end(void *customdata)
1180{
1181 Icon **tmp = (Icon **)customdata;
1182 Icon *icon = *tmp;
1183 StudioLight *sl = static_cast<StudioLight *>(icon->obj);
1185}
1186
1187void ui_icon_ensure_deferred(const bContext *C, const int icon_id, const bool big)
1188{
1189 Icon *icon = BKE_icon_get(icon_id);
1190
1191 if (icon == nullptr) {
1192 return;
1193 }
1194
1195 DrawInfo *di = icon_ensure_drawinfo(icon);
1196
1197 if (di == nullptr) {
1198 return;
1199 }
1200
1201 switch (di->type) {
1202 case ICON_TYPE_PREVIEW: {
1203 ID *id = (icon->id_type != 0) ? static_cast<ID *>(icon->obj) : nullptr;
1204 PreviewImage *prv = id ? BKE_previewimg_id_ensure(id) :
1205 static_cast<PreviewImage *>(icon->obj);
1206 /* Using jobs for screen previews crashes due to off-screen rendering.
1207 * XXX: would be nicer if #PreviewImage could store if it supports jobs. */
1208 const bool use_jobs = !id || (GS(id->name) != ID_SCR);
1209
1210 if (prv) {
1211 const int size = big ? ICON_SIZE_PREVIEW : ICON_SIZE_ICON;
1212
1213 if (id || prv->runtime->deferred_loading_data) {
1214 ui_id_preview_image_render_size(C, nullptr, id, prv, size, use_jobs);
1215 }
1216 }
1217 break;
1218 }
1219 case ICON_TYPE_BUFFER: {
1220 if (icon->obj_type == ICON_DATA_STUDIOLIGHT) {
1221 if (di->data.buffer.image == nullptr) {
1223 StudioLight *sl = static_cast<StudioLight *>(icon->obj);
1225 IconImage *img = MEM_callocN<IconImage>(__func__);
1226
1227 img->w = STUDIOLIGHT_ICON_SIZE;
1228 img->h = STUDIOLIGHT_ICON_SIZE;
1229 const size_t size = STUDIOLIGHT_ICON_SIZE * STUDIOLIGHT_ICON_SIZE * sizeof(uint);
1230 img->rect = MEM_malloc_arrayN<uint8_t>(size, __func__);
1231 memset(img->rect, 0, size);
1232 di->data.buffer.image = img;
1233
1234 wmJob *wm_job = WM_jobs_get(wm,
1236 icon,
1237 "Generating StudioLight icon...",
1238 eWM_JobFlag(0),
1240 Icon **tmp = MEM_callocN<Icon *>(__func__);
1241 *tmp = icon;
1242 WM_jobs_customdata_set(wm_job, tmp, MEM_freeN);
1243 WM_jobs_timer(wm_job, 0.01, 0, NC_WINDOW);
1246 WM_jobs_start(CTX_wm_manager(C), wm_job);
1247 }
1248 }
1249 break;
1250 }
1251 }
1252}
1253
1254bool ui_icon_is_preview_deferred_loading(const int icon_id, const bool big)
1255{
1256 const Icon *icon = BKE_icon_get(icon_id);
1257 if (icon == nullptr) {
1258 return false;
1259 }
1260
1261 const DrawInfo *di = static_cast<DrawInfo *>(icon->drawinfo);
1262 if (icon->drawinfo == nullptr) {
1263 return false;
1264 }
1265
1266 if (di->type == ICON_TYPE_PREVIEW) {
1267 const ID *id = (icon->id_type != 0) ? static_cast<ID *>(icon->obj) : nullptr;
1268 const PreviewImage *prv = id ? BKE_previewimg_id_get(id) :
1269 static_cast<PreviewImage *>(icon->obj);
1270
1271 if (prv) {
1272 const int size = big ? ICON_SIZE_PREVIEW : ICON_SIZE_ICON;
1273 return (prv->flag[size] & PRV_RENDERING) != 0;
1274 }
1275 }
1276
1277 return false;
1278}
1279
1286static void icon_set_image(const bContext *C,
1287 Scene *scene,
1288 ID *id,
1289 PreviewImage *prv_img,
1290 enum eIconSizes size,
1291 const bool use_job)
1292{
1293 if (!prv_img) {
1294 if (G.debug & G_DEBUG) {
1295 CLOG_WARN(&LOG, "%s: no preview image for this ID: %s", __func__, id->name);
1296 }
1297 return;
1298 }
1299
1300 if (prv_img->flag[size] & PRV_USER_EDITED) {
1301 /* user-edited preview, do not auto-update! */
1302 return;
1303 }
1304
1305 const bool delay = prv_img->rect[size] != nullptr;
1306 icon_create_rect(prv_img, size);
1307
1308 if (use_job && (!id || BKE_previewimg_id_supports_jobs(id))) {
1309 /* Job (background) version */
1310 ED_preview_icon_job(C, prv_img, id, size, delay);
1311 }
1312 else {
1313 if (!scene) {
1314 scene = CTX_data_scene(C);
1315 }
1316 /* Immediate version */
1317 ED_preview_icon_render(C, scene, prv_img, id, size);
1318 }
1319}
1320
1322{
1323 Icon *icon = BKE_icon_get(icon_id);
1324
1325 if (icon == nullptr) {
1326 return nullptr;
1327 }
1328
1329 DrawInfo *di = (DrawInfo *)icon->drawinfo;
1330
1331 if (di == nullptr) {
1332 return nullptr;
1333 }
1334
1335 if (di->type == ICON_TYPE_PREVIEW) {
1336 const PreviewImage *prv = (icon->id_type != 0) ? BKE_previewimg_id_ensure((ID *)icon->obj) :
1337 static_cast<const PreviewImage *>(icon->obj);
1338
1339 if (prv) {
1340 return BKE_previewimg_copy(prv);
1341 }
1342 }
1343 else if (di->data.buffer.image) {
1344 ImBuf *bbuf;
1345
1349 __func__);
1350 if (bbuf) {
1352
1353 prv->rect[0] = reinterpret_cast<uint *>(IMB_steal_byte_buffer(bbuf));
1354
1355 prv->w[0] = bbuf->x;
1356 prv->h[0] = bbuf->y;
1357
1358 IMB_freeImBuf(bbuf);
1359
1360 return prv;
1361 }
1362 }
1363
1364 return nullptr;
1365}
1366
1367static void icon_draw_rect(float x,
1368 float y,
1369 int w,
1370 int h,
1371 int rw,
1372 int rh,
1373 const uint8_t *rect,
1374 float alpha,
1375 const float desaturate)
1376{
1377 int draw_w = w;
1378 int draw_h = h;
1379 int draw_x = x;
1380 /* We need to round y, to avoid the icon jittering in some cases. */
1381 int draw_y = round_fl_to_int(y);
1382
1383 /* sanity check */
1384 if (w <= 0 || h <= 0 || w > 2000 || h > 2000) {
1385 printf("%s: icons are %i x %i pixels?\n", __func__, w, h);
1386 BLI_assert_msg(0, "invalid icon size");
1387 return;
1388 }
1389 /* modulate color */
1390 const float col[4] = {alpha, alpha, alpha, alpha};
1391
1392 float scale_x = 1.0f;
1393 float scale_y = 1.0f;
1394 /* `rect` contains image in render-size, we only scale if needed. */
1395 if (rw != w || rh != h) {
1396 /* preserve aspect ratio and center */
1397 if (rw > rh) {
1398 draw_w = w;
1399 draw_h = int((float(rh) / float(rw)) * float(w));
1400 draw_y += (h - draw_h) / 2;
1401 }
1402 else if (rw < rh) {
1403 draw_w = int((float(rw) / float(rh)) * float(h));
1404 draw_h = h;
1405 draw_x += (w - draw_w) / 2;
1406 }
1407 scale_x = draw_w / float(rw);
1408 scale_y = draw_h / float(rh);
1409 /* If the image is squared, the `draw_*` initialization values are good. */
1410 }
1411
1412 /* draw */
1413 GPUBuiltinShader shader;
1414 if (desaturate != 0.0f) {
1416 }
1417 else {
1419 }
1421
1423 immUniform1f("factor", desaturate);
1424 }
1425
1427 draw_x,
1428 draw_y,
1429 rw,
1430 rh,
1431 blender::gpu::TextureFormat::UNORM_8_8_8_8,
1432 true,
1433 rect,
1434 scale_x,
1435 scale_y,
1436 1.0f,
1437 1.0f,
1438 col);
1439}
1440
1441/* Drawing size for preview images */
1443{
1444 switch (size) {
1445 case ICON_SIZE_ICON:
1446 return ICON_DEFAULT_HEIGHT;
1447 case ICON_SIZE_PREVIEW:
1449 default:
1450 return 0;
1451 }
1452}
1453
1454static void svg_replace_color_attributes(std::string &svg,
1455 const std::string &name,
1456 const size_t start,
1457 const size_t end)
1458{
1459 bTheme *btheme = UI_GetTheme();
1460
1461 uchar white[] = {255, 255, 255, 255};
1462 uchar black[] = {0, 0, 0, 255};
1463 uchar logo_orange[] = {232, 125, 13, 255};
1464 uchar logo_blue[] = {38, 87, 135, 255};
1465
1466 /* Tool colors hardcoded for now. */
1467 uchar tool_add[] = {117, 255, 175, 255};
1468 uchar tool_remove[] = {245, 107, 91, 255};
1469 uchar tool_select[] = {255, 176, 43, 255};
1470 uchar tool_transform[] = {217, 175, 245, 255};
1471 uchar tool_white[] = {255, 255, 255, 255};
1472 uchar tool_red[] = {214, 45, 48, 255};
1473
1474 const struct ColorItem {
1475 const char *name;
1476 uchar *col = nullptr;
1477 int colorid = TH_UNDEFINED;
1478 int spacetype = SPACE_TYPE_ANY;
1479 } items[] = {
1480 {"blender_white", white},
1481 {"blender_black", black},
1482 {"blender_logo_orange", logo_orange},
1483 {"blender_logo_blue", logo_blue},
1484 {"blender_selected", btheme->tui.wcol_regular.inner},
1485 {"blender_mesh_selected", btheme->space_view3d.vertex_select},
1486 {"blender_back", nullptr, TH_BACK},
1487 {"blender_text", nullptr, TH_TEXT},
1488 {"blender_text_hi", nullptr, TH_TEXT_HI},
1489 {"blender_red_alert", nullptr, TH_ERROR},
1490 {"blender_error", nullptr, TH_ERROR},
1491 {"blender_warning", nullptr, TH_WARNING},
1492 {"blender_info", nullptr, TH_INFO},
1493 {"blender_scene", nullptr, TH_ICON_SCENE},
1494 {"blender_collection", nullptr, TH_ICON_COLLECTION},
1495 {"blender_collection_color_01", btheme->collection_color[0].color},
1496 {"blender_collection_color_02", btheme->collection_color[1].color},
1497 {"blender_collection_color_03", btheme->collection_color[2].color},
1498 {"blender_collection_color_04", btheme->collection_color[3].color},
1499 {"blender_collection_color_05", btheme->collection_color[4].color},
1500 {"blender_collection_color_06", btheme->collection_color[5].color},
1501 {"blender_collection_color_07", btheme->collection_color[6].color},
1502 {"blender_collection_color_08", btheme->collection_color[7].color},
1503 {"blender_object", nullptr, TH_ICON_OBJECT},
1504 {"blender_object_data", nullptr, TH_ICON_OBJECT_DATA},
1505 {"blender_modifier", nullptr, TH_ICON_MODIFIER},
1506 {"blender_shading", nullptr, TH_ICON_SHADING},
1507 {"blender_folder", nullptr, TH_ICON_FOLDER},
1508 {"blender_fund", nullptr, TH_ICON_FUND},
1509 {"blender_autokey", nullptr, TH_ICON_AUTOKEY},
1510 {"blender_tool_add", tool_add},
1511 {"blender_tool_remove", tool_remove},
1512 {"blender_tool_select", tool_select},
1513 {"blender_tool_transform", tool_transform},
1514 {"blender_tool_white", tool_white},
1515 {"blender_tool_red", tool_red},
1516 {"blender_bevel", nullptr, TH_BEVEL},
1517 {"blender_crease", nullptr, TH_CREASE},
1518 {"blender_seam", nullptr, TH_SEAM},
1519 {"blender_sharp", nullptr, TH_SHARP},
1520 };
1521
1522 for (const ColorItem &item : items) {
1523 if (name != item.name) {
1524 continue;
1525 }
1526
1527 uchar color[4];
1528 if (item.col) {
1529 memcpy(color, item.col, sizeof(color));
1530 }
1531 else if (item.colorid != TH_UNDEFINED) {
1532 if (item.spacetype != SPACE_TYPE_ANY) {
1533 UI_GetThemeColorType4ubv(item.colorid, item.spacetype, color);
1534 }
1535 else {
1536 UI_GetThemeColor4ubv(item.colorid, color);
1537 }
1538 }
1539 else {
1540 continue;
1541 }
1542
1543 std::string hexcolor = fmt::format(
1544 "{:02x}{:02x}{:02x}{:02x}", color[0], color[1], color[2], color[3]);
1545
1546 size_t att_start = start;
1547 while (true) {
1548 constexpr static blender::StringRef key = "fill=\"";
1549 att_start = svg.find(key, att_start);
1550 if (att_start == std::string::npos || att_start > end) {
1551 break;
1552 }
1553 const size_t att_end = svg.find("\"", att_start + key.size());
1554 if (att_end != std::string::npos && att_end < end) {
1555 svg.replace(att_start, att_end - att_start, key + "#" + hexcolor);
1556 }
1557 att_start += blender::StringRef(key + "#rrggbbaa\"").size();
1558 }
1559
1560 att_start = start;
1561 while (true) {
1562 constexpr static blender::StringRef key = "fill:";
1563 att_start = svg.find(key, att_start);
1564 if (att_start == std::string::npos || att_start > end) {
1565 break;
1566 }
1567 const size_t att_end = svg.find(";", att_start + key.size());
1568 if (att_end != std::string::npos && att_end - att_start < end) {
1569 svg.replace(att_start, att_end - att_start, key + "#" + hexcolor);
1570 }
1571 att_start += blender::StringRef(key + "#rrggbbaa").size();
1572 }
1573 }
1574}
1575
1576static void icon_source_edit_cb(std::string &svg)
1577{
1578 size_t g_start = 0;
1579
1580 /* Scan string, processing only groups with our keyword ids. */
1581
1582 while (true) {
1583 /* Look for a blender id, quick exit if not found. */
1584 constexpr static blender::StringRef key = "id=\"";
1585 const size_t id_start = svg.find(key + "blender_", g_start);
1586 if (id_start == std::string::npos) {
1587 return;
1588 }
1589
1590 /* Scan back to beginning of this group element. */
1591 g_start = svg.rfind("<g", id_start);
1592 if (g_start == std::string::npos) {
1593 /* Malformed. */
1594 return;
1595 }
1596
1597 /* Scan forward to end of the group. */
1598 const size_t g_end = svg.find("</g>", id_start);
1599 if (g_end == std::string::npos) {
1600 /* Malformed. */
1601 return;
1602 }
1603
1604 /* Get group id name. */
1605 const size_t id_end = svg.find("\"", id_start + key.size());
1606 if (id_end != std::string::npos) {
1607 std::string id_name = svg.substr(id_start + key.size(), id_end - id_start - key.size());
1608 /* Replace this group's colors. */
1609 svg_replace_color_attributes(svg, id_name, g_start, g_end);
1610 }
1611
1612 g_start = g_end;
1613 }
1614}
1615
1616static void icon_draw_size(float x,
1617 float y,
1618 int icon_id,
1619 float aspect,
1620 float alpha,
1621 enum eIconSizes size,
1622 int draw_size,
1623 const float desaturate,
1624 const uchar mono_rgba[4],
1625 const bool mono_border,
1626 const IconTextOverlay *text_overlay,
1627 const bool inverted = false)
1628{
1629 if (icon_id == ICON_NONE) {
1630 return;
1631 }
1632
1633 bTheme *btheme = UI_GetTheme();
1634 const float fdraw_size = float(draw_size);
1635
1636 Icon *icon = BKE_icon_get(icon_id);
1637
1638 if (icon == nullptr) {
1639 if (G.debug & G_DEBUG) {
1640 CLOG_WARN(&LOG, "%s: Internal error, no icon for icon ID: %d", __func__, icon_id);
1641 }
1642 icon_id = ICON_NOT_FOUND;
1643 icon = BKE_icon_get(icon_id);
1644 }
1645
1646 if (icon->obj_type != ICON_DATA_STUDIOLIGHT) {
1647 /* Icon alpha should not apply to MatCap/Studio lighting. #80356. */
1648 alpha *= btheme->tui.icon_alpha;
1649 }
1650
1651 /* scale width and height according to aspect */
1652 int w = int(fdraw_size / aspect + 0.5f);
1653 int h = int(fdraw_size / aspect + 0.5f);
1654
1655 DrawInfo *di = icon_ensure_drawinfo(icon);
1656
1657 /* We need to flush widget base first to ensure correct ordering. */
1659
1660 if (di->type == ICON_TYPE_IMBUF) {
1661 const ImBuf *ibuf = static_cast<const ImBuf *>(icon->obj);
1662
1664 icon_draw_rect(x, y, w, h, ibuf->x, ibuf->y, ibuf->byte_buffer.data, alpha, desaturate);
1666 }
1667 else if (di->type == ICON_TYPE_VECTOR) {
1668 /* vector icons use the uiBlock transformation, they are not drawn
1669 * with untransformed coordinates like the other icons */
1670 di->data.vector.func(
1671 x, y, float(draw_size) / aspect, float(draw_size) / aspect, alpha, mono_rgba);
1672 }
1673 else if (di->type == ICON_TYPE_GEOM) {
1674#ifdef USE_UI_TOOLBAR_HACK
1675 /* TODO(@ideasman42): scale icons up for toolbar,
1676 * we need a way to detect larger buttons and do this automatic. */
1677 {
1679 y = (y + (h / 2)) - ((h * scale) / 2);
1680 w *= scale;
1681 h *= scale;
1682 }
1683#endif
1684
1685 /* If the theme is light, we will adjust the icon colors. */
1686 const bool invert = (srgb_to_grayscale_byte(btheme->tui.wcol_toolbar_item.inner) > 128);
1687 const bool geom_inverted = di->data.geom.inverted;
1688
1689 /* This could re-generate often if rendered at different sizes in the one interface.
1690 * TODO(@ideasman42): support caching multiple sizes. */
1691 ImBuf *ibuf = di->data.geom.image_cache;
1692 if ((ibuf == nullptr) || (ibuf->x != w) || (ibuf->y != h) || (invert != geom_inverted)) {
1693 if (ibuf) {
1694 IMB_freeImBuf(ibuf);
1695 }
1696 if (invert != geom_inverted) {
1697 BKE_icon_geom_invert_lightness(static_cast<Icon_Geom *>(icon->obj));
1698 }
1699 ibuf = BKE_icon_geom_rasterize(static_cast<Icon_Geom *>(icon->obj), w, h);
1700 di->data.geom.image_cache = ibuf;
1701 di->data.geom.inverted = invert;
1702 }
1703
1705 icon_draw_rect(x, y, w, h, w, h, ibuf->byte_buffer.data, alpha, desaturate);
1707 }
1708 else if (di->type == ICON_TYPE_EVENT) {
1709 icon_draw_rect_input(x, y, w, h, icon_id, aspect, alpha, inverted);
1710 }
1712 /* The alpha may be over 1.0, however `outline_intensity` must be in the [0..1] range. */
1713 const float outline_intensity = mono_border ?
1714 std::min(1.0f,
1715 (btheme->tui.icon_border_intensity > 0.0f ?
1716 btheme->tui.icon_border_intensity :
1717 0.3f) *
1718 alpha) :
1719 0.0f;
1720
1721 float color[4];
1722 if (icon_id == ICON_NOT_FOUND) {
1724 }
1725 else if (mono_rgba) {
1726 rgba_uchar_to_float(color, mono_rgba);
1727 }
1728 else {
1730 }
1731
1732 color[3] *= alpha;
1733
1734 if (di->type == ICON_TYPE_SVG_COLOR) {
1735 BLF_draw_svg_icon(uint(icon_id),
1736 x,
1737 y,
1738 float(draw_size) / aspect,
1739 color,
1740 outline_intensity,
1741 true,
1743 }
1744 else {
1745 BLF_draw_svg_icon(uint(icon_id),
1746 x,
1747 y,
1748 float(draw_size) / aspect,
1749 color,
1750 outline_intensity,
1751 false,
1752 nullptr);
1753 }
1754
1755 if (text_overlay && text_overlay->text[0] != '\0') {
1756 /* Handle the little numbers on top of the icon. */
1757 uchar text_color[4];
1758 if (text_overlay->color[3]) {
1759 copy_v4_v4_uchar(text_color, text_overlay->color);
1760 }
1761 else {
1762 UI_GetThemeColor4ubv(TH_TEXT, text_color);
1763 }
1764 const bool is_light = srgb_to_grayscale_byte(text_color) > 96;
1765 const float zoom_factor = w / UI_ICON_SIZE;
1766 uiFontStyle fstyle_small = *UI_FSTYLE_WIDGET;
1767 fstyle_small.points *= zoom_factor * 0.8f;
1769 fstyle_small.shadx = 0;
1770 fstyle_small.shady = 0;
1771 rcti text_rect = {int(x), int(x + UI_UNIT_X * zoom_factor), int(y), int(y)};
1773 UI_fontstyle_draw(&fstyle_small,
1774 &text_rect,
1775 text_overlay->text,
1776 sizeof(text_overlay->text),
1777 text_color,
1778 &params);
1779 }
1780 }
1781
1782 else if (di->type == ICON_TYPE_BUFFER) {
1783 /* it is a builtin icon */
1784 IconImage *iimg = di->data.buffer.image;
1785#ifndef WITH_HEADLESS
1786 icon_verify_datatoc(iimg);
1787#endif
1788 if (!iimg->rect) {
1789 /* something has gone wrong! */
1790 return;
1791 }
1792
1793 icon_draw_rect(x, y, w, h, iimg->w, iimg->h, iimg->rect, alpha, desaturate);
1794 }
1795 else if (di->type == ICON_TYPE_PREVIEW) {
1796 PreviewImage *pi = (icon->id_type != 0) ? BKE_previewimg_id_ensure((ID *)icon->obj) :
1797 static_cast<PreviewImage *>(icon->obj);
1798
1799 if (pi) {
1800 /* no create icon on this level in code */
1801 if (!pi->rect[size]) {
1802 /* Something has gone wrong! */
1803 return;
1804 }
1805
1806 /* Preview images use premultiplied alpha. */
1809 y,
1810 w,
1811 h,
1812 pi->w[size],
1813 pi->h[size],
1814 reinterpret_cast<const uint8_t *>(pi->rect[size]),
1815 alpha,
1816 desaturate);
1818 }
1819 }
1820 else if (di->type == ICON_TYPE_GPLAYER) {
1821 BLI_assert(icon->obj != nullptr);
1822
1823 /* Just draw a colored rect - Like for vicon_colorset_draw() */
1824#ifndef WITH_HEADLESS
1825 vicon_gplayer_color_draw(icon, int(x), int(y), w, h);
1826#endif
1827 }
1828}
1829
1831 const bContext *C, Scene *scene, ID *id, PreviewImage *pi, int size, const bool use_job)
1832{
1833 /* changed only ever set by dynamic icons */
1834 if ((pi->flag[size] & PRV_CHANGED) || (!pi->rect[size] && !BKE_previewimg_is_invalid(pi))) {
1835 /* create the rect if necessary */
1836 icon_set_image(C, scene, id, pi, eIconSizes(size), use_job);
1837
1838 pi->flag[size] &= ~PRV_CHANGED;
1839 }
1840}
1841
1843 Scene *scene,
1844 ID *id_to_render,
1845 const enum eIconSizes size,
1846 const bool use_job,
1847 PreviewImage *r_preview_image)
1848{
1849 ui_id_preview_image_render_size(C, scene, id_to_render, r_preview_image, size, use_job);
1850}
1851
1853 const bContext *C, Scene *scene, ID *id, const enum eIconSizes size, const bool use_job)
1854{
1856 if (pi == nullptr) {
1857 return;
1858 }
1859
1860 ID *id_to_render = id;
1861
1862 /* For objects, first try if a preview can created via the object data. */
1863 if (GS(id->name) == ID_OB) {
1864 Object *ob = (Object *)id;
1865 if (ED_preview_id_is_supported(static_cast<const ID *>(ob->data))) {
1866 id_to_render = static_cast<ID *>(ob->data);
1867 }
1868 }
1869
1870 if (!ED_preview_id_is_supported(id_to_render)) {
1871 return;
1872 }
1873
1874 UI_icon_render_id_ex(C, scene, id_to_render, size, use_job, pi);
1875}
1876
1877static void ui_id_icon_render(const bContext *C, ID *id, bool use_jobs)
1878{
1880
1881 if (!pi) {
1882 return;
1883 }
1884
1885 for (int i = 0; i < NUM_ICON_SIZES; i++) {
1886 ui_id_preview_image_render_size(C, nullptr, id, pi, i, use_jobs);
1887 }
1888}
1889
1890static int ui_id_screen_get_icon(const bContext *C, ID *id)
1891{
1893 /* Don't use jobs here, off-screen rendering doesn't like this and crashes. */
1894 ui_id_icon_render(C, id, false);
1895
1896 return id->icon_id;
1897}
1898
1899int ui_id_icon_get(const bContext *C, ID *id, const bool big)
1900{
1901 int iconid = 0;
1902
1903 /* icon */
1904 switch (GS(id->name)) {
1905 case ID_MA: /* fall through */
1906 case ID_TE: /* fall through */
1907 case ID_IM: /* fall through */
1908 case ID_WO: /* fall through */
1909 case ID_LA: /* fall through */
1910 iconid = BKE_icon_id_ensure(id);
1911 /* checks if not exists, or changed */
1912 UI_icon_render_id(C, nullptr, id, big ? ICON_SIZE_PREVIEW : ICON_SIZE_ICON, true);
1913 break;
1914 case ID_SCR:
1915 iconid = ui_id_screen_get_icon(C, id);
1916 break;
1917 case ID_GR:
1919 break;
1920 default:
1921 break;
1922 }
1923
1924 return iconid;
1925}
1926
1928{
1929 if (ID_IS_LINKED(id)) {
1930 if (ID_IS_PACKED(id)) {
1931 return ICON_PACKAGE;
1932 }
1933 if (id->tag & ID_TAG_MISSING) {
1934 return ICON_LIBRARY_DATA_BROKEN;
1935 }
1936 if (id->tag & ID_TAG_INDIRECT) {
1937 return ICON_LIBRARY_DATA_INDIRECT;
1938 }
1939 return ICON_LIBRARY_DATA_DIRECT;
1940 }
1941 if (ID_IS_OVERRIDE_LIBRARY(id)) {
1942 if (!ID_IS_OVERRIDE_LIBRARY_REAL(id) ||
1944 {
1945 return ICON_LIBRARY_DATA_OVERRIDE_NONEDITABLE;
1946 }
1947 return ICON_LIBRARY_DATA_OVERRIDE;
1948 }
1949 if (ID_IS_ASSET(id)) {
1950 return ICON_ASSET_MANAGER;
1951 }
1952
1953 return ICON_NONE;
1954}
1955
1956int UI_icon_from_rnaptr(const bContext *C, PointerRNA *ptr, int rnaicon, const bool big)
1957{
1958 ID *id = nullptr;
1959
1960 if (!ptr->data) {
1961 return rnaicon;
1962 }
1963
1964 /* Try ID, material, texture or dynamic-paint slot. */
1965 if (RNA_struct_is_ID(ptr->type)) {
1966 id = ptr->owner_id;
1967 }
1968 else if (RNA_struct_is_a(ptr->type, &RNA_MaterialSlot)) {
1969 id = static_cast<ID *>(RNA_pointer_get(ptr, "material").data);
1970 }
1971 else if (RNA_struct_is_a(ptr->type, &RNA_TextureSlot)) {
1972 id = static_cast<ID *>(RNA_pointer_get(ptr, "texture").data);
1973 }
1974 else if (RNA_struct_is_a(ptr->type, &RNA_FileBrowserFSMenuEntry)) {
1975 return RNA_int_get(ptr, "icon");
1976 }
1977 else if (RNA_struct_is_a(ptr->type, &RNA_DynamicPaintSurface)) {
1978 const DynamicPaintSurface *surface = static_cast<const DynamicPaintSurface *>(ptr->data);
1979
1980 if (surface->format == MOD_DPAINT_SURFACE_F_PTEX) {
1981 return ICON_SHADING_TEXTURE;
1982 }
1983 if (surface->format == MOD_DPAINT_SURFACE_F_VERTEX) {
1984 return ICON_OUTLINER_DATA_MESH;
1985 }
1986 if (surface->format == MOD_DPAINT_SURFACE_F_IMAGESEQ) {
1987 return ICON_FILE_IMAGE;
1988 }
1989 }
1990 else if (RNA_struct_is_a(ptr->type, &RNA_StudioLight)) {
1991 StudioLight *sl = static_cast<StudioLight *>(ptr->data);
1992 switch (sl->flag & STUDIOLIGHT_FLAG_ORIENTATIONS) {
1994 return sl->icon_id_irradiance;
1996 default:
1997 return sl->icon_id_radiance;
1999 return sl->icon_id_matcap;
2000 }
2001 }
2002
2003 /* get icon from ID */
2004 if (id) {
2005 const int icon = ui_id_icon_get(C, id, big);
2006
2007 return icon ? icon : rnaicon;
2008 }
2009
2010 return rnaicon;
2011}
2012
2013int UI_icon_from_idcode(const int idcode)
2014{
2015 switch ((ID_Type)idcode) {
2016 case ID_AC:
2017 return ICON_ACTION;
2018 case ID_AR:
2019 return ICON_ARMATURE_DATA;
2020 case ID_BR:
2021 return ICON_BRUSH_DATA;
2022 case ID_CA:
2023 return ICON_CAMERA_DATA;
2024 case ID_CF:
2025 return ICON_FILE;
2026 case ID_CU_LEGACY:
2027 return ICON_CURVE_DATA;
2028 case ID_GD_LEGACY:
2029 return ICON_OUTLINER_DATA_GREASEPENCIL;
2030 case ID_GR:
2031 return ICON_GROUP;
2032 case ID_IM:
2033 return ICON_IMAGE_DATA;
2034 case ID_LA:
2035 return ICON_LIGHT_DATA;
2036 case ID_LS:
2037 return ICON_LINE_DATA;
2038 case ID_LT:
2039 return ICON_LATTICE_DATA;
2040 case ID_MA:
2041 return ICON_MATERIAL_DATA;
2042 case ID_MB:
2043 return ICON_META_DATA;
2044 case ID_MC:
2045 return ICON_TRACKER;
2046 case ID_ME:
2047 return ICON_MESH_DATA;
2048 case ID_MSK:
2049 return ICON_MOD_MASK; /* TODO: this would need its own icon! */
2050 case ID_NT:
2051 return ICON_NODETREE;
2052 case ID_OB:
2053 return ICON_OBJECT_DATA;
2054 case ID_PA:
2055 return ICON_PARTICLE_DATA;
2056 case ID_PAL:
2057 return ICON_COLOR; /* TODO: this would need its own icon! */
2058 case ID_PC:
2059 return ICON_CURVE_BEZCURVE; /* TODO: this would need its own icon! */
2060 case ID_LP:
2061 return ICON_OUTLINER_DATA_LIGHTPROBE;
2062 case ID_SCE:
2063 return ICON_SCENE_DATA;
2064 case ID_SPK:
2065 return ICON_SPEAKER;
2066 case ID_SO:
2067 return ICON_SOUND;
2068 case ID_TE:
2069 return ICON_TEXTURE_DATA;
2070 case ID_TXT:
2071 return ICON_TEXT;
2072 case ID_VF:
2073 return ICON_FONT_DATA;
2074 case ID_CV:
2075 return ICON_CURVES_DATA;
2076 case ID_PT:
2077 return ICON_POINTCLOUD_DATA;
2078 case ID_VO:
2079 return ICON_VOLUME_DATA;
2080 case ID_WO:
2081 return ICON_WORLD_DATA;
2082 case ID_WS:
2083 return ICON_WORKSPACE;
2084 case ID_GP:
2085 return ICON_OUTLINER_DATA_GREASEPENCIL;
2086 case ID_KE:
2087 return ICON_SHAPEKEY_DATA;
2088
2089 /* No icons for these ID-types. */
2090 case ID_LI:
2091 case ID_SCR:
2092 case ID_WM:
2093 break;
2094 }
2095 return ICON_NONE;
2096}
2097
2098int UI_icon_from_object_mode(const int mode)
2099{
2100 switch ((eObjectMode)mode) {
2101 case OB_MODE_OBJECT:
2102 return ICON_OBJECT_DATAMODE;
2103 case OB_MODE_EDIT:
2105 return ICON_EDITMODE_HLT;
2106 case OB_MODE_SCULPT:
2109 return ICON_SCULPTMODE_HLT;
2112 return ICON_VPAINT_HLT;
2115 return ICON_WPAINT_HLT;
2117 return ICON_TPAINT_HLT;
2119 return ICON_PARTICLEMODE;
2120 case OB_MODE_POSE:
2121 return ICON_POSE_HLT;
2123 return ICON_GREASEPENCIL;
2124 }
2125 return ICON_NONE;
2126}
2127
2129{
2130 int icon = ICON_OUTLINER_COLLECTION;
2131
2132 if (collection->color_tag != COLLECTION_COLOR_NONE) {
2133 icon = ICON_COLLECTION_COLOR_01 + collection->color_tag;
2134 }
2135
2136 return icon;
2137}
2138
2139void UI_icon_draw(float x, float y, int icon_id)
2140{
2142 x, y, icon_id, UI_INV_SCALE_FAC, 1.0f, 0.0f, nullptr, false, UI_NO_ICON_OVERLAY_TEXT);
2143}
2144
2145void UI_icon_draw_alpha(float x, float y, int icon_id, float alpha)
2146{
2148 x, y, icon_id, UI_INV_SCALE_FAC, alpha, 0.0f, nullptr, false, UI_NO_ICON_OVERLAY_TEXT);
2149}
2150
2151void UI_icon_draw_preview(float x, float y, int icon_id, float aspect, float alpha, int size)
2152{
2154 y,
2155 icon_id,
2156 aspect,
2157 alpha,
2159 size,
2160 false,
2161 nullptr,
2162 false,
2164}
2165
2167 float y,
2168 int icon_id,
2169 float aspect,
2170 float alpha,
2171 float desaturate,
2172 const uchar mono_color[4],
2173 const bool mono_border,
2174 const IconTextOverlay *text_overlay,
2175 const bool inverted)
2176{
2177 const int draw_size = get_draw_size(ICON_SIZE_ICON);
2179 y,
2180 icon_id,
2181 aspect,
2182 alpha,
2184 draw_size,
2185 desaturate,
2186 mono_color,
2187 mono_border,
2188 text_overlay,
2189 inverted);
2190}
2191
2192ImBuf *UI_svg_icon_bitmap(uint icon_id, float size, bool multicolor)
2193{
2194 if (icon_id >= ICON_BLANK_LAST_SVG_ITEM) {
2195 return nullptr;
2196 }
2197
2198 ImBuf *ibuf = nullptr;
2199 int width;
2200 int height;
2201 blender::Array<uchar> bitmap;
2202
2203 if (multicolor) {
2204 bitmap = BLF_svg_icon_bitmap(icon_id, size, &width, &height, true, icon_source_edit_cb);
2205 }
2206 else {
2207 bitmap = BLF_svg_icon_bitmap(icon_id, size, &width, &height, false, nullptr);
2208 }
2209
2210 if (!bitmap.is_empty()) {
2211 ibuf = IMB_allocFromBuffer(bitmap.data(), nullptr, width, height, 4);
2212 }
2213
2214 if (ibuf) {
2215 IMB_flipy(ibuf);
2216 if (multicolor) {
2218 }
2219 }
2220
2221 return ibuf;
2222}
2223
2225 const int icon_indicator_number)
2226{
2227 /* The icon indicator is used as an aggregator, no need to show if it is 1. */
2228 if (icon_indicator_number < 2) {
2229 text_overlay->text[0] = '\0';
2230 return;
2231 }
2232 BLI_str_format_integer_unit(text_overlay->text, icon_indicator_number);
2233}
2234
2235/* ********** Alert Icons ********** */
2236
2238{
2239#ifdef WITH_HEADLESS
2240 UNUSED_VARS(icon, size);
2241 return nullptr;
2242#else
2243
2244 int icon_id = ICON_NONE;
2245 switch (icon) {
2246 case ALERT_ICON_WARNING:
2247 icon_id = ICON_WARNING_LARGE;
2248 break;
2250 icon_id = ICON_QUESTION_LARGE;
2251 break;
2252 case ALERT_ICON_ERROR:
2253 icon_id = ICON_CANCEL_LARGE;
2254 break;
2255 case ALERT_ICON_INFO:
2256 icon_id = ICON_INFO_LARGE;
2257 break;
2258 default:
2259 icon_id = ICON_NONE;
2260 }
2261
2262 if (icon_id == ICON_NONE) {
2263 return nullptr;
2264 }
2265
2266 return UI_svg_icon_bitmap(icon_id, size, false);
2267#endif
2268}
void immDrawPixelsTexScaledFullSize(const IMMDrawPixelsTexState *state, float x, float y, int img_w, int img_h, blender::gpu::TextureFormat gpu_format, bool use_filter, const void *rect, float scaleX, float scaleY, float xzoom, float yzoom, const float color[4])
Definition glutil.cc:51
IMMDrawPixelsTexState immDrawPixelsTexSetup(int builtin)
Definition glutil.cc:37
wmWindow * CTX_wm_window(const bContext *C)
Scene * CTX_data_scene(const bContext *C)
wmWindowManager * CTX_wm_manager(const bContext *C)
@ G_DEBUG
#define ICON_RENDER_DEFAULT_HEIGHT
Definition BKE_icons.h:149
void BKE_icon_set(int icon_id, struct Icon *icon)
Definition icons.cc:416
void BKE_icons_free(void)
Definition icons.cc:178
struct Icon * BKE_icon_get(int icon_id)
Definition icons.cc:400
struct ImBuf * BKE_icon_geom_rasterize(const struct Icon_Geom *geom, unsigned int size_x, unsigned int size_y)
void BKE_icon_geom_invert_lightness(struct Icon_Geom *geom)
@ ICON_DATA_IMBUF
Definition BKE_icons.h:27
@ ICON_DATA_STUDIOLIGHT
Definition BKE_icons.h:33
@ ICON_DATA_PREVIEW
Definition BKE_icons.h:29
@ ICON_DATA_ID
Definition BKE_icons.h:25
@ ICON_DATA_GPLAYER
Definition BKE_icons.h:35
@ ICON_DATA_GEOM
Definition BKE_icons.h:31
int BKE_icon_id_ensure(struct ID *id)
Definition icons.cc:267
PreviewImage * BKE_previewimg_id_get(const ID *id)
PreviewImage * BKE_previewimg_create()
bool BKE_previewimg_id_supports_jobs(const ID *id)
PreviewImage * BKE_previewimg_id_ensure(ID *id)
bool BKE_previewimg_is_invalid(const PreviewImage *prv)
void BKE_preview_images_free()
PreviewImage * BKE_previewimg_copy(const PreviewImage *prv)
@ STUDIOLIGHT_TYPE_MATCAP
@ STUDIOLIGHT_TYPE_WORLD
@ STUDIOLIGHT_TYPE_STUDIO
#define STUDIOLIGHT_ICON_SIZE
void BKE_studiolight_set_free_function(StudioLight *sl, StudioLightFreeFunction *free_function, void *data)
#define STUDIOLIGHT_FLAG_ORIENTATIONS
void BKE_studiolight_preview(uint *icon_buffer, StudioLight *sl, int icon_id_type)
void BLF_draw_svg_icon(uint icon_id, float x, float y, float size, const float color[4]=nullptr, float outline_alpha=1.0f, bool multicolor=false, blender::FunctionRef< void(std::string &)> edit_source_cb=nullptr)
Definition blf.cc:625
void BLF_size(int fontid, float size)
Definition blf.cc:443
void BLF_width_and_height(int fontid, const char *str, size_t str_len, float *r_width, float *r_height) ATTR_NONNULL()
Definition blf.cc:789
blender::Array< uchar > BLF_svg_icon_bitmap(uint icon_id, float size, int *r_width, int *r_height, bool multicolor=false, blender::FunctionRef< void(std::string &)> edit_source_cb=nullptr)
Definition blf.cc:646
int BLF_default()
void BLF_draw(int fontid, const char *str, size_t str_len, ResultBLF *r_info=nullptr) ATTR_NONNULL(2)
Definition blf.cc:585
void BLF_color4ubv(int fontid, const unsigned char rgba[4])
Definition blf.cc:452
void BLF_position(int fontid, float x, float y, float z)
Definition blf.cc:388
#define BLI_assert(a)
Definition BLI_assert.h:46
#define BLI_assert_msg(a, msg)
Definition BLI_assert.h:53
MINLINE int round_fl_to_int(float a)
MINLINE void rgba_uchar_to_float(float r_col[4], const unsigned char col_ub[4])
MINLINE unsigned char srgb_to_grayscale_byte(const unsigned char rgb[3])
MINLINE void copy_v4_v4_uchar(unsigned char r[4], const unsigned char a[4])
void BLI_str_format_integer_unit(char dst[BLI_STR_FORMAT_INT32_INTEGER_UNIT_SIZE], int number_to_format) ATTR_NONNULL(1)
Definition string.cc:1294
unsigned char uchar
unsigned int uint
#define UNUSED_VARS(...)
#define ELEM(...)
#define CTX_IFACE_(context, msgid)
#define BLT_I18NCONTEXT_COLOR
#define CLOG_WARN(clg_ref,...)
Definition CLG_log.h:189
#define ID_IS_PACKED(_id)
Definition DNA_ID.h:700
@ ID_TAG_INDIRECT
Definition DNA_ID.h:848
@ ID_TAG_MISSING
Definition DNA_ID.h:867
#define ID_IS_OVERRIDE_LIBRARY_REAL(_id)
Definition DNA_ID.h:723
#define ID_IS_LINKED(_id)
Definition DNA_ID.h:694
#define ID_IS_ASSET(_id)
Definition DNA_ID.h:737
#define ID_IS_OVERRIDE_LIBRARY(_id)
Definition DNA_ID.h:730
@ LIBOVERRIDE_FLAG_SYSTEM_DEFINED
Definition DNA_ID.h:363
@ PRV_RENDERING
Definition DNA_ID.h:622
@ PRV_CHANGED
Definition DNA_ID.h:618
@ PRV_USER_EDITED
Definition DNA_ID.h:620
eIconSizes
@ ICON_SIZE_PREVIEW
@ ICON_SIZE_ICON
@ NUM_ICON_SIZES
ID_Type
@ ID_WM
@ ID_CA
@ ID_AR
@ ID_MC
@ ID_CF
@ ID_LI
@ ID_TE
@ ID_IM
@ ID_VO
@ ID_WS
@ ID_NT
@ ID_LA
@ ID_KE
@ ID_TXT
@ ID_SO
@ ID_SCE
@ ID_LS
@ ID_MSK
@ ID_CV
@ ID_PAL
@ ID_BR
@ ID_LP
@ ID_WO
@ ID_MA
@ ID_AC
@ ID_SCR
@ ID_CU_LEGACY
@ ID_GD_LEGACY
@ ID_VF
@ ID_ME
@ ID_GR
@ ID_SPK
@ ID_MB
@ ID_LT
@ ID_OB
@ ID_GP
@ ID_PA
@ ID_PT
@ ID_PC
Object groups, one object can be in many groups at once.
@ COLLECTION_COLOR_NONE
eBezTriple_KeyframeType
@ BEZT_KEYTYPE_EXTREME
@ BEZT_KEYTYPE_JITTER
@ BEZT_KEYTYPE_BREAKDOWN
@ BEZT_KEYTYPE_MOVEHOLD
@ BEZT_KEYTYPE_GENERATED
@ BEZT_KEYTYPE_KEYFRAME
@ MOD_DPAINT_SURFACE_F_PTEX
@ MOD_DPAINT_SURFACE_F_VERTEX
@ MOD_DPAINT_SURFACE_F_IMAGESEQ
@ LAYERGROUP_COLOR_01
@ LAYERGROUP_COLOR_06
@ LAYERGROUP_COLOR_04
@ LAYERGROUP_COLOR_05
@ LAYERGROUP_COLOR_03
@ LAYERGROUP_COLOR_08
@ LAYERGROUP_COLOR_07
@ LAYERGROUP_COLOR_02
@ SOCK_DISPLAY_SHAPE_CIRCLE
eObjectMode
@ OB_MODE_VERTEX_GREASE_PENCIL
@ OB_MODE_PARTICLE_EDIT
@ OB_MODE_EDIT_GPENCIL_LEGACY
@ OB_MODE_EDIT
@ OB_MODE_WEIGHT_PAINT
@ OB_MODE_SCULPT
@ OB_MODE_SCULPT_CURVES
@ OB_MODE_PAINT_GREASE_PENCIL
@ OB_MODE_SCULPT_GREASE_PENCIL
@ OB_MODE_POSE
@ OB_MODE_TEXTURE_PAINT
@ OB_MODE_OBJECT
@ OB_MODE_WEIGHT_GREASE_PENCIL
@ OB_MODE_VERTEX_PAINT
@ RGN_TYPE_WINDOW
@ STRIP_COLOR_03
@ STRIP_COLOR_01
@ STRIP_COLOR_04
@ STRIP_COLOR_06
@ STRIP_COLOR_02
@ STRIP_COLOR_08
@ STRIP_COLOR_09
@ STRIP_COLOR_07
@ STRIP_COLOR_05
@ SPACE_ACTION
@ SPACE_NODE
#define SPACE_TYPE_ANY
#define UI_SCALE_FAC
#define UI_INV_SCALE_FAC
#define UI_ICON_SIZE
@ KEYFRAME_SHAPE_BOTH
@ KEYFRAME_HANDLE_VECTOR
@ KEYFRAME_HANDLE_FREE
@ KEYFRAME_HANDLE_AUTO_CLAMP
@ KEYFRAME_HANDLE_NONE
@ KEYFRAME_HANDLE_AUTO
@ KEYFRAME_HANDLE_ALIGNED
@ KEYFRAME_EXTREME_NONE
bool ED_preview_id_is_supported(const ID *id, const char **r_disabled_hint=nullptr)
void ED_preview_icon_job(const bContext *C, PreviewImage *prv_img, ID *id, enum eIconSizes icon_size, bool delay)
void ED_preview_icon_render(const bContext *C, Scene *scene, PreviewImage *prv_img, ID *id, enum eIconSizes icon_size)
bool ED_preview_use_image_size(const PreviewImage *preview, eIconSizes size)
void immEnd()
void immUnbindProgram()
void immBindBuiltinProgram(GPUBuiltinShader shader_id)
void immUniform2f(const char *name, float x, float y)
void immUniformColor3ubv(const unsigned char rgb[3])
void immUniform1f(const char *name, float x)
GPUVertFormat * immVertexFormat()
void immBegin(GPUPrimType, uint vertex_len)
void immUniformColor3fv(const float rgb[3])
void immRectf(uint pos, float x1, float y1, float x2, float y2)
@ GPU_PRIM_POINTS
GPUBuiltinShader
@ GPU_SHADER_KEYFRAME_SHAPE
@ GPU_SHADER_2D_IMAGE_DESATURATE_COLOR
@ GPU_SHADER_3D_UNIFORM_COLOR
@ GPU_SHADER_3D_IMAGE_COLOR
void GPU_program_point_size(bool enable)
Definition gpu_state.cc:180
@ GPU_BLEND_ALPHA
Definition GPU_state.hh:87
@ GPU_BLEND_ALPHA_PREMULT
Definition GPU_state.hh:88
void GPU_blend(GPUBlend blend)
Definition gpu_state.cc:42
uint GPU_vertformat_attr_add(GPUVertFormat *format, blender::StringRef name, blender::gpu::VertAttrType type)
void IMB_flipy(ImBuf *ibuf)
void IMB_premultiply_alpha(ImBuf *ibuf)
Definition filter.cc:381
ImBuf * IMB_load_image_from_memory(const unsigned char *mem, const size_t size, const int flags, const char *descr, const char *filepath=nullptr, char r_colorspace[IM_MAX_SPACE]=nullptr)
Definition readimage.cc:121
uint8_t * IMB_steal_byte_buffer(ImBuf *ibuf)
ImBuf * IMB_allocFromBuffer(const uint8_t *byte_buffer, const float *float_buffer, unsigned int w, unsigned int h, unsigned int channels)
void IMB_freeImBuf(ImBuf *ibuf)
bool IMB_scale(ImBuf *ibuf, unsigned int newx, unsigned int newy, IMBScaleFilter filter, bool threaded=true)
Definition scaling.cc:465
@ IB_byte_data
#define PREVIEW_RENDER_DEFAULT_HEIGHT
Definition IMB_thumbs.hh:40
Read Guarded memory(de)allocation.
#define C
Definition RandGen.cpp:29
void UI_draw_roundbox_4fv_ex(const rctf *rect, const float inner1[4], const float inner2[4], float shade_dir, const float outline[4], float outline_width, float rad)
void UI_draw_roundbox_corner_set(int type)
@ UI_STYLE_TEXT_RIGHT
@ UI_CNR_ALL
void UI_fontstyle_draw(const uiFontStyle *fs, const rcti *rect, const char *str, size_t str_len, const uchar col[4], const uiFontStyleDraw_Params *fs_params)
#define UI_FSTYLE_WIDGET
#define UI_UNIT_X
void UI_widgetbase_draw_cache_flush()
void UI_icons_free_drawinfo(void *drawinfo)
#define ICON_DEFAULT_HEIGHT
#define ICON_DEFAULT_HEIGHT_TOOLBAR
#define PREVIEW_DEFAULT_HEIGHT
#define UI_NO_ICON_OVERLAY_TEXT
@ ALERT_ICON_INFO
@ ALERT_ICON_WARNING
@ ALERT_ICON_QUESTION
@ ALERT_ICON_ERROR
#define ICON_DEFAULT_WIDTH
void UI_Theme_Store(bThemeState *theme_state)
void UI_Theme_Restore(const bThemeState *theme_state)
#define TH_UNDEFINED
@ TH_ICON_MODIFIER
@ TH_ICON_AUTOKEY
@ TH_ICON_OBJECT
@ TH_SEAM
@ TH_ICON_FOLDER
@ TH_WARNING
@ TH_BACK
@ TH_WIRE
@ TH_ICON_COLLECTION
@ TH_SHARP
@ TH_ICON_OBJECT_DATA
@ TH_ICON_SHADING
@ TH_ICON_SCENE
@ TH_INFO
@ TH_BEVEL
@ TH_ERROR
@ TH_ICON_FUND
@ TH_TEXT
@ TH_CREASE
@ TH_TEXT_HI
void UI_GetThemeColorType4ubv(int colorid, int spacetype, unsigned char col[4])
void UI_GetThemeColorType4fv(int colorid, int spacetype, float col[4])
void UI_GetThemeColor4fv(int colorid, float col[4])
bool UI_GetIconThemeColor4ubv(int colorid, unsigned char col[4])
bTheme * UI_GetTheme()
void UI_SetTheme(int spacetype, int regionid)
void UI_GetThemeColor4ubv(int colorid, unsigned char col[4])
@ WM_JOB_TYPE_STUDIOLIGHT
Definition WM_api.hh:1801
eWM_JobFlag
Definition WM_api.hh:1759
#define NC_WINDOW
Definition WM_types.hh:375
@ KM_NOTHING
Definition WM_types.hh:310
@ KM_ANY
Definition WM_types.hh:309
@ KM_DBL_CLICK
Definition WM_types.hh:314
@ KM_PRESS_DRAG
Definition WM_types.hh:319
#define KM_MOD_NUM
Definition WM_types.hh:297
#define KM_MOD_HELD
Definition WM_types.hh:326
#define U
BMesh const char void * data
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
Definition btDbvt.cpp:52
SIMD_FORCE_INLINE const btScalar & w() const
Return the w value.
Definition btQuadWord.h:119
const T * data() const
Definition BLI_array.hh:312
bool is_empty() const
Definition BLI_array.hh:264
constexpr int64_t find(char c, int64_t pos=0) const
constexpr int64_t size() const
nullptr float
#define str(s)
#define GS(x)
uint pos
uint col
#define input
#define printf(...)
TEX_TEMPLATE DataVec texture(T, FltCoord, float=0.0f) RET
bool ui_icon_is_preview_deferred_loading(const int icon_id, const bool big)
static void vicon_rgb_red_draw(float x, float y, float w, float h, float alpha, const uchar mono_rgba[4])
void UI_icons_free_drawinfo(void *drawinfo)
static void vicon_handletype_aligned_draw(float x, float y, float w, float h, float alpha, const uchar *)
int UI_icon_from_object_mode(const int mode)
static void vicon_handletype_auto_clamp_draw(float x, float y, float w, float h, float alpha, const uchar *)
static void init_event_icons()
static void vicon_strip_color_draw(short color_tag, float x, float y, float w, float, float)
static void ui_id_preview_image_render_size(const bContext *C, Scene *scene, ID *id, PreviewImage *pi, int size, const bool use_job)
#define DEF_ICON_VECTOR_COLORSET_DRAW_NTH(prefix, index)
int UI_icon_from_keymap_item(const wmKeyMapItem *kmi, int r_icon_mod[KM_MOD_NUM])
PreviewImage * UI_icon_to_preview(int icon_id)
void UI_icon_text_overlay_init_from_count(IconTextOverlay *text_overlay, const int icon_indicator_number)
int UI_icon_from_rnaptr(const bContext *C, PointerRNA *ptr, int rnaicon, const bool big)
static void vicon_keytype_extreme_draw(float x, float y, float w, float h, float alpha, const uchar *)
static void vicon_rgb_green_draw(float x, float y, float w, float h, float alpha, const uchar mono_rgba[4])
static void vicon_strip_color_draw_library_data_indirect(float x, float y, float w, float, float alpha, const uchar *)
static DrawInfo * icon_ensure_drawinfo(Icon *icon)
static DrawInfo * def_internal_icon(ImBuf *bbuf, int icon_id, int xofs, int yofs, int size, int type, int theme_color)
ImBuf * UI_svg_icon_bitmap(uint icon_id, float size, bool multicolor)
void ui_icon_ensure_deferred(const bContext *C, const int icon_id, const bool big)
static const IconType icontypes[]
#define ICON_INDIRECT_DATA_ALPHA
int UI_icon_from_idcode(const int idcode)
void UI_icon_draw_alpha(float x, float y, int icon_id, float alpha)
static void init_internal_icons()
static void vicon_rgb_color_draw(float x, float y, float w, float h, const float color[4], float bg_alpha)
static void vicon_gplayer_color_draw(Icon *icon, int x, int y, int w, int h)
static void svg_replace_color_attributes(std::string &svg, const std::string &name, const size_t start, const size_t end)
static void vicon_keytype_generated_draw(float x, float y, float w, float h, float alpha, const uchar *)
void UI_icon_draw(float x, float y, int icon_id)
static void icon_draw_rect(float x, float y, int w, int h, int rw, int rh, const uint8_t *rect, float alpha, const float desaturate)
#define ICON_TYPE_SVG_MONO
static void vicon_colorset_draw(int index, int x, int y, int w, int h, float)
static void vicon_handletype_free_draw(float x, float y, float w, float h, float alpha, const uchar *)
void UI_icon_draw_ex(float x, float y, int icon_id, float aspect, float alpha, float desaturate, const uchar mono_color[4], const bool mono_border, const IconTextOverlay *text_overlay, const bool inverted)
static void icon_node_socket_draw(int socket_type, float x, float y, float w, float h, float)
static void icon_verify_datatoc(IconImage *iimg)
static void ui_studiolight_icon_job_end(void *customdata)
static void vicon_keytype_moving_hold_draw(float x, float y, float w, float h, float alpha, const uchar *)
void UI_icon_render_id(const bContext *C, Scene *scene, ID *id, const enum eIconSizes size, const bool use_job)
static void vicon_rgb_blue_draw(float x, float y, float w, float h, float alpha, const uchar mono_rgba[4])
static void vicon_keytype_keyframe_draw(float x, float y, float w, float h, float alpha, const uchar *)
int ui_id_icon_get(const bContext *C, ID *id, const bool big)
#define DEF_ICON_LAYERGROUP_COLOR_DRAW(index, color)
static int ui_id_screen_get_icon(const bContext *C, ID *id)
#define DEF_ICON_NODE_SOCKET_DRAW(name, socket_type)
#define ICON_TYPE_GEOM
#define ICON_TYPE_EVENT
static void icon_create_rect(PreviewImage *prv_img, enum eIconSizes size)
static void vicon_keytype_jitter_draw(float x, float y, float w, float h, float alpha, const uchar *)
bool UI_icon_get_theme_color(int icon_id, uchar color[4])
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)
static void icon_draw_size(float x, float y, int icon_id, float aspect, float alpha, enum eIconSizes size, int draw_size, const float desaturate, const uchar mono_rgba[4], const bool mono_border, const IconTextOverlay *text_overlay, const bool inverted=false)
static void vicon_keytype_breakdown_draw(float x, float y, float w, float h, float alpha, const uchar *)
static void def_internal_vicon(int icon_id, VectorDrawFunc drawFunc)
#define ICON_TYPE_BUFFER
#define ICON_TYPE_SVG_COLOR
int UI_icon_from_library(const ID *id)
static void ui_studiolight_free_function(StudioLight *sl, void *data)
static void icon_source_edit_cb(std::string &svg)
void UI_icons_init()
static void vicon_handletype_vector_draw(float x, float y, float w, float h, float alpha, const uchar *)
int UI_icon_from_event_type(short event_type, short event_value)
int UI_icon_color_from_collection(const Collection *collection)
static void vicon_handletype_auto_draw(float x, float y, float w, float h, float alpha, const uchar *)
static DrawInfo * icon_create_drawinfo(Icon *icon)
void UI_icon_draw_preview(float x, float y, int icon_id, float aspect, float alpha, int size)
#define ICON_TYPE_GPLAYER
#define DEF_ICON_STRIP_COLOR_DRAW(index, color)
static void vicon_keytype_draw_wrapper(const float x, const float y, const float w, const float h, const float alpha, const eBezTriple_KeyframeType key_type, const short handle_type)
#define ICON_TYPE_PREVIEW
#define ICON_TYPE_IMBUF
#define ICON_TYPE_VECTOR
static int get_draw_size(enum eIconSizes size)
int UI_icon_preview_to_render_size(enum eIconSizes size)
ImBuf * UI_icon_alert_imbuf_get(eAlertIcon icon, float size)
static DrawInfo * g_di_event_list
static void vicon_strip_color_draw_library_data_override_noneditable(float x, float y, float w, float, float alpha, const uchar *)
static void ui_studiolight_kill_icon_preview_job(wmWindowManager *wm, int icon_id)
#define INIT_EVENT_ICON(icon_id, type, value)
static void vicon_rgb_text_draw(float x, float y, float w, float h, const char *str, const uchar mono_rgba[4])
static void vicon_layergroup_color_draw(short color_tag, float x, float y, float w, float, float)
static void ui_studiolight_icon_job_exec(void *customdata, wmJobWorkerStatus *)
static void ui_id_icon_render(const bContext *C, ID *id, bool use_jobs)
void UI_icons_free()
static void icon_set_image(const bContext *C, Scene *scene, ID *id, PreviewImage *prv_img, enum eIconSizes size, const bool use_job)
void(*)(float x, float y, float w, float h, float alpha, const uchar mono_rgba[4]) VectorDrawFunc
void icon_draw_rect_input(const float x, const float y, const int w, const int h, const int icon_id, const float aspect, const float alpha, const bool inverted)
uiWidgetBaseParameters params[MAX_WIDGET_BASE_BATCH]
CCL_NAMESPACE_BEGIN ccl_device float invert(const float color, const float factor)
Definition invert.h:11
void draw_keyframe_shape(const float x, const float y, float size, const bool sel, const eBezTriple_KeyframeType key_type, const eKeyframeShapeDrawOpts mode, const float alpha, const KeyframeShaderBindings *sh_bindings, const short handle_type, const short extreme_type)
format
#define LOG(level)
Definition log.h:97
void * MEM_calloc_arrayN(size_t len, size_t size, const char *str)
Definition mallocn.cc:123
void * MEM_callocN(size_t len, const char *str)
Definition mallocn.cc:118
void * MEM_malloc_arrayN(size_t len, size_t size, const char *str)
Definition mallocn.cc:133
void MEM_freeN(void *vmemh)
Definition mallocn.cc:113
static ulong state[N]
#define G(x, y, z)
void std_node_socket_colors_get(int socket_type, float *r_color)
Definition drawnode.cc:974
void node_draw_nodesocket(const rctf *rect, const float color_inner[4], const float color_outline[4], float outline_thickness, int shape, float aspect)
Definition drawnode.cc:1805
VecBase< float, 2 > float2
const char * name
bool RNA_struct_is_a(const StructRNA *type, const StructRNA *srna)
PointerRNA RNA_pointer_get(PointerRNA *ptr, const char *name)
bool RNA_struct_is_ID(const StructRNA *type)
int RNA_int_get(PointerRNA *ptr, const char *name)
IconImage * image
VectorDrawFunc func
ImBuf * image_cache
struct DrawInfo::@174343100143157136005247000270365301316323002374::@310267162073377360366245154224166162202333214210 input
struct DrawInfo::@174343100143157136005247000270365301316323002374::@070253270022005015164200324257300377317141001225 geom
struct DrawInfo::@174343100143157136005247000270365301316323002374::@244254267001110344015224177260156342176164254057 vector
DrawInfo * next
struct DrawInfo::@174343100143157136005247000270365301316323002374::@326304104246373005324033123270167073171034006264 texture
struct DrawInfo::@174343100143157136005247000270365301316323002374::@231007212013237070324244017363001002354036144376 buffer
union DrawInfo::@174343100143157136005247000270365301316323002374 data
unsigned int flag
Definition DNA_ID.h:348
Definition DNA_ID.h:414
int tag
Definition DNA_ID.h:442
char name[258]
Definition DNA_ID.h:432
IDOverrideLibrary * override_library
Definition DNA_ID.h:494
uint8_t * rect
const uchar * datatoc_rect
void * obj
Definition BKE_icons.h:48
char obj_type
Definition BKE_icons.h:49
void * drawinfo
Definition BKE_icons.h:42
short id_type
Definition BKE_icons.h:53
DrawInfoFreeFP drawinfo_free
Definition BKE_icons.h:54
ImBufByteBuffer byte_buffer
void * data
Definition RNA_types.hh:53
PreviewImageRuntimeHandle * runtime
Definition DNA_ID.h:648
unsigned int h[2]
Definition DNA_ID.h:643
short changed_timestamp[2]
Definition DNA_ID.h:645
short flag[2]
Definition DNA_ID.h:644
unsigned int * rect[2]
Definition DNA_ID.h:646
unsigned int w[2]
Definition DNA_ID.h:642
int icon_id_matcap_flipped
unsigned char color[4]
unsigned char vertex_select[4]
unsigned char color[4]
float icon_border_intensity
float icon_alpha
uiWidgetColors wcol_regular
uiWidgetColors wcol_toolbar_item
unsigned char select[4]
unsigned char solid[4]
unsigned char active[4]
ThemeStripColor strip_color[9]
ThemeSpace space_view3d
ThemeUI tui
ThemeWireColor tarm[20]
ThemeCollectionColor collection_color[8]
unsigned char inner[4]
i
Definition text_draw.cc:230
ccl_device_inline bool is_light(const ccl_global KernelLightTreeEmitter *kemitter)
Definition tree.h:69
uint len
@ EVT_PAD8
@ EVT_F14KEY
@ EVT_PAD2
@ MOUSEPAN
@ BUTTON7MOUSE
@ RIGHTMOUSE
@ EVT_SIXKEY
@ EVT_QUOTEKEY
@ EVT_PADPERIOD
@ NDOF_BUTTON_SPIN_CW
@ EVT_OKEY
@ NDOF_BUTTON_TILT_CCW
@ EVT_EKEY
@ EVT_PAD4
@ EVT_JKEY
@ EVT_PADASTERKEY
@ NDOF_BUTTON_7
@ BUTTON6MOUSE
@ NDOF_BUTTON_V2
@ EVT_F18KEY
@ EVT_PLUSKEY
@ EVT_PAD0
@ EVT_F7KEY
@ EVT_FOURKEY
@ NDOF_BUTTON_2
@ EVT_YKEY
@ EVT_RIGHTCTRLKEY
@ EVT_F17KEY
@ EVT_SKEY
@ EVT_VKEY
@ MOUSEZOOM
@ NDOF_BUTTON_8
@ EVT_IKEY
@ NDOF_BUTTON_MENU
@ EVT_F1KEY
@ EVT_PERIODKEY
@ EVT_PADSLASHKEY
@ EVT_XKEY
@ NDOF_BUTTON_1
@ EVT_COMMAKEY
@ NDOF_BUTTON_BOTTOM
@ EVT_MEDIAPLAY
@ EVT_LEFTBRACKETKEY
@ EVT_MEDIAFIRST
@ EVT_F23KEY
@ EVT_ZEROKEY
@ EVT_F10KEY
@ EVT_FKEY
@ EVT_PAD9
@ EVT_DELKEY
@ EVT_SEVENKEY
@ NDOF_BUTTON_V1
@ EVT_F20KEY
@ EVT_CKEY
@ EVT_F2KEY
@ EVT_GKEY
@ EVT_KKEY
@ EVT_TABKEY
@ EVT_DOWNARROWKEY
@ NDOF_BUTTON_BACK
@ EVT_UKEY
@ EVT_MEDIASTOP
@ EVT_AKEY
@ EVT_PAD3
@ EVT_MINUSKEY
@ MOUSEROTATE
@ EVT_PAGEUPKEY
@ EVT_OSKEY
@ EVT_F4KEY
@ EVT_PAGEDOWNKEY
@ NDOF_BUTTON_5
@ EVT_F8KEY
@ NDOF_BUTTON_SAVE_V2
@ NDOF_BUTTON_RIGHT
@ EVT_LEFTCTRLKEY
@ NDOF_BUTTON_ROLL_CW
@ NDOF_BUTTON_10
@ TABLET_ERASER
@ EVT_EQUALKEY
@ NDOF_BUTTON_3
@ EVT_RIGHTARROWKEY
@ EVT_F6KEY
@ EVT_F5KEY
@ EVT_PADENTER
@ EVT_F22KEY
@ EVT_F19KEY
@ EVT_NINEKEY
@ NDOF_BUTTON_PLUS
@ EVT_SPACEKEY
@ EVT_CAPSLOCKKEY
@ BUTTON4MOUSE
@ EVT_PAD6
@ NDOF_BUTTON_ISO2
@ EVT_PAD5
@ EVT_HOMEKEY
@ TABLET_STYLUS
@ EVT_RIGHTBRACKETKEY
@ EVT_WKEY
@ NDOF_BUTTON_PANZOOM
@ EVT_UNKNOWNKEY
@ EVT_ENDKEY
@ EVT_RIGHTALTKEY
@ EVT_MEDIALAST
@ EVT_MKEY
@ EVT_TKEY
@ EVT_HKEY
@ NDOF_BUTTON_MINUS
@ EVT_BACKSLASHKEY
@ EVT_FIVEKEY
@ EVT_APPKEY
@ EVT_F24KEY
@ EVT_ACCENTGRAVEKEY
@ EVT_PADMINUS
@ EVT_F21KEY
@ EVT_ONEKEY
@ EVT_UPARROWKEY
@ LEFTMOUSE
@ EVT_F11KEY
@ EVT_SLASHKEY
@ EVT_EIGHTKEY
@ EVT_F13KEY
@ NDOF_BUTTON_DOMINANT
@ EVT_F15KEY
@ EVT_LEFTARROWKEY
@ EVT_INSERTKEY
@ EVT_NKEY
@ EVT_QKEY
@ MIDDLEMOUSE
@ NDOF_BUTTON_TILT_CW
@ EVT_LEFTALTKEY
@ EVT_ZKEY
@ EVT_ESCKEY
@ NDOF_BUTTON_9
@ NDOF_BUTTON_LEFT
@ NDOF_BUTTON_FIT
@ EVT_THREEKEY
@ NDOF_BUTTON_V3
@ EVT_BACKSPACEKEY
@ EVT_F12KEY
@ EVT_DKEY
@ NDOF_BUTTON_SAVE_V3
@ EVT_F16KEY
@ NDOF_BUTTON_4
@ EVT_PAD1
@ EVT_TWOKEY
@ EVT_GRLESSKEY
@ EVT_LKEY
@ NDOF_BUTTON_12
@ EVT_RIGHTSHIFTKEY
@ NDOF_BUTTON_FRONT
@ NDOF_BUTTON_SAVE_V1
@ NDOF_BUTTON_11
@ EVT_PAUSEKEY
@ EVT_PAD7
@ NDOF_BUTTON_SPIN_CCW
@ EVT_LEFTSHIFTKEY
@ NDOF_BUTTON_ISO1
@ EVT_PADPLUSKEY
@ NDOF_BUTTON_6
@ EVT_F3KEY
@ NDOF_BUTTON_TOP
@ EVT_F9KEY
@ EVT_RKEY
@ EVT_SEMICOLONKEY
@ EVT_BKEY
@ EVT_PKEY
@ NDOF_BUTTON_ROTATE
@ EVT_HYPER
@ EVT_RETKEY
@ BUTTON5MOUSE
@ NDOF_BUTTON_ROLL_CCW
PointerRNA * ptr
Definition wm_files.cc:4238
void WM_jobs_timer(wmJob *wm_job, double time_step, uint note, uint endnote)
Definition wm_jobs.cc:376
void WM_jobs_start(wmWindowManager *wm, wmJob *wm_job)
Definition wm_jobs.cc:479
void WM_jobs_kill_type(wmWindowManager *wm, const void *owner, int job_type)
Definition wm_jobs.cc:623
wmJob * WM_jobs_get(wmWindowManager *wm, wmWindow *win, const void *owner, const char *name, const eWM_JobFlag flag, const eWM_JobType job_type)
Definition wm_jobs.cc:211
void WM_jobs_callbacks(wmJob *wm_job, wm_jobs_start_callback startjob, void(*initjob)(void *), void(*update)(void *), void(*endjob)(void *))
Definition wm_jobs.cc:388
void WM_jobs_customdata_set(wmJob *wm_job, void *customdata, void(*free)(void *customdata))
Definition wm_jobs.cc:360