Blender  V2.93
wm_dragdrop.c
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU General Public License
4  * as published by the Free Software Foundation; either version 2
5  * of the License, or (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software Foundation,
14  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15  *
16  * The Original Code is Copyright (C) 2010 Blender Foundation.
17  * All rights reserved.
18  */
19 
26 #include <string.h>
27 
28 #include "DNA_screen_types.h"
30 
31 #include "MEM_guardedalloc.h"
32 
33 #include "BLT_translation.h"
34 
35 #include "BLI_blenlib.h"
36 
37 #include "BIF_glutil.h"
38 
39 #include "BKE_context.h"
40 #include "BKE_global.h"
41 #include "BKE_idtype.h"
42 #include "BKE_lib_id.h"
43 
44 #include "GPU_shader.h"
45 #include "GPU_state.h"
46 #include "GPU_viewport.h"
47 
48 #include "IMB_imbuf_types.h"
49 
50 #include "UI_interface.h"
51 #include "UI_interface_icons.h"
52 
53 #include "RNA_access.h"
54 
55 #include "WM_api.h"
56 #include "WM_types.h"
57 #include "wm_event_system.h"
58 
59 /* ****************************************************** */
60 
62 
63 /* drop box maps are stored global for now */
64 /* these are part of blender's UI/space specs, and not like keymaps */
65 /* when editors become configurable, they can add own dropbox definitions */
66 
67 typedef struct wmDropBoxMap {
68  struct wmDropBoxMap *next, *prev;
69 
71  short spaceid, regionid;
73 
75 
76 /* spaceid/regionid is zero for window drop maps */
78 {
80  if (dm->spaceid == spaceid && dm->regionid == regionid) {
81  if (STREQLEN(idname, dm->idname, KMAP_MAX_NAME)) {
82  return &dm->dropboxes;
83  }
84  }
85  }
86 
87  wmDropBoxMap *dm = MEM_callocN(sizeof(struct wmDropBoxMap), "dropmap list");
89  dm->spaceid = spaceid;
90  dm->regionid = regionid;
91  BLI_addtail(&dropboxes, dm);
92 
93  return &dm->dropboxes;
94 }
95 
97  const char *idname,
98  bool (*poll)(bContext *, wmDrag *, const wmEvent *, const char **),
99  void (*copy)(wmDrag *, wmDropBox *),
100  void (*cancel)(struct Main *, wmDrag *, wmDropBox *))
101 {
102  wmDropBox *drop = MEM_callocN(sizeof(wmDropBox), "wmDropBox");
103  drop->poll = poll;
104  drop->copy = copy;
105  drop->cancel = cancel;
106  drop->ot = WM_operatortype_find(idname, 0);
108 
109  if (drop->ot == NULL) {
110  MEM_freeN(drop);
111  printf("Error: dropbox with unknown operator: %s\n", idname);
112  return NULL;
113  }
114  WM_operator_properties_alloc(&(drop->ptr), &(drop->properties), idname);
115 
116  BLI_addtail(lb, drop);
117 
118  return drop;
119 }
120 
121 void wm_dropbox_free(void)
122 {
123 
125  LISTBASE_FOREACH (wmDropBox *, drop, &dm->dropboxes) {
126  if (drop->ptr) {
127  WM_operator_properties_free(drop->ptr);
128  MEM_freeN(drop->ptr);
129  }
130  }
131  BLI_freelistN(&dm->dropboxes);
132  }
133 
135 }
136 
137 /* *********************************** */
138 
139 /* note that the pointer should be valid allocated and not on stack */
141  struct bContext *C, int icon, int type, void *poin, double value, unsigned int flags)
142 {
144  wmDrag *drag = MEM_callocN(sizeof(struct wmDrag), "new drag");
145 
146  /* keep track of future multitouch drag too, add a mousepointer id or so */
147  /* if multiple drags are added, they're drawn as list */
148 
149  BLI_addtail(&wm->drags, drag);
150  drag->flags = flags;
151  drag->icon = icon;
152  drag->type = type;
153  switch (type) {
154  case WM_DRAG_PATH:
155  BLI_strncpy(drag->path, poin, FILE_MAX);
156  /* As the path is being copied, free it immediately as `drag` wont "own" the data. */
157  if (flags & WM_DRAG_FREE_DATA) {
158  MEM_freeN(poin);
159  }
160  break;
161  case WM_DRAG_ID:
162  if (poin) {
163  WM_drag_add_local_ID(drag, poin, NULL);
164  }
165  break;
166  case WM_DRAG_ASSET:
167  /* Move ownership of poin to wmDrag. */
168  drag->poin = poin;
169  drag->flags |= WM_DRAG_FREE_DATA;
170  break;
171  default:
172  drag->poin = poin;
173  break;
174  }
175  drag->value = value;
176 
177  return drag;
178 }
179 
180 void WM_event_drag_image(wmDrag *drag, ImBuf *imb, float scale, int sx, int sy)
181 {
182  drag->imb = imb;
183  drag->scale = scale;
184  drag->sx = sx;
185  drag->sy = sy;
186 }
187 
188 void WM_drag_data_free(int dragtype, void *poin)
189 {
190  /* Don't require all the callers to have a NULL-check, just allow passing NULL. */
191  if (!poin) {
192  return;
193  }
194 
195  /* Not too nice, could become a callback. */
196  if (dragtype == WM_DRAG_ASSET) {
197  wmDragAsset *asset_drag = poin;
198  MEM_freeN((void *)asset_drag->path);
199  }
200  MEM_freeN(poin);
201 }
202 
203 void WM_drag_free(wmDrag *drag)
204 {
205  if (drag->flags & WM_DRAG_FREE_DATA) {
206  WM_drag_data_free(drag->type, drag->poin);
207  }
208  BLI_freelistN(&drag->ids);
209  MEM_freeN(drag);
210 }
211 
212 void WM_drag_free_list(struct ListBase *lb)
213 {
214  wmDrag *drag;
215  while ((drag = BLI_pophead(lb))) {
216  WM_drag_free(drag);
217  }
218 }
219 
220 static const char *dropbox_active(bContext *C,
221  ListBase *handlers,
222  wmDrag *drag,
223  const wmEvent *event)
224 {
225  LISTBASE_FOREACH (wmEventHandler *, handler_base, handlers) {
226  if (handler_base->type == WM_HANDLER_TYPE_DROPBOX) {
227  wmEventHandler_Dropbox *handler = (wmEventHandler_Dropbox *)handler_base;
228  if (handler->dropboxes) {
229  LISTBASE_FOREACH (wmDropBox *, drop, handler->dropboxes) {
230  const char *tooltip = NULL;
231  if (drop->poll(C, drag, event, &tooltip) &&
232  WM_operator_poll_context(C, drop->ot, drop->opcontext)) {
233  /* XXX Doing translation here might not be ideal, but later we have no more
234  * access to ot (and hence op context)... */
235  return (tooltip) ? tooltip : WM_operatortype_name(drop->ot, drop->ptr);
236  }
237  }
238  }
239  }
240  }
241  return NULL;
242 }
243 
244 /* return active operator name when mouse is in box */
245 static const char *wm_dropbox_active(bContext *C, wmDrag *drag, const wmEvent *event)
246 {
247  wmWindow *win = CTX_wm_window(C);
249  ARegion *region = CTX_wm_region(C);
250  const char *name;
251 
252  name = dropbox_active(C, &win->handlers, drag, event);
253  if (name) {
254  return name;
255  }
256 
257  name = dropbox_active(C, &area->handlers, drag, event);
258  if (name) {
259  return name;
260  }
261 
262  name = dropbox_active(C, &region->handlers, drag, event);
263  if (name) {
264  return name;
265  }
266 
267  return NULL;
268 }
269 
270 static void wm_drop_operator_options(bContext *C, wmDrag *drag, const wmEvent *event)
271 {
272  wmWindow *win = CTX_wm_window(C);
273  const int winsize_x = WM_window_pixels_x(win);
274  const int winsize_y = WM_window_pixels_y(win);
275 
276  /* for multiwin drags, we only do this if mouse inside */
277  if (event->x < 0 || event->y < 0 || event->x > winsize_x || event->y > winsize_y) {
278  return;
279  }
280 
281  drag->opname[0] = 0;
282 
283  /* check buttons (XXX todo rna and value) */
284  if (UI_but_active_drop_name(C)) {
285  BLI_strncpy(drag->opname, IFACE_("Paste name"), sizeof(drag->opname));
286  }
287  else {
288  const char *opname = wm_dropbox_active(C, drag, event);
289 
290  if (opname) {
291  BLI_strncpy(drag->opname, opname, sizeof(drag->opname));
292  // WM_cursor_modal_set(win, WM_CURSOR_COPY);
293  }
294  // else
295  // WM_cursor_modal_restore(win);
296  /* unsure about cursor type, feels to be too much */
297  }
298 }
299 
300 /* called in inner handler loop, region context */
301 void wm_drags_check_ops(bContext *C, const wmEvent *event)
302 {
304 
305  LISTBASE_FOREACH (wmDrag *, drag, &wm->drags) {
306  wm_drop_operator_options(C, drag, event);
307  }
308 }
309 
310 /* ************** IDs ***************** */
311 
312 void WM_drag_add_local_ID(wmDrag *drag, ID *id, ID *from_parent)
313 {
314  /* Don't drag the same ID twice. */
315  LISTBASE_FOREACH (wmDragID *, drag_id, &drag->ids) {
316  if (drag_id->id == id) {
317  if (drag_id->from_parent == NULL) {
318  drag_id->from_parent = from_parent;
319  }
320  return;
321  }
322  if (GS(drag_id->id->name) != GS(id->name)) {
323  BLI_assert(!"All dragged IDs must have the same type");
324  return;
325  }
326  }
327 
328  /* Add to list. */
329  wmDragID *drag_id = MEM_callocN(sizeof(wmDragID), __func__);
330  drag_id->id = id;
331  drag_id->from_parent = from_parent;
332  BLI_addtail(&drag->ids, drag_id);
333 }
334 
335 ID *WM_drag_get_local_ID(const wmDrag *drag, short idcode)
336 {
337  if (drag->type != WM_DRAG_ID) {
338  return NULL;
339  }
340 
341  wmDragID *drag_id = drag->ids.first;
342  if (!drag_id) {
343  return NULL;
344  }
345 
346  ID *id = drag_id->id;
347  return (idcode == 0 || GS(id->name) == idcode) ? id : NULL;
348 }
349 
350 ID *WM_drag_get_local_ID_from_event(const wmEvent *event, short idcode)
351 {
352  if (event->custom != EVT_DATA_DRAGDROP) {
353  return NULL;
354  }
355 
356  ListBase *lb = event->customdata;
357  return WM_drag_get_local_ID(lb->first, idcode);
358 }
359 
363 bool WM_drag_is_ID_type(const wmDrag *drag, int idcode)
364 {
365  return WM_drag_get_local_ID(drag, idcode) || WM_drag_get_asset_data(drag, idcode);
366 }
367 
368 wmDragAsset *WM_drag_get_asset_data(const wmDrag *drag, int idcode)
369 {
370  if (drag->type != WM_DRAG_ASSET) {
371  return NULL;
372  }
373 
374  wmDragAsset *asset_drag = drag->poin;
375  return (ELEM(idcode, 0, asset_drag->id_type)) ? asset_drag : NULL;
376 }
377 
379 {
380  /* Append only for now, wmDragAsset could have a `link` bool. */
382  G_MAIN, NULL, NULL, NULL, asset_drag->path, asset_drag->id_type, asset_drag->name);
383 }
384 
393 {
394  if (!ELEM(drag->type, WM_DRAG_ASSET, WM_DRAG_ID)) {
395  return NULL;
396  }
397 
398  if (drag->type == WM_DRAG_ID) {
399  return WM_drag_get_local_ID(drag, idcode);
400  }
401 
402  wmDragAsset *asset_drag = WM_drag_get_asset_data(drag, idcode);
403  if (!asset_drag) {
404  return NULL;
405  }
406 
407  /* Link/append the asset. */
408  return wm_drag_asset_id_import(asset_drag);
409 }
410 
419 void WM_drag_free_imported_drag_ID(struct Main *bmain, wmDrag *drag, wmDropBox *drop)
420 {
421  if (drag->type != WM_DRAG_ASSET) {
422  return;
423  }
424 
425  wmDragAsset *asset_drag = WM_drag_get_asset_data(drag, 0);
426  if (!asset_drag) {
427  return;
428  }
429 
430  /* Get name from property, not asset data - it may have changed after importing to ensure
431  * uniqueness (name is assumed to be set from the imported ID name). */
432  char name[MAX_ID_NAME - 2];
433  RNA_string_get(drop->ptr, "name", name);
434  if (!name[0]) {
435  return;
436  }
437 
438  ID *id = BKE_libblock_find_name(bmain, asset_drag->id_type, name);
439  if (id) {
440  BKE_id_delete(bmain, id);
441  }
442 }
443 
444 /* ************** draw ***************** */
445 
446 static void wm_drop_operator_draw(const char *name, int x, int y)
447 {
448  const uiFontStyle *fstyle = UI_FSTYLE_WIDGET;
449  const float col_fg[4] = {1.0f, 1.0f, 1.0f, 1.0f};
450  const float col_bg[4] = {0.0f, 0.0f, 0.0f, 0.2f};
451 
452  UI_fontstyle_draw_simple_backdrop(fstyle, x, y, name, col_fg, col_bg);
453 }
454 
455 static const char *wm_drag_name(wmDrag *drag)
456 {
457  switch (drag->type) {
458  case WM_DRAG_ID: {
459  ID *id = WM_drag_get_local_ID(drag, 0);
460  bool single = (BLI_listbase_count_at_most(&drag->ids, 2) == 1);
461 
462  if (single) {
463  return id->name + 2;
464  }
465  if (id) {
467  }
468  break;
469  }
470  case WM_DRAG_ASSET: {
471  const wmDragAsset *asset_drag = WM_drag_get_asset_data(drag, 0);
472  return asset_drag->name;
473  }
474  case WM_DRAG_PATH:
475  case WM_DRAG_NAME:
476  return drag->path;
477  }
478  return "";
479 }
480 
481 static void drag_rect_minmax(rcti *rect, int x1, int y1, int x2, int y2)
482 {
483  if (rect->xmin > x1) {
484  rect->xmin = x1;
485  }
486  if (rect->xmax < x2) {
487  rect->xmax = x2;
488  }
489  if (rect->ymin > y1) {
490  rect->ymin = y1;
491  }
492  if (rect->ymax < y2) {
493  rect->ymax = y2;
494  }
495 }
496 
497 /* called in wm_draw.c */
498 /* if rect set, do not draw */
499 void wm_drags_draw(bContext *C, wmWindow *win, rcti *rect)
500 {
501  const uiFontStyle *fstyle = UI_FSTYLE_WIDGET;
503  const int winsize_y = WM_window_pixels_y(win);
504 
505  int cursorx = win->eventstate->x;
506  int cursory = win->eventstate->y;
507  if (rect) {
508  rect->xmin = rect->xmax = cursorx;
509  rect->ymin = rect->ymax = cursory;
510  }
511 
512  /* Should we support multi-line drag draws? Maybe not, more types mixed wont work well. */
514  LISTBASE_FOREACH (wmDrag *, drag, &wm->drags) {
515  const uchar text_col[] = {255, 255, 255, 255};
516  int iconsize = UI_DPI_ICON_SIZE;
517  int padding = 4 * UI_DPI_FAC;
518 
519  /* image or icon */
520  int x, y;
521  if (drag->imb) {
522  x = cursorx - drag->sx / 2;
523  y = cursory - drag->sy / 2;
524 
525  if (rect) {
526  drag_rect_minmax(rect, x, y, x + drag->sx, y + drag->sy);
527  }
528  else {
529  float col[4] = {1.0f, 1.0f, 1.0f, 0.65f}; /* this blends texture */
532  x,
533  y,
534  drag->imb->x,
535  drag->imb->y,
536  GPU_RGBA8,
537  false,
538  drag->imb->rect,
539  drag->scale,
540  drag->scale,
541  1.0f,
542  1.0f,
543  col);
544  }
545  }
546  else {
547  x = cursorx - 2 * padding;
548  y = cursory - 2 * UI_DPI_FAC;
549 
550  if (rect) {
551  drag_rect_minmax(rect, x, y, x + iconsize, y + iconsize);
552  }
553  else {
554  UI_icon_draw_ex(x, y, drag->icon, U.inv_dpi_fac, 0.8, 0.0f, text_col, false);
555  }
556  }
557 
558  /* item name */
559  if (drag->imb) {
560  x = cursorx - drag->sx / 2;
561  y = cursory - drag->sy / 2 - iconsize;
562  }
563  else {
564  x = cursorx + 10 * UI_DPI_FAC;
565  y = cursory + 1 * UI_DPI_FAC;
566  }
567 
568  if (rect) {
569  int w = UI_fontstyle_string_width(fstyle, wm_drag_name(drag));
570  drag_rect_minmax(rect, x, y, x + w, y + iconsize);
571  }
572  else {
573  UI_fontstyle_draw_simple(fstyle, x, y, wm_drag_name(drag), text_col);
574  }
575 
576  /* operator name with roundbox */
577  if (drag->opname[0]) {
578  if (drag->imb) {
579  x = cursorx - drag->sx / 2;
580 
581  if (cursory + drag->sy / 2 + padding + iconsize < winsize_y) {
582  y = cursory + drag->sy / 2 + padding;
583  }
584  else {
585  y = cursory - drag->sy / 2 - padding - iconsize - padding - iconsize;
586  }
587  }
588  else {
589  x = cursorx - 2 * padding;
590 
591  if (cursory + iconsize + iconsize < winsize_y) {
592  y = (cursory + iconsize) + padding;
593  }
594  else {
595  y = (cursory - iconsize) - padding;
596  }
597  }
598 
599  if (rect) {
600  int w = UI_fontstyle_string_width(fstyle, wm_drag_name(drag));
601  drag_rect_minmax(rect, x, y, x + w, y + iconsize);
602  }
603  else {
604  wm_drop_operator_draw(drag->opname, x, y);
605  }
606  }
607  }
609 }
void immDrawPixelsTexScaled(IMMDrawPixelsTexState *state, float x, float y, int img_w, int img_h, eGPUTextureFormat gpu_format, bool use_filter, void *rect, float scaleX, float scaleY, float xzoom, float yzoom, const float color[4])
Definition: glutil.c:265
IMMDrawPixelsTexState immDrawPixelsTexSetup(int builtin)
Definition: glutil.c:66
struct ScrArea * CTX_wm_area(const bContext *C)
Definition: context.c:714
struct wmWindowManager * CTX_wm_manager(const bContext *C)
Definition: context.c:689
struct ARegion * CTX_wm_region(const bContext *C)
Definition: context.c:725
struct wmWindow * CTX_wm_window(const bContext *C)
Definition: context.c:699
#define G_MAIN
Definition: BKE_global.h:232
const char * BKE_idtype_idcode_to_name_plural(const short idcode)
Definition: idtype.c:182
struct ID * BKE_libblock_find_name(struct Main *bmain, const short type, const char *name) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
Definition: lib_id.c:1333
void BKE_id_delete(struct Main *bmain, void *idv) ATTR_NONNULL()
#define BLI_assert(a)
Definition: BLI_assert.h:58
void * BLI_pophead(ListBase *listbase) ATTR_NONNULL(1)
Definition: listbase.c:257
#define LISTBASE_FOREACH(type, var, list)
Definition: BLI_listbase.h:172
int BLI_listbase_count_at_most(const struct ListBase *listbase, const int count_max) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
void void BLI_freelistN(struct ListBase *listbase) ATTR_NONNULL(1)
Definition: listbase.c:547
void BLI_addtail(struct ListBase *listbase, void *vlink) ATTR_NONNULL(1)
Definition: listbase.c:110
#define FILE_MAX
char * BLI_strncpy(char *__restrict dst, const char *__restrict src, const size_t maxncpy) ATTR_NONNULL()
Definition: string.c:108
unsigned char uchar
Definition: BLI_sys_types.h:86
#define STREQLEN(a, b, n)
#define ELEM(...)
#define IFACE_(msgid)
#define MAX_ID_NAME
Definition: DNA_ID.h:269
#define KMAP_MAX_NAME
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei GLsizei GLenum type _GL_VOID_RET _GL_VOID GLsizei GLenum GLenum const void *pixels _GL_VOID_RET _GL_VOID const void *pointer _GL_VOID_RET _GL_VOID GLdouble v _GL_VOID_RET _GL_VOID GLfloat v _GL_VOID_RET _GL_VOID GLint GLint i2 _GL_VOID_RET _GL_VOID GLint j _GL_VOID_RET _GL_VOID GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble GLdouble GLdouble zFar _GL_VOID_RET _GL_UINT GLdouble *equation _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLenum GLfloat *v _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLfloat *values _GL_VOID_RET _GL_VOID GLushort *values _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLenum GLdouble *params _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_BOOL GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLushort pattern _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble u2 _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLdouble GLdouble v2 _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLdouble GLdouble nz _GL_VOID_RET _GL_VOID GLfloat GLfloat nz _GL_VOID_RET _GL_VOID GLint GLint nz _GL_VOID_RET _GL_VOID GLshort GLshort nz _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const GLfloat *values _GL_VOID_RET _GL_VOID GLsizei const GLushort *values _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID const GLuint const GLclampf *priorities _GL_VOID_RET _GL_VOID GLdouble y _GL_VOID_RET _GL_VOID GLfloat y _GL_VOID_RET _GL_VOID GLint y _GL_VOID_RET _GL_VOID GLshort y _GL_VOID_RET _GL_VOID GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLfloat GLfloat z _GL_VOID_RET _GL_VOID GLint GLint z _GL_VOID_RET _GL_VOID GLshort GLshort z _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble w _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat w _GL_VOID_RET _GL_VOID GLint GLint GLint w _GL_VOID_RET _GL_VOID GLshort GLshort GLshort w _GL_VOID_RET _GL_VOID GLdouble y1
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei GLsizei GLenum type _GL_VOID_RET _GL_VOID GLsizei GLenum GLenum const void *pixels _GL_VOID_RET _GL_VOID const void *pointer _GL_VOID_RET _GL_VOID GLdouble v _GL_VOID_RET _GL_VOID GLfloat v _GL_VOID_RET _GL_VOID GLint GLint i2 _GL_VOID_RET _GL_VOID GLint j _GL_VOID_RET _GL_VOID GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble GLdouble GLdouble zFar _GL_VOID_RET _GL_UINT GLdouble *equation _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLenum GLfloat *v _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLfloat *values _GL_VOID_RET _GL_VOID GLushort *values _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLenum GLdouble *params _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_BOOL GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLushort pattern _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble u2 _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLdouble GLdouble v2 _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLdouble GLdouble nz _GL_VOID_RET _GL_VOID GLfloat GLfloat nz _GL_VOID_RET _GL_VOID GLint GLint nz _GL_VOID_RET _GL_VOID GLshort GLshort nz _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const GLfloat *values _GL_VOID_RET _GL_VOID GLsizei const GLushort *values _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID const GLuint const GLclampf *priorities _GL_VOID_RET _GL_VOID GLdouble y _GL_VOID_RET _GL_VOID GLfloat y _GL_VOID_RET _GL_VOID GLint y _GL_VOID_RET _GL_VOID GLshort y _GL_VOID_RET _GL_VOID GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLfloat GLfloat z _GL_VOID_RET _GL_VOID GLint GLint z _GL_VOID_RET _GL_VOID GLshort GLshort z _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble w _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat w _GL_VOID_RET _GL_VOID GLint GLint GLint w _GL_VOID_RET _GL_VOID GLshort GLshort GLshort w _GL_VOID_RET _GL_VOID GLdouble GLdouble x2
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum type
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint y
@ GPU_SHADER_2D_IMAGE_COLOR
Definition: GPU_shader.h:187
@ GPU_BLEND_NONE
Definition: GPU_state.h:55
@ GPU_BLEND_ALPHA
Definition: GPU_state.h:57
void GPU_blend(eGPUBlend blend)
Definition: gpu_state.cc:55
@ GPU_RGBA8
Definition: GPU_texture.h:88
Contains defines and structs used throughout the imbuf module.
Read Guarded memory(de)allocation.
#define C
Definition: RandGen.cpp:39
bool UI_but_active_drop_name(struct bContext *C)
void UI_fontstyle_draw_simple(const struct uiFontStyle *fs, float x, float y, const char *str, const uchar col[4])
#define UI_DPI_ICON_SIZE
Definition: UI_interface.h:311
#define UI_DPI_FAC
Definition: UI_interface.h:309
int UI_fontstyle_string_width(const struct uiFontStyle *fs, const char *str)
void UI_fontstyle_draw_simple_backdrop(const struct uiFontStyle *fs, float x, float y, const char *str, const float col_fg[4], const float col_bg[4])
#define UI_FSTYLE_WIDGET
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)
#define WM_DRAG_PATH
Definition: WM_types.h:876
@ WM_OP_INVOKE_DEFAULT
Definition: WM_types.h:197
@ WM_DRAG_FREE_DATA
Definition: WM_types.h:884
#define WM_DRAG_NAME
Definition: WM_types.h:877
#define WM_DRAG_ASSET
Definition: WM_types.h:874
#define WM_DRAG_ID
Definition: WM_types.h:873
unsigned int U
Definition: btGjkEpa3.h:78
SIMD_FORCE_INLINE const btScalar & w() const
Return the w value.
Definition: btQuadWord.h:119
uint col
uint padding(uint offset, uint alignment)
#define GS(x)
Definition: iris.c:241
void(* MEM_freeN)(void *vmemh)
Definition: mallocn.c:41
void *(* MEM_callocN)(size_t len, const char *str)
Definition: mallocn.c:45
static ulong state[N]
static void area(int d1, int d2, int e1, int e2, float weights[2])
static void copy(bNodeTree *dest_ntree, bNode *dest_node, const bNode *src_node)
void RNA_string_get(PointerRNA *ptr, const char *name, char *value)
Definition: rna_access.c:6514
ListBase handlers
Definition: DNA_ID.h:273
char name[66]
Definition: DNA_ID.h:283
void * first
Definition: DNA_listBase.h:47
Definition: BKE_main.h:116
int ymin
Definition: DNA_vec_types.h:80
int ymax
Definition: DNA_vec_types.h:80
int xmin
Definition: DNA_vec_types.h:79
int xmax
Definition: DNA_vec_types.h:79
const char * path
Definition: WM_types.h:898
char name[64]
Definition: WM_types.h:896
int id_type
Definition: WM_types.h:899
struct ID * id
Definition: WM_types.h:891
struct ID * from_parent
Definition: WM_types.h:892
unsigned int flags
Definition: WM_types.h:919
char opname[200]
Definition: WM_types.h:918
char path[1024]
Definition: WM_types.h:909
void * poin
Definition: WM_types.h:908
int icon
Definition: WM_types.h:905
double value
Definition: WM_types.h:910
float scale
Definition: WM_types.h:914
ListBase ids
Definition: WM_types.h:922
int sx
Definition: WM_types.h:915
struct ImBuf * imb
Definition: WM_types.h:913
int type
Definition: WM_types.h:907
int sy
Definition: WM_types.h:915
short regionid
Definition: wm_dragdrop.c:71
struct wmDropBoxMap * next
Definition: wm_dragdrop.c:68
ListBase dropboxes
Definition: wm_dragdrop.c:70
struct wmDropBoxMap * prev
Definition: wm_dragdrop.c:68
short spaceid
Definition: wm_dragdrop.c:71
char idname[KMAP_MAX_NAME]
Definition: wm_dragdrop.c:72
short opcontext
Definition: WM_types.h:956
wmOperatorType * ot
Definition: WM_types.h:948
bool(* poll)(struct bContext *, struct wmDrag *, const wmEvent *, const char **)
Definition: WM_types.h:933
void(* copy)(struct wmDrag *, struct wmDropBox *)
Definition: WM_types.h:936
void(* cancel)(struct Main *, struct wmDrag *, struct wmDropBox *)
Definition: WM_types.h:942
struct IDProperty * properties
Definition: WM_types.h:951
struct PointerRNA * ptr
Definition: WM_types.h:953
int y
Definition: WM_types.h:581
short custom
Definition: WM_types.h:627
int x
Definition: WM_types.h:581
struct wmEvent * eventstate
static void drag_rect_minmax(rcti *rect, int x1, int y1, int x2, int y2)
Definition: wm_dragdrop.c:481
static ID * wm_drag_asset_id_import(wmDragAsset *asset_drag)
Definition: wm_dragdrop.c:378
void wm_dropbox_free(void)
Definition: wm_dragdrop.c:121
ID * WM_drag_get_local_ID_or_import_from_asset(const wmDrag *drag, int idcode)
Definition: wm_dragdrop.c:392
void WM_drag_free_imported_drag_ID(struct Main *bmain, wmDrag *drag, wmDropBox *drop)
Free asset ID imported for cancelled drop.
Definition: wm_dragdrop.c:419
static void wm_drop_operator_draw(const char *name, int x, int y)
Definition: wm_dragdrop.c:446
wmDropBox * WM_dropbox_add(ListBase *lb, const char *idname, bool(*poll)(bContext *, wmDrag *, const wmEvent *, const char **), void(*copy)(wmDrag *, wmDropBox *), void(*cancel)(struct Main *, wmDrag *, wmDropBox *))
Definition: wm_dragdrop.c:96
void WM_drag_free(wmDrag *drag)
Definition: wm_dragdrop.c:203
ID * WM_drag_get_local_ID(const wmDrag *drag, short idcode)
Definition: wm_dragdrop.c:335
void wm_drags_draw(bContext *C, wmWindow *win, rcti *rect)
Definition: wm_dragdrop.c:499
void wm_drags_check_ops(bContext *C, const wmEvent *event)
Definition: wm_dragdrop.c:301
bool WM_drag_is_ID_type(const wmDrag *drag, int idcode)
Definition: wm_dragdrop.c:363
static const char * wm_dropbox_active(bContext *C, wmDrag *drag, const wmEvent *event)
Definition: wm_dragdrop.c:245
void WM_drag_data_free(int dragtype, void *poin)
Definition: wm_dragdrop.c:188
void WM_drag_free_list(struct ListBase *lb)
Definition: wm_dragdrop.c:212
static const char * dropbox_active(bContext *C, ListBase *handlers, wmDrag *drag, const wmEvent *event)
Definition: wm_dragdrop.c:220
ListBase * WM_dropboxmap_find(const char *idname, int spaceid, int regionid)
Definition: wm_dragdrop.c:77
wmDragAsset * WM_drag_get_asset_data(const wmDrag *drag, int idcode)
Definition: wm_dragdrop.c:368
static void wm_drop_operator_options(bContext *C, wmDrag *drag, const wmEvent *event)
Definition: wm_dragdrop.c:270
static const char * wm_drag_name(wmDrag *drag)
Definition: wm_dragdrop.c:455
ID * WM_drag_get_local_ID_from_event(const wmEvent *event, short idcode)
Definition: wm_dragdrop.c:350
wmDrag * WM_event_start_drag(struct bContext *C, int icon, int type, void *poin, double value, unsigned int flags)
Definition: wm_dragdrop.c:140
static ListBase dropboxes
Definition: wm_dragdrop.c:61
void WM_drag_add_local_ID(wmDrag *drag, ID *id, ID *from_parent)
Definition: wm_dragdrop.c:312
struct wmDropBoxMap wmDropBoxMap
void WM_event_drag_image(wmDrag *drag, ImBuf *imb, float scale, int sx, int sy)
Definition: wm_dragdrop.c:180
bool WM_operator_poll_context(bContext *C, wmOperatorType *ot, short context)
@ WM_HANDLER_TYPE_DROPBOX
@ EVT_DATA_DRAGDROP
wmOperatorType * WM_operatortype_find(const char *idname, bool quiet)
const char * WM_operatortype_name(struct wmOperatorType *ot, struct PointerRNA *properties)
void WM_operator_properties_alloc(PointerRNA **ptr, IDProperty **properties, const char *opstring)
Definition: wm_operators.c:605
void WM_operator_properties_free(PointerRNA *ptr)
Definition: wm_operators.c:711
int WM_window_pixels_y(const wmWindow *win)
Definition: wm_window.c:2136
int WM_window_pixels_x(const wmWindow *win)
Definition: wm_window.c:2130