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