Blender  V3.3
drawnode.cc
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later
2  * Copyright 2005 Blender Foundation. All rights reserved. */
3 
9 #include "BLI_system.h"
10 #include "BLI_threads.h"
11 
12 #include "DNA_node_types.h"
13 #include "DNA_object_types.h"
14 #include "DNA_screen_types.h"
15 #include "DNA_space_types.h"
16 #include "DNA_userdef_types.h"
17 
18 #include "BKE_context.h"
19 #include "BKE_curve.h"
20 #include "BKE_image.h"
21 #include "BKE_main.h"
22 #include "BKE_node.h"
23 #include "BKE_node_runtime.hh"
24 #include "BKE_node_tree_update.h"
25 #include "BKE_scene.h"
26 #include "BKE_tracking.h"
27 
28 #include "BLF_api.h"
29 #include "BLT_translation.h"
30 
31 #include "BIF_glutil.h"
32 
33 #include "GPU_batch.h"
34 #include "GPU_batch_presets.h"
35 #include "GPU_framebuffer.h"
36 #include "GPU_immediate.h"
37 #include "GPU_matrix.h"
38 #include "GPU_platform.h"
39 #include "GPU_shader_shared.h"
40 #include "GPU_state.h"
41 #include "GPU_uniform_buffer.h"
42 
43 #include "DRW_engine.h"
44 
45 #include "RNA_access.h"
46 #include "RNA_define.h"
47 #include "RNA_prototypes.h"
48 
49 #include "ED_node.h"
50 #include "ED_space_api.h"
51 
52 #include "WM_api.h"
53 #include "WM_types.h"
54 
55 #include "UI_resources.h"
56 #include "UI_view2d.h"
57 
58 #include "IMB_colormanagement.h"
59 #include "IMB_imbuf_types.h"
60 
61 #include "NOD_composite.h"
62 #include "NOD_geometry.h"
63 #include "NOD_node_declaration.hh"
64 #include "NOD_shader.h"
65 #include "NOD_texture.h"
66 #include "node_intern.hh" /* own include */
67 
69 
70 /* Default flags for uiItemR(). Name is kept short since this is used a lot in this file. */
71 #define DEFAULT_FLAGS UI_ITEM_R_SPLIT_EMPTY_NAME
72 
73 /* ****************** SOCKET BUTTON DRAW FUNCTIONS ***************** */
74 
76  uiLayout *layout,
78  PointerRNA *UNUSED(node_ptr),
79  const char *text)
80 {
81  uiItemL(layout, text, 0);
82 }
83 
84 /* ****************** BUTTON CALLBACKS FOR ALL TREES ***************** */
85 
87 {
88  bNode *node = (bNode *)ptr->data;
89  /* first output stores value */
90  bNodeSocket *output = (bNodeSocket *)node->outputs.first;
91  PointerRNA sockptr;
92  RNA_pointer_create(ptr->owner_id, &RNA_NodeSocket, output, &sockptr);
93 
94  uiItemR(layout, &sockptr, "default_value", DEFAULT_FLAGS, "", ICON_NONE);
95 }
96 
97 static void node_buts_rgb(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
98 {
99  bNode *node = (bNode *)ptr->data;
100  /* first output stores value */
101  bNodeSocket *output = (bNodeSocket *)node->outputs.first;
102  PointerRNA sockptr;
103  uiLayout *col;
104  RNA_pointer_create(ptr->owner_id, &RNA_NodeSocket, output, &sockptr);
105 
106  col = uiLayoutColumn(layout, false);
107  uiTemplateColorPicker(col, &sockptr, "default_value", true, false, false, false);
108  uiItemR(col, &sockptr, "default_value", DEFAULT_FLAGS | UI_ITEM_R_SLIDER, "", ICON_NONE);
109 }
110 
112 {
114 
115  uiLayout *col = uiLayoutColumn(layout, false);
116  uiLayout *row = uiLayoutRow(col, true);
117  uiItemR(row, ptr, "blend_type", DEFAULT_FLAGS, "", ICON_NONE);
119  uiItemR(row, ptr, "use_alpha", DEFAULT_FLAGS, "", ICON_IMAGE_RGB_ALPHA);
120  }
121 
122  uiItemR(col, ptr, "use_clamp", DEFAULT_FLAGS, nullptr, ICON_NONE);
123 }
124 
126 {
127  uiTemplateCurveMapping(layout, ptr, "curve", 's', false, false, false, false);
128 
129  uiLayout *col = uiLayoutColumn(layout, true);
130  uiItemR(col, ptr, "frame_start", DEFAULT_FLAGS, IFACE_("Start"), ICON_NONE);
131  uiItemR(col, ptr, "frame_end", DEFAULT_FLAGS, IFACE_("End"), ICON_NONE);
132 }
133 
135 {
136  uiTemplateColorRamp(layout, ptr, "color_ramp", false);
137 }
138 
140 {
141  uiTemplateCurveMapping(layout, ptr, "mapping", 'v', false, false, false, false);
142 }
143 
145 {
146  uiTemplateCurveMapping(layout, ptr, "mapping", 0, false, false, false, false);
147 }
148 
149 } // namespace blender::ed::space_node
150 
151 #define SAMPLE_FLT_ISNONE FLT_MAX
152 /* Bad! 2.5 will do better? ... no it won't! */
153 static float _sample_col[4] = {SAMPLE_FLT_ISNONE};
154 void ED_node_sample_set(const float col[4])
155 {
156  if (col) {
158  }
159  else {
161  }
162 }
163 
164 namespace blender::ed::space_node {
165 
167 {
168  bNode *node = (bNode *)ptr->data;
169  CurveMapping *cumap = (CurveMapping *)node->storage;
170 
171  if (_sample_col[0] != SAMPLE_FLT_ISNONE) {
172  cumap->flag |= CUMA_DRAW_SAMPLE;
173  copy_v3_v3(cumap->sample, _sample_col);
174  }
175  else {
176  cumap->flag &= ~CUMA_DRAW_SAMPLE;
177  }
178 
179  /* "Tone" (Standard/Film-like) only used in the Compositor. */
182  layout, ptr, "mapping", 'c', false, false, false, (ntree->type == NTREE_COMPOSIT));
183 }
184 
186 {
187  bNode *node = (bNode *)ptr->data;
188  /* first output stores normal */
189  bNodeSocket *output = (bNodeSocket *)node->outputs.first;
190  PointerRNA sockptr;
191  RNA_pointer_create(ptr->owner_id, &RNA_NodeSocket, output, &sockptr);
192 
193  uiItemR(layout, &sockptr, "default_value", DEFAULT_FLAGS, "", ICON_NONE);
194 }
195 
197 {
198  bNode *node = (bNode *)ptr->data;
199 
200  short multi = (node->id && ((Tex *)node->id)->use_nodes && (node->type != CMP_NODE_TEXTURE) &&
201  (node->type != TEX_NODE_TEXTURE));
202 
203  uiItemR(layout, ptr, "texture", DEFAULT_FLAGS, "", ICON_NONE);
204 
205  if (multi) {
206  /* Number Drawing not optimal here, better have a list. */
207  uiItemR(layout, ptr, "node_output", DEFAULT_FLAGS, "", ICON_NONE);
208  }
209 }
210 
212 {
213  uiItemR(layout, ptr, "operation", DEFAULT_FLAGS, "", ICON_NONE);
214  uiItemR(layout, ptr, "use_clamp", DEFAULT_FLAGS, nullptr, ICON_NONE);
215 }
216 
218 {
219  uiItemR(layout, ptr, "mode", DEFAULT_FLAGS, "", ICON_NONE);
220 }
221 
223 {
224  if (node->type == NODE_FRAME) {
225  NodeFrame *data = (NodeFrame *)node->storage;
226 
227  /* shrinking frame size is determined by child nodes */
228  if (!(data->flag & NODE_FRAME_RESIZEABLE)) {
229  return NODE_RESIZE_NONE;
230  }
231 
233 
234  const rctf &totr = node->totr;
235  const float size = NODE_RESIZE_MARGIN;
236 
237  if (x > totr.xmax - size && x <= totr.xmax && y >= totr.ymin && y < totr.ymax) {
238  dir |= NODE_RESIZE_RIGHT;
239  }
240  if (x >= totr.xmin && x < totr.xmin + size && y >= totr.ymin && y < totr.ymax) {
241  dir |= NODE_RESIZE_LEFT;
242  }
243  if (x >= totr.xmin && x < totr.xmax && y >= totr.ymax - size && y < totr.ymax) {
244  dir |= NODE_RESIZE_TOP;
245  }
246  if (x >= totr.xmin && x < totr.xmax && y >= totr.ymin && y < totr.ymin + size) {
247  dir |= NODE_RESIZE_BOTTOM;
248  }
249 
250  return dir;
251  }
252 
253  if (node->flag & NODE_HIDDEN) {
254  /* right part of node */
255  rctf totr = node->totr;
256  totr.xmin = node->totr.xmax - 1.0f * U.widget_unit;
257  if (BLI_rctf_isect_pt(&totr, x, y)) {
258  return NODE_RESIZE_RIGHT;
259  }
260 
261  return NODE_RESIZE_NONE;
262  }
263 
264  const float size = NODE_RESIZE_MARGIN;
265  const rctf &totr = node->totr;
267 
268  if (x >= totr.xmax - size && x < totr.xmax && y >= totr.ymin && y < totr.ymax) {
269  dir |= NODE_RESIZE_RIGHT;
270  }
271  if (x >= totr.xmin && x < totr.xmin + size && y >= totr.ymin && y < totr.ymax) {
272  dir |= NODE_RESIZE_LEFT;
273  }
274  return dir;
275 }
276 
277 /* ****************** BUTTON CALLBACKS FOR COMMON NODES ***************** */
278 
280 {
282  layout, C, ptr, "node_tree", nullptr, nullptr, nullptr, UI_TEMPLATE_ID_FILTER_ALL, nullptr);
283 }
284 
286 {
287  uiItemR(layout, ptr, "label_size", DEFAULT_FLAGS, IFACE_("Label Size"), ICON_NONE);
288  uiItemR(layout, ptr, "shrink", DEFAULT_FLAGS, IFACE_("Shrink"), ICON_NONE);
289  uiItemR(layout, ptr, "text", DEFAULT_FLAGS, nullptr, ICON_NONE);
290 }
291 
293 {
294  switch (ntype->type) {
295  case NODE_GROUP:
297  break;
298  case NODE_FRAME:
300  break;
301  }
302 }
303 
304 /* ****************** BUTTON CALLBACKS FOR SHADER NODES ***************** */
305 
306 static void node_buts_image_user(uiLayout *layout,
307  bContext *C,
308  PointerRNA *ptr,
309  PointerRNA *imaptr,
310  PointerRNA *iuserptr,
311  const bool show_layer_selection,
312  const bool show_color_management)
313 {
314  Image *image = (Image *)imaptr->data;
315  if (!image) {
316  return;
317  }
318  ImageUser *iuser = (ImageUser *)iuserptr->data;
319 
320  uiLayout *col = uiLayoutColumn(layout, false);
321 
322  uiItemR(col, imaptr, "source", DEFAULT_FLAGS, "", ICON_NONE);
323 
324  const int source = RNA_enum_get(imaptr, "source");
325 
326  if (source == IMA_SRC_SEQUENCE) {
327  /* don't use iuser->framenr directly
328  * because it may not be updated if auto-refresh is off */
330 
331  char numstr[32];
332  const int framenr = BKE_image_user_frame_get(iuser, scene->r.cfra, nullptr);
333  BLI_snprintf(numstr, sizeof(numstr), IFACE_("Frame: %d"), framenr);
334  uiItemL(layout, numstr, ICON_NONE);
335  }
336 
337  if (ELEM(source, IMA_SRC_SEQUENCE, IMA_SRC_MOVIE)) {
338  col = uiLayoutColumn(layout, true);
339  uiItemR(col, ptr, "frame_duration", DEFAULT_FLAGS, nullptr, ICON_NONE);
340  uiItemR(col, ptr, "frame_start", DEFAULT_FLAGS, nullptr, ICON_NONE);
341  uiItemR(col, ptr, "frame_offset", DEFAULT_FLAGS, nullptr, ICON_NONE);
342  uiItemR(col, ptr, "use_cyclic", DEFAULT_FLAGS, nullptr, ICON_NONE);
343  uiItemR(col, ptr, "use_auto_refresh", DEFAULT_FLAGS, nullptr, ICON_NONE);
344  }
345 
346  if (show_layer_selection && RNA_enum_get(imaptr, "type") == IMA_TYPE_MULTILAYER &&
347  RNA_boolean_get(ptr, "has_layers")) {
348  col = uiLayoutColumn(layout, false);
349  uiItemR(col, ptr, "layer", DEFAULT_FLAGS, nullptr, ICON_NONE);
350  }
351 
352  if (show_color_management) {
353  uiLayout *split = uiLayoutSplit(layout, 0.33f, true);
354  PointerRNA colorspace_settings_ptr = RNA_pointer_get(imaptr, "colorspace_settings");
355  uiItemL(split, IFACE_("Color Space"), ICON_NONE);
356  uiItemR(split, &colorspace_settings_ptr, "name", DEFAULT_FLAGS, "", ICON_NONE);
357 
358  if (image->source != IMA_SRC_GENERATED) {
359  split = uiLayoutSplit(layout, 0.33f, true);
360  uiItemL(split, IFACE_("Alpha"), ICON_NONE);
361  uiItemR(split, imaptr, "alpha_mode", DEFAULT_FLAGS, "", ICON_NONE);
362 
363  bool is_data = IMB_colormanagement_space_name_is_data(image->colorspace_settings.name);
364  uiLayoutSetActive(split, !is_data);
365  }
366 
367  /* Avoid losing changes image is painted. */
368  if (BKE_image_is_dirty((Image *)imaptr->data)) {
369  uiLayoutSetEnabled(split, false);
370  }
371  }
372 }
373 
375 {
376  PointerRNA imaptr = RNA_pointer_get(ptr, "image");
377  PointerRNA iuserptr = RNA_pointer_get(ptr, "image_user");
378 
379  uiLayoutSetContextPointer(layout, "image_user", &iuserptr);
380  uiTemplateID(layout,
381  C,
382  ptr,
383  "image",
384  "IMAGE_OT_new",
385  "IMAGE_OT_open",
386  nullptr,
388  false,
389  nullptr);
390  uiItemR(layout, ptr, "interpolation", DEFAULT_FLAGS, "", ICON_NONE);
391  uiItemR(layout, ptr, "projection", DEFAULT_FLAGS, "", ICON_NONE);
392 
393  if (RNA_enum_get(ptr, "projection") == SHD_PROJ_BOX) {
394  uiItemR(layout, ptr, "projection_blend", DEFAULT_FLAGS, "Blend", ICON_NONE);
395  }
396 
397  uiItemR(layout, ptr, "extension", DEFAULT_FLAGS, "", ICON_NONE);
398 
399  /* NOTE: image user properties used directly here, unlike compositor image node,
400  * which redefines them in the node struct RNA to get proper updates.
401  */
402  node_buts_image_user(layout, C, &iuserptr, &imaptr, &iuserptr, false, true);
403 }
404 
406 {
407  PointerRNA iuserptr = RNA_pointer_get(ptr, "image_user");
408  uiTemplateImage(layout, C, ptr, "image", &iuserptr, false, false);
409 }
410 
412 {
413  PointerRNA imaptr = RNA_pointer_get(ptr, "image");
414  PointerRNA iuserptr = RNA_pointer_get(ptr, "image_user");
415 
416  uiLayoutSetContextPointer(layout, "image_user", &iuserptr);
417  uiTemplateID(layout,
418  C,
419  ptr,
420  "image",
421  "IMAGE_OT_new",
422  "IMAGE_OT_open",
423  nullptr,
425  false,
426  nullptr);
427 
428  uiItemR(layout, ptr, "interpolation", DEFAULT_FLAGS, "", ICON_NONE);
429  uiItemR(layout, ptr, "projection", DEFAULT_FLAGS, "", ICON_NONE);
430 
431  node_buts_image_user(layout, C, &iuserptr, &imaptr, &iuserptr, false, true);
432 }
433 
435 {
436  PointerRNA iuserptr = RNA_pointer_get(ptr, "image_user");
437  uiTemplateImage(layout, C, ptr, "image", &iuserptr, false, false);
438 
439  uiItemR(layout, ptr, "interpolation", DEFAULT_FLAGS, IFACE_("Interpolation"), ICON_NONE);
440  uiItemR(layout, ptr, "projection", DEFAULT_FLAGS, IFACE_("Projection"), ICON_NONE);
441 }
442 
444 {
445  uiItemR(layout, ptr, "space", DEFAULT_FLAGS, "", 0);
446 }
447 
449 {
450  uiItemR(layout, ptr, "distribution", DEFAULT_FLAGS, "", ICON_NONE);
451 }
452 
454 {
455  uiItemR(layout, ptr, "target", DEFAULT_FLAGS, "", ICON_NONE);
456 }
457 
458 /* only once called */
460 {
461  switch (ntype->type) {
462  case SH_NODE_NORMAL:
464  break;
465  case SH_NODE_CURVE_VEC:
467  break;
468  case SH_NODE_CURVE_RGB:
470  break;
471  case SH_NODE_CURVE_FLOAT:
473  break;
474  case SH_NODE_VALUE:
475  ntype->draw_buttons = node_buts_value;
476  break;
477  case SH_NODE_RGB:
478  ntype->draw_buttons = node_buts_rgb;
479  break;
480  case SH_NODE_MIX_RGB:
482  break;
483  case SH_NODE_VALTORGB:
485  break;
486  case SH_NODE_MATH:
487  ntype->draw_buttons = node_buts_math;
488  break;
492  break;
493  case SH_NODE_TEX_IMAGE:
496  break;
500  break;
504  break;
505  case SH_NODE_BSDF_GLOSSY:
506  case SH_NODE_BSDF_GLASS:
509  break;
514  break;
515  }
516 }
517 
518 /* ****************** BUTTON CALLBACKS FOR COMPOSITE NODES ***************** */
519 
520 static void node_buts_image_views(uiLayout *layout,
521  bContext *UNUSED(C),
522  PointerRNA *ptr,
523  PointerRNA *imaptr)
524 {
525  uiLayout *col;
526 
527  if (!imaptr->data) {
528  return;
529  }
530 
531  col = uiLayoutColumn(layout, false);
532 
533  if (RNA_boolean_get(ptr, "has_views")) {
534  if (RNA_enum_get(ptr, "view") == 0) {
535  uiItemR(col, ptr, "view", DEFAULT_FLAGS, nullptr, ICON_CAMERA_STEREO);
536  }
537  else {
538  uiItemR(col, ptr, "view", DEFAULT_FLAGS, nullptr, ICON_SCENE);
539  }
540  }
541 }
542 
544 {
545  bNode *node = (bNode *)ptr->data;
546 
547  PointerRNA iuserptr;
548  RNA_pointer_create(ptr->owner_id, &RNA_ImageUser, node->storage, &iuserptr);
549  uiLayoutSetContextPointer(layout, "image_user", &iuserptr);
550  uiTemplateID(layout,
551  C,
552  ptr,
553  "image",
554  "IMAGE_OT_new",
555  "IMAGE_OT_open",
556  nullptr,
558  false,
559  nullptr);
560  if (!node->id) {
561  return;
562  }
563 
564  PointerRNA imaptr = RNA_pointer_get(ptr, "image");
565 
566  node_buts_image_user(layout, C, ptr, &imaptr, &iuserptr, true, true);
567 
568  node_buts_image_views(layout, C, ptr, &imaptr);
569 }
570 
572 {
573  bNode *node = (bNode *)ptr->data;
574 
575  PointerRNA iuserptr;
576  RNA_pointer_create(ptr->owner_id, &RNA_ImageUser, node->storage, &iuserptr);
577  uiLayoutSetContextPointer(layout, "image_user", &iuserptr);
578  uiTemplateImage(layout, C, ptr, "image", &iuserptr, false, true);
579 }
580 
582 {
583  bNode *node = (bNode *)ptr->data;
584  CurveMapping *cumap = (CurveMapping *)node->storage;
585 
586  if (_sample_col[0] != SAMPLE_FLT_ISNONE) {
587  cumap->flag |= CUMA_DRAW_SAMPLE;
588  copy_v3_v3(cumap->sample, _sample_col);
589  }
590  else {
591  cumap->flag &= ~CUMA_DRAW_SAMPLE;
592  }
593 
594  uiTemplateCurveMapping(layout, ptr, "mapping", 'h', false, false, false, false);
595 }
596 
598 {
599  uiItemR(layout, ptr, "mode", DEFAULT_FLAGS, "", ICON_NONE);
600 }
601 
603  bContext *UNUSED(C),
604  PointerRNA *ptr)
605 {
606  bNode *node = (bNode *)ptr->data;
607  NodeCMPCombSepColor *storage = (NodeCMPCombSepColor *)node->storage;
608 
609  uiItemR(layout, ptr, "mode", DEFAULT_FLAGS, "", ICON_NONE);
610  if (storage->mode == CMP_NODE_COMBSEP_COLOR_YCC) {
611  uiItemR(layout, ptr, "ycc_mode", DEFAULT_FLAGS, "", ICON_NONE);
612  }
613 }
614 
616  SpaceNode *snode, ImBuf *backdrop, bNode *node, int x, int y)
617 {
618  // node_composit_backdrop_canvas(snode, backdrop, node, x, y);
619  if (node->custom1 == 0) {
620  const float backdropWidth = backdrop->x;
621  const float backdropHeight = backdrop->y;
622  const float cx = x + snode->zoom * backdropWidth * node->custom3;
623  const float cy = y + snode->zoom * backdropHeight * node->custom4;
624  const float cross_size = 12 * U.pixelsize;
625 
628 
630 
631  immUniformColor3f(1.0f, 1.0f, 1.0f);
632 
634  immVertex2f(pos, cx - cross_size, cy - cross_size);
635  immVertex2f(pos, cx + cross_size, cy + cross_size);
636  immVertex2f(pos, cx + cross_size, cy - cross_size);
637  immVertex2f(pos, cx - cross_size, cy + cross_size);
638  immEnd();
639 
641  }
642 }
643 
645  SpaceNode *snode, ImBuf *backdrop, bNode *node, int x, int y)
646 {
647  NodeBoxMask *boxmask = (NodeBoxMask *)node->storage;
648  const float backdropWidth = backdrop->x;
649  const float backdropHeight = backdrop->y;
650  const float aspect = backdropWidth / backdropHeight;
651  const float rad = -boxmask->rotation;
652  const float cosine = cosf(rad);
653  const float sine = sinf(rad);
654  const float halveBoxWidth = backdropWidth * (boxmask->width / 2.0f);
655  const float halveBoxHeight = backdropHeight * (boxmask->height / 2.0f) * aspect;
656 
657  float cx, cy, x1, x2, x3, x4;
658  float y1, y2, y3, y4;
659 
660  cx = x + snode->zoom * backdropWidth * boxmask->x;
661  cy = y + snode->zoom * backdropHeight * boxmask->y;
662 
663  x1 = cx - (cosine * halveBoxWidth + sine * halveBoxHeight) * snode->zoom;
664  x2 = cx - (cosine * -halveBoxWidth + sine * halveBoxHeight) * snode->zoom;
665  x3 = cx - (cosine * -halveBoxWidth + sine * -halveBoxHeight) * snode->zoom;
666  x4 = cx - (cosine * halveBoxWidth + sine * -halveBoxHeight) * snode->zoom;
667  y1 = cy - (-sine * halveBoxWidth + cosine * halveBoxHeight) * snode->zoom;
668  y2 = cy - (-sine * -halveBoxWidth + cosine * halveBoxHeight) * snode->zoom;
669  y3 = cy - (-sine * -halveBoxWidth + cosine * -halveBoxHeight) * snode->zoom;
670  y4 = cy - (-sine * halveBoxWidth + cosine * -halveBoxHeight) * snode->zoom;
671 
674 
676 
677  immUniformColor3f(1.0f, 1.0f, 1.0f);
678 
680  immVertex2f(pos, x1, y1);
681  immVertex2f(pos, x2, y2);
682  immVertex2f(pos, x3, y3);
683  immVertex2f(pos, x4, y4);
684  immEnd();
685 
687 }
688 
690  SpaceNode *snode, ImBuf *backdrop, bNode *node, int x, int y)
691 {
692  NodeEllipseMask *ellipsemask = (NodeEllipseMask *)node->storage;
693  const float backdropWidth = backdrop->x;
694  const float backdropHeight = backdrop->y;
695  const float aspect = backdropWidth / backdropHeight;
696  const float rad = -ellipsemask->rotation;
697  const float cosine = cosf(rad);
698  const float sine = sinf(rad);
699  const float halveBoxWidth = backdropWidth * (ellipsemask->width / 2.0f);
700  const float halveBoxHeight = backdropHeight * (ellipsemask->height / 2.0f) * aspect;
701 
702  float cx, cy, x1, x2, x3, x4;
703  float y1, y2, y3, y4;
704 
705  cx = x + snode->zoom * backdropWidth * ellipsemask->x;
706  cy = y + snode->zoom * backdropHeight * ellipsemask->y;
707 
708  x1 = cx - (cosine * halveBoxWidth + sine * halveBoxHeight) * snode->zoom;
709  x2 = cx - (cosine * -halveBoxWidth + sine * halveBoxHeight) * snode->zoom;
710  x3 = cx - (cosine * -halveBoxWidth + sine * -halveBoxHeight) * snode->zoom;
711  x4 = cx - (cosine * halveBoxWidth + sine * -halveBoxHeight) * snode->zoom;
712  y1 = cy - (-sine * halveBoxWidth + cosine * halveBoxHeight) * snode->zoom;
713  y2 = cy - (-sine * -halveBoxWidth + cosine * halveBoxHeight) * snode->zoom;
714  y3 = cy - (-sine * -halveBoxWidth + cosine * -halveBoxHeight) * snode->zoom;
715  y4 = cy - (-sine * halveBoxWidth + cosine * -halveBoxHeight) * snode->zoom;
716 
719 
721 
722  immUniformColor3f(1.0f, 1.0f, 1.0f);
723 
725  immVertex2f(pos, x1, y1);
726  immVertex2f(pos, x2, y2);
727  immVertex2f(pos, x3, y3);
728  immVertex2f(pos, x4, y4);
729  immEnd();
730 
732 }
733 
735  bContext *UNUSED(C),
736  PointerRNA *ptr)
737 {
738  uiLayout *col = uiLayoutColumn(layout, true);
739 
740  uiItemL(col, IFACE_("Matte Objects:"), ICON_NONE);
741 
742  uiLayout *row = uiLayoutRow(col, true);
743  uiTemplateCryptoPicker(row, ptr, "add", ICON_ADD);
744  uiTemplateCryptoPicker(row, ptr, "remove", ICON_REMOVE);
745 
746  uiItemR(col, ptr, "matte_id", DEFAULT_FLAGS, "", ICON_NONE);
747 }
748 
750  bContext *UNUSED(C),
752 {
753  uiItemO(layout, IFACE_("Add Crypto Layer"), ICON_ADD, "NODE_OT_cryptomatte_layer_add");
754  uiItemO(layout, IFACE_("Remove Crypto Layer"), ICON_REMOVE, "NODE_OT_cryptomatte_layer_remove");
755 }
756 
758 {
759  bNode *node = (bNode *)ptr->data;
760 
761  uiLayout *row = uiLayoutRow(layout, true);
762  uiItemR(row, ptr, "source", DEFAULT_FLAGS | UI_ITEM_R_EXPAND, nullptr, ICON_NONE);
763 
764  uiLayout *col = uiLayoutColumn(layout, false);
765  if (node->custom1 == CMP_CRYPTOMATTE_SRC_RENDER) {
767  C,
768  ptr,
769  "scene",
770  nullptr,
771  nullptr,
772  nullptr,
774  false,
775  nullptr);
776  }
777  else {
779  C,
780  ptr,
781  "image",
782  nullptr,
783  "IMAGE_OT_open",
784  nullptr,
786  false,
787  nullptr);
788 
789  NodeCryptomatte *crypto = (NodeCryptomatte *)node->storage;
790  PointerRNA imaptr = RNA_pointer_get(ptr, "image");
791  PointerRNA iuserptr;
792  RNA_pointer_create((ID *)ptr->owner_id, &RNA_ImageUser, &crypto->iuser, &iuserptr);
793  uiLayoutSetContextPointer(layout, "image_user", &iuserptr);
794 
795  node_buts_image_user(col, C, ptr, &imaptr, &iuserptr, false, false);
796  node_buts_image_views(col, C, ptr, &imaptr);
797  }
798 
799  col = uiLayoutColumn(layout, true);
800  uiItemR(col, ptr, "layer_name", 0, "", ICON_NONE);
801  uiItemL(col, IFACE_("Matte ID:"), ICON_NONE);
802 
803  row = uiLayoutRow(col, true);
804  uiItemR(row, ptr, "matte_id", DEFAULT_FLAGS, "", ICON_NONE);
805  uiTemplateCryptoPicker(row, ptr, "add", ICON_ADD);
806  uiTemplateCryptoPicker(row, ptr, "remove", ICON_REMOVE);
807 }
808 
809 /* only once called */
811 {
812  switch (ntype->type) {
813  case CMP_NODE_IMAGE:
816  break;
817  case CMP_NODE_NORMAL:
819  break;
820  case CMP_NODE_CURVE_RGB:
822  break;
823  case CMP_NODE_VALUE:
824  ntype->draw_buttons = node_buts_value;
825  break;
826  case CMP_NODE_RGB:
827  ntype->draw_buttons = node_buts_rgb;
828  break;
829  case CMP_NODE_MIX_RGB:
831  break;
832  case CMP_NODE_VALTORGB:
834  break;
835  case CMP_NODE_TIME:
836  ntype->draw_buttons = node_buts_time;
837  break;
838  case CMP_NODE_TEXTURE:
840  break;
841  case CMP_NODE_MATH:
842  ntype->draw_buttons = node_buts_math;
843  break;
844  case CMP_NODE_HUECORRECT:
846  break;
850  break;
854  break;
855  case CMP_NODE_MASK_BOX:
857  break;
860  break;
863  break;
867  break;
868  case CMP_NODE_VIEWER:
870  break;
871  }
872 }
873 
874 /* ****************** BUTTON CALLBACKS FOR TEXTURE NODES ***************** */
875 
877 {
878  uiLayout *col;
879 
880  col = uiLayoutColumn(layout, true);
881  uiItemR(col, ptr, "offset", DEFAULT_FLAGS | UI_ITEM_R_SLIDER, IFACE_("Offset"), ICON_NONE);
882  uiItemR(col, ptr, "offset_frequency", DEFAULT_FLAGS, IFACE_("Frequency"), ICON_NONE);
883 
884  col = uiLayoutColumn(layout, true);
885  uiItemR(col, ptr, "squash", DEFAULT_FLAGS, IFACE_("Squash"), ICON_NONE);
886  uiItemR(col, ptr, "squash_frequency", DEFAULT_FLAGS, IFACE_("Frequency"), ICON_NONE);
887 }
888 
890 {
891  PointerRNA tex_ptr;
892  bNode *node = (bNode *)ptr->data;
893  ID *id = ptr->owner_id;
894  Tex *tex = (Tex *)node->storage;
895  uiLayout *col, *row;
896 
897  RNA_pointer_create(id, &RNA_Texture, tex, &tex_ptr);
898 
899  col = uiLayoutColumn(layout, false);
900 
901  switch (tex->type) {
902  case TEX_BLEND:
903  uiItemR(col, &tex_ptr, "progression", DEFAULT_FLAGS, "", ICON_NONE);
904  row = uiLayoutRow(col, false);
905  uiItemR(
906  row, &tex_ptr, "use_flip_axis", DEFAULT_FLAGS | UI_ITEM_R_EXPAND, nullptr, ICON_NONE);
907  break;
908 
909  case TEX_MARBLE:
910  row = uiLayoutRow(col, false);
911  uiItemR(row, &tex_ptr, "marble_type", DEFAULT_FLAGS | UI_ITEM_R_EXPAND, nullptr, ICON_NONE);
912  row = uiLayoutRow(col, false);
913  uiItemR(row, &tex_ptr, "noise_type", DEFAULT_FLAGS | UI_ITEM_R_EXPAND, nullptr, ICON_NONE);
914  row = uiLayoutRow(col, false);
915  uiItemR(row, &tex_ptr, "noise_basis", DEFAULT_FLAGS, "", ICON_NONE);
916  row = uiLayoutRow(col, false);
917  uiItemR(
918  row, &tex_ptr, "noise_basis_2", DEFAULT_FLAGS | UI_ITEM_R_EXPAND, nullptr, ICON_NONE);
919  break;
920 
921  case TEX_MAGIC:
922  uiItemR(col, &tex_ptr, "noise_depth", DEFAULT_FLAGS, nullptr, ICON_NONE);
923  break;
924 
925  case TEX_STUCCI:
926  row = uiLayoutRow(col, false);
927  uiItemR(row, &tex_ptr, "stucci_type", DEFAULT_FLAGS | UI_ITEM_R_EXPAND, nullptr, ICON_NONE);
928  row = uiLayoutRow(col, false);
929  uiItemR(row, &tex_ptr, "noise_type", DEFAULT_FLAGS | UI_ITEM_R_EXPAND, nullptr, ICON_NONE);
930  uiItemR(col, &tex_ptr, "noise_basis", DEFAULT_FLAGS, "", ICON_NONE);
931  break;
932 
933  case TEX_WOOD:
934  uiItemR(col, &tex_ptr, "noise_basis", DEFAULT_FLAGS, "", ICON_NONE);
935  uiItemR(col, &tex_ptr, "wood_type", DEFAULT_FLAGS, "", ICON_NONE);
936  row = uiLayoutRow(col, false);
937  uiItemR(
938  row, &tex_ptr, "noise_basis_2", DEFAULT_FLAGS | UI_ITEM_R_EXPAND, nullptr, ICON_NONE);
939  row = uiLayoutRow(col, false);
941  uiItemR(row, &tex_ptr, "noise_type", DEFAULT_FLAGS | UI_ITEM_R_EXPAND, nullptr, ICON_NONE);
942  break;
943 
944  case TEX_CLOUDS:
945  uiItemR(col, &tex_ptr, "noise_basis", DEFAULT_FLAGS, "", ICON_NONE);
946  row = uiLayoutRow(col, false);
947  uiItemR(row, &tex_ptr, "cloud_type", DEFAULT_FLAGS | UI_ITEM_R_EXPAND, nullptr, ICON_NONE);
948  row = uiLayoutRow(col, false);
949  uiItemR(row, &tex_ptr, "noise_type", DEFAULT_FLAGS | UI_ITEM_R_EXPAND, nullptr, ICON_NONE);
950  uiItemR(col,
951  &tex_ptr,
952  "noise_depth",
954  IFACE_("Depth"),
955  ICON_NONE);
956  break;
957 
958  case TEX_DISTNOISE:
959  uiItemR(col, &tex_ptr, "noise_basis", DEFAULT_FLAGS, "", ICON_NONE);
960  uiItemR(col, &tex_ptr, "noise_distortion", DEFAULT_FLAGS, "", ICON_NONE);
961  break;
962 
963  case TEX_MUSGRAVE:
964  uiItemR(col, &tex_ptr, "musgrave_type", DEFAULT_FLAGS, "", ICON_NONE);
965  uiItemR(col, &tex_ptr, "noise_basis", DEFAULT_FLAGS, "", ICON_NONE);
966  break;
967  case TEX_VORONOI:
968  uiItemR(col, &tex_ptr, "distance_metric", DEFAULT_FLAGS, "", ICON_NONE);
969  if (tex->vn_distm == TEX_MINKOVSKY) {
970  uiItemR(col, &tex_ptr, "minkovsky_exponent", DEFAULT_FLAGS, nullptr, ICON_NONE);
971  }
972  uiItemR(col, &tex_ptr, "color_mode", DEFAULT_FLAGS, "", ICON_NONE);
973  break;
974  }
975 }
976 
978 {
979  uiTemplateID(layout,
980  C,
981  ptr,
982  "image",
983  "IMAGE_OT_new",
984  "IMAGE_OT_open",
985  nullptr,
987  false,
988  nullptr);
989 }
990 
992 {
993  bNode *node = (bNode *)ptr->data;
994  PointerRNA iuserptr;
995 
996  RNA_pointer_create(ptr->owner_id, &RNA_ImageUser, node->storage, &iuserptr);
997  uiTemplateImage(layout, C, ptr, "image", &iuserptr, false, false);
998 }
999 
1001 {
1002  uiItemR(layout, ptr, "filepath", DEFAULT_FLAGS, "", ICON_NONE);
1003 }
1004 
1006 {
1007  uiItemR(layout, ptr, "mode", DEFAULT_FLAGS, "", ICON_NONE);
1008 }
1009 
1010 /* only once called */
1012 {
1013  if (ntype->type >= TEX_NODE_PROC && ntype->type < TEX_NODE_PROC_MAX) {
1015  }
1016  else {
1017  switch (ntype->type) {
1018 
1019  case TEX_NODE_MATH:
1020  ntype->draw_buttons = node_buts_math;
1021  break;
1022 
1023  case TEX_NODE_MIX_RGB:
1025  break;
1026 
1027  case TEX_NODE_VALTORGB:
1029  break;
1030 
1031  case TEX_NODE_CURVE_RGB:
1033  break;
1034 
1035  case TEX_NODE_CURVE_TIME:
1036  ntype->draw_buttons = node_buts_time;
1037  break;
1038 
1039  case TEX_NODE_TEXTURE:
1041  break;
1042 
1043  case TEX_NODE_BRICKS:
1045  break;
1046 
1047  case TEX_NODE_IMAGE:
1050  break;
1051 
1052  case TEX_NODE_OUTPUT:
1054  break;
1055 
1059  break;
1060  }
1061  }
1062 }
1063 
1064 /* -------------------------------------------------------------------- */
1071 {
1073  bNode *node = (bNode *)ptr->data;
1075  ED_node_tree_propagate_change(nullptr, bmain, ntree);
1076 }
1077 
1079 {
1080  StructRNA *srna = ntype->rna_ext.srna;
1082 
1083  if (prop) {
1085  }
1086 }
1087 
1089 {
1090  bNodeSocketTemplate *stemp;
1091 
1092  if (ntype->inputs) {
1093  for (stemp = ntype->inputs; stemp->type >= 0; stemp++) {
1095  }
1096  }
1097  if (ntype->outputs) {
1098  for (stemp = ntype->outputs; stemp->type >= 0; stemp++) {
1100  }
1101  }
1102 }
1103 
1105  uiLayout *layout,
1106  PointerRNA *UNUSED(ptr),
1107  PointerRNA *UNUSED(node_ptr),
1108  const char *UNUSED(text))
1109 {
1110  uiItemL(layout, IFACE_("Undefined Socket Type"), ICON_ERROR);
1111 }
1112 
1114  PointerRNA *UNUSED(ptr),
1115  PointerRNA *UNUSED(node_ptr),
1116  float *r_color)
1117 {
1118  r_color[0] = 1.0f;
1119  r_color[1] = 0.0f;
1120  r_color[2] = 0.0f;
1121  r_color[3] = 1.0f;
1122 }
1123 
1125  uiLayout *layout,
1126  PointerRNA *UNUSED(ptr))
1127 {
1128  uiItemL(layout, IFACE_("Undefined Socket Type"), ICON_ERROR);
1129 }
1130 
1132  PointerRNA *UNUSED(ptr),
1133  float *r_color)
1134 {
1135  r_color[0] = 1.0f;
1136  r_color[1] = 0.0f;
1137  r_color[2] = 0.0f;
1138  r_color[3] = 1.0f;
1139 }
1140 
1143 } // namespace blender::ed::space_node
1144 
1146 {
1147  using namespace blender::ed::space_node;
1148 
1149  /* Fallback types for undefined tree, nodes, sockets
1150  * Defined in blenkernel, but not registered in type hashes.
1151  */
1152 
1153  NodeTypeUndefined.draw_buttons = nullptr;
1155 
1160 
1161  /* node type ui functions */
1162  NODE_TYPES_BEGIN (ntype) {
1163  node_common_set_butfunc(ntype);
1164 
1166  node_shader_set_butfunc(ntype);
1167  node_texture_set_butfunc(ntype);
1168 
1169  /* define update callbacks for socket properties */
1171  }
1173 }
1174 
1176 {
1177 }
1178 
1180 {
1182 }
1183 
1184 namespace blender::ed::space_node {
1185 
1186 static const float virtual_node_socket_color[4] = {0.2, 0.2, 0.2, 1.0};
1187 
1188 /* maps standard socket integer type to a color */
1189 static const float std_node_socket_colors[][4] = {
1190  {0.63, 0.63, 0.63, 1.0}, /* SOCK_FLOAT */
1191  {0.39, 0.39, 0.78, 1.0}, /* SOCK_VECTOR */
1192  {0.78, 0.78, 0.16, 1.0}, /* SOCK_RGBA */
1193  {0.39, 0.78, 0.39, 1.0}, /* SOCK_SHADER */
1194  {0.80, 0.65, 0.84, 1.0}, /* SOCK_BOOLEAN */
1195  {0.0, 0.0, 0.0, 1.0}, /*__SOCK_MESH (deprecated) */
1196  {0.35, 0.55, 0.36, 1.0}, /* SOCK_INT */
1197  {0.44, 0.70, 1.00, 1.0}, /* SOCK_STRING */
1198  {0.93, 0.62, 0.36, 1.0}, /* SOCK_OBJECT */
1199  {0.39, 0.22, 0.39, 1.0}, /* SOCK_IMAGE */
1200  {0.00, 0.84, 0.64, 1.0}, /* SOCK_GEOMETRY */
1201  {0.96, 0.96, 0.96, 1.0}, /* SOCK_COLLECTION */
1202  {0.62, 0.31, 0.64, 1.0}, /* SOCK_TEXTURE */
1203  {0.92, 0.46, 0.51, 1.0}, /* SOCK_MATERIAL */
1204 };
1205 
1206 /* common color callbacks for standard types */
1208  PointerRNA *ptr,
1209  PointerRNA *UNUSED(node_ptr),
1210  float *r_color)
1211 {
1212  bNodeSocket *sock = (bNodeSocket *)ptr->data;
1213  int type = sock->typeinfo->type;
1215 }
1217  PointerRNA *ptr,
1218  float *r_color)
1219 {
1220  bNodeSocket *sock = (bNodeSocket *)ptr->data;
1221  int type = sock->typeinfo->type;
1223 }
1224 
1225 /* draw function for file output node sockets,
1226  * displays only sub-path and format, no value button */
1228  uiLayout *layout,
1229  PointerRNA *ptr,
1230  PointerRNA *node_ptr)
1231 {
1233  bNodeSocket *sock = (bNodeSocket *)ptr->data;
1234  uiLayout *row;
1235  PointerRNA inputptr;
1236 
1237  row = uiLayoutRow(layout, false);
1238 
1239  PointerRNA imfptr = RNA_pointer_get(node_ptr, "format");
1240  int imtype = RNA_enum_get(&imfptr, "file_format");
1241 
1242  if (imtype == R_IMF_IMTYPE_MULTILAYER) {
1244  RNA_pointer_create(&ntree->id, &RNA_NodeOutputFileSlotLayer, input, &inputptr);
1245 
1246  uiItemL(row, input->layer, ICON_NONE);
1247  }
1248  else {
1250  uiBlock *block;
1251  RNA_pointer_create(&ntree->id, &RNA_NodeOutputFileSlotFile, input, &inputptr);
1252 
1253  uiItemL(row, input->path, ICON_NONE);
1254 
1255  if (!RNA_boolean_get(&inputptr, "use_node_format")) {
1256  imfptr = RNA_pointer_get(&inputptr, "format");
1257  }
1258 
1259  const char *imtype_name;
1260  PropertyRNA *imtype_prop = RNA_struct_find_property(&imfptr, "file_format");
1262  &imfptr,
1263  imtype_prop,
1264  RNA_property_enum_get(&imfptr, imtype_prop),
1265  &imtype_name);
1266  block = uiLayoutGetBlock(row);
1268  uiItemL(row, imtype_name, ICON_NONE);
1270  }
1271 }
1272 
1274 {
1275  if (node.runtime->declaration == nullptr) {
1276  return false;
1277  }
1278  if (socket.in_out == SOCK_OUT) {
1279  return false;
1280  }
1281  const int socket_index = BLI_findindex(&node.inputs, &socket);
1282  return node.runtime->declaration->inputs()[socket_index]->is_attribute_name();
1283 }
1284 
1286  bContext *C, uiLayout *layout, PointerRNA *ptr, PointerRNA *node_ptr, const char *text)
1287 {
1288  bNode *node = (bNode *)node_ptr->data;
1289  bNodeSocket *sock = (bNodeSocket *)ptr->data;
1290  int type = sock->typeinfo->type;
1291  // int subtype = sock->typeinfo->subtype;
1292 
1293  /* XXX not nice, eventually give this node its own socket type ... */
1294  if (node->type == CMP_NODE_OUTPUT_FILE) {
1295  node_file_output_socket_draw(C, layout, ptr, node_ptr);
1296  return;
1297  }
1298 
1299  if ((sock->in_out == SOCK_OUT) || (sock->flag & SOCK_IN_USE) || (sock->flag & SOCK_HIDE_VALUE)) {
1300  node_socket_button_label(C, layout, ptr, node_ptr, text);
1301  return;
1302  }
1303 
1304  text = (sock->flag & SOCK_HIDE_LABEL) ? "" : text;
1305 
1306  switch (type) {
1307  case SOCK_FLOAT:
1308  case SOCK_INT:
1309  case SOCK_BOOLEAN:
1310  uiItemR(layout, ptr, "default_value", DEFAULT_FLAGS, text, 0);
1311  break;
1312  case SOCK_VECTOR:
1313  if (sock->flag & SOCK_COMPACT) {
1314  uiTemplateComponentMenu(layout, ptr, "default_value", text);
1315  }
1316  else {
1317  if (sock->typeinfo->subtype == PROP_DIRECTION) {
1318  uiItemR(layout, ptr, "default_value", DEFAULT_FLAGS, "", ICON_NONE);
1319  }
1320  else {
1321  uiLayout *column = uiLayoutColumn(layout, true);
1322  uiItemR(column, ptr, "default_value", DEFAULT_FLAGS, text, ICON_NONE);
1323  }
1324  }
1325  break;
1326  case SOCK_RGBA: {
1327  if (text[0] == '\0') {
1328  uiItemR(layout, ptr, "default_value", DEFAULT_FLAGS, "", 0);
1329  }
1330  else {
1331  uiLayout *row = uiLayoutSplit(layout, 0.4f, false);
1332  uiItemL(row, text, 0);
1333  uiItemR(row, ptr, "default_value", DEFAULT_FLAGS, "", 0);
1334  }
1335  break;
1336  }
1337  case SOCK_STRING: {
1338  uiLayout *row = uiLayoutSplit(layout, 0.4f, false);
1339  uiItemL(row, text, 0);
1340 
1341  if (socket_needs_attribute_search(*node, *sock)) {
1343  }
1344  else {
1345  uiItemR(row, ptr, "default_value", DEFAULT_FLAGS, "", 0);
1346  }
1347 
1348  break;
1349  }
1350  case SOCK_OBJECT: {
1351  uiItemR(layout, ptr, "default_value", DEFAULT_FLAGS, text, 0);
1352  break;
1353  }
1354  case SOCK_IMAGE: {
1355  const bNodeTree *node_tree = (const bNodeTree *)node_ptr->owner_id;
1356  if (node_tree->type == NTREE_GEOMETRY) {
1357  if (text[0] == '\0') {
1358  uiTemplateID(layout,
1359  C,
1360  ptr,
1361  "default_value",
1362  "image.new",
1363  "image.open",
1364  nullptr,
1365  0,
1366  ICON_NONE,
1367  nullptr);
1368  }
1369  else {
1370  /* 0.3 split ratio is inconsistent, but use it here because the "New" button is large. */
1371  uiLayout *row = uiLayoutSplit(layout, 0.3f, false);
1372  uiItemL(row, text, 0);
1373  uiTemplateID(row,
1374  C,
1375  ptr,
1376  "default_value",
1377  "image.new",
1378  "image.open",
1379  nullptr,
1380  0,
1381  ICON_NONE,
1382  nullptr);
1383  }
1384  }
1385  else {
1386  uiItemR(layout, ptr, "default_value", DEFAULT_FLAGS, text, 0);
1387  }
1388  break;
1389  }
1390  case SOCK_COLLECTION: {
1391  uiItemR(layout, ptr, "default_value", DEFAULT_FLAGS, text, 0);
1392  break;
1393  }
1394  case SOCK_TEXTURE: {
1395  if (text[0] == '\0') {
1396  uiTemplateID(layout,
1397  C,
1398  ptr,
1399  "default_value",
1400  "texture.new",
1401  nullptr,
1402  nullptr,
1403  0,
1404  ICON_NONE,
1405  nullptr);
1406  }
1407  else {
1408  /* 0.3 split ratio is inconsistent, but use it here because the "New" button is large. */
1409  uiLayout *row = uiLayoutSplit(layout, 0.3f, false);
1410  uiItemL(row, text, 0);
1411  uiTemplateID(
1412  row, C, ptr, "default_value", "texture.new", nullptr, nullptr, 0, ICON_NONE, nullptr);
1413  }
1414 
1415  break;
1416  }
1417  case SOCK_MATERIAL: {
1418  uiItemR(layout, ptr, "default_value", DEFAULT_FLAGS, text, 0);
1419  break;
1420  }
1421  default:
1422  node_socket_button_label(C, layout, ptr, node_ptr, text);
1423  break;
1424  }
1425 }
1426 
1428 {
1429  bNodeSocket *sock = (bNodeSocket *)ptr->data;
1430  int type = sock->typeinfo->type;
1431 
1432  uiLayout *col = uiLayoutColumn(layout, false);
1433 
1434  switch (type) {
1435  case SOCK_FLOAT: {
1436  uiItemR(col, ptr, "default_value", DEFAULT_FLAGS, IFACE_("Default"), ICON_NONE);
1437  uiLayout *sub = uiLayoutColumn(col, true);
1438  uiItemR(sub, ptr, "min_value", DEFAULT_FLAGS, IFACE_("Min"), ICON_NONE);
1439  uiItemR(sub, ptr, "max_value", DEFAULT_FLAGS, IFACE_("Max"), ICON_NONE);
1440  break;
1441  }
1442  case SOCK_INT: {
1443  uiItemR(col, ptr, "default_value", DEFAULT_FLAGS, IFACE_("Default"), ICON_NONE);
1444  uiLayout *sub = uiLayoutColumn(col, true);
1445  uiItemR(sub, ptr, "min_value", DEFAULT_FLAGS, IFACE_("Min"), ICON_NONE);
1446  uiItemR(sub, ptr, "max_value", DEFAULT_FLAGS, IFACE_("Max"), ICON_NONE);
1447  break;
1448  }
1449  case SOCK_VECTOR: {
1450  uiItemR(col, ptr, "default_value", UI_ITEM_R_EXPAND, IFACE_("Default"), ICON_NONE);
1451  uiLayout *sub = uiLayoutColumn(col, true);
1452  uiItemR(sub, ptr, "min_value", DEFAULT_FLAGS, IFACE_("Min"), ICON_NONE);
1453  uiItemR(sub, ptr, "max_value", DEFAULT_FLAGS, IFACE_("Max"), ICON_NONE);
1454  break;
1455  }
1456  case SOCK_BOOLEAN:
1457  case SOCK_RGBA:
1458  case SOCK_STRING:
1459  case SOCK_OBJECT:
1460  case SOCK_COLLECTION:
1461  case SOCK_TEXTURE:
1462  case SOCK_MATERIAL: {
1463  uiItemR(col, ptr, "default_value", DEFAULT_FLAGS, IFACE_("Default"), 0);
1464  break;
1465  }
1466  }
1467 
1468  uiItemR(layout, ptr, "hide_value", DEFAULT_FLAGS, nullptr, 0);
1469 }
1470 
1472  PointerRNA *UNUSED(ptr),
1473  PointerRNA *UNUSED(node_ptr),
1474  float *r_color)
1475 {
1477 }
1478 
1479 } // namespace blender::ed::space_node
1480 
1482 {
1483  using namespace blender::ed::space_node;
1484  stype->draw = std_node_socket_draw;
1488 }
1489 
1491 {
1492  using namespace blender::ed::space_node;
1493  stype->draw = node_socket_button_label;
1495 }
1496 
1497 namespace blender::ed::space_node {
1498 
1499 /* ************** Generic drawing ************** */
1500 
1502  ARegion &region,
1503  SpaceNode &snode,
1504  bNodeInstanceKey parent_key)
1505 {
1506  Main *bmain = CTX_data_main(&C);
1507  bNodeInstanceKey active_viewer_key = (snode.nodetree ? snode.nodetree->active_viewer_key :
1510  GPU_matrix_push();
1511  wmOrtho2_region_pixelspace(&region);
1515  GPU_matrix_pop();
1516 
1517  if (!(snode.flag & SNODE_BACKDRAW) || !ED_node_is_compositor(&snode)) {
1518  return;
1519  }
1520 
1521  if (parent_key.value != active_viewer_key.value) {
1522  return;
1523  }
1524 
1526  GPU_matrix_push();
1527 
1528  /* The draw manager is used to draw the backdrop image. */
1532  DRW_draw_view(&C);
1535  /* Draw manager changes the depth state. Set it back to NONE. Without this the node preview
1536  * images aren't drawn correctly. */
1538 
1539  void *lock;
1540  Image *ima = BKE_image_ensure_viewer(bmain, IMA_TYPE_COMPOSITE, "Viewer Node");
1541  ImBuf *ibuf = BKE_image_acquire_ibuf(ima, nullptr, &lock);
1542  if (ibuf) {
1543  /* somehow the offset has to be calculated inverse */
1544  wmOrtho2_region_pixelspace(&region);
1545  const float x = (region.winx - snode.zoom * ibuf->x) / 2 + snode.xof;
1546  const float y = (region.winy - snode.zoom * ibuf->y) / 2 + snode.yof;
1547 
1549  if (snode.edittree) {
1550  bNode *node = (bNode *)snode.edittree->nodes.first;
1551  rctf *viewer_border = &snode.nodetree->viewer_border;
1552  while (node) {
1553  if (node->flag & NODE_SELECT) {
1554  if (node->typeinfo->draw_backdrop) {
1555  node->typeinfo->draw_backdrop(&snode, ibuf, node, x, y);
1556  }
1557  }
1558  node = node->next;
1559  }
1560 
1561  if ((snode.nodetree->flag & NTREE_VIEWER_BORDER) &&
1562  viewer_border->xmin < viewer_border->xmax && viewer_border->ymin < viewer_border->ymax) {
1563  rcti pixel_border;
1564  BLI_rcti_init(&pixel_border,
1565  x + snode.zoom * viewer_border->xmin * ibuf->x,
1566  x + snode.zoom * viewer_border->xmax * ibuf->x,
1567  y + snode.zoom * viewer_border->ymin * ibuf->y,
1568  y + snode.zoom * viewer_border->ymax * ibuf->y);
1569 
1574 
1575  immDrawBorderCorners(pos, &pixel_border, 1.0f, 1.0f);
1576 
1577  immUnbindProgram();
1578  }
1579  }
1580  }
1581 
1582  BKE_image_release_ibuf(ima, ibuf, lock);
1584  GPU_matrix_pop();
1585 }
1586 
1588  const SpaceNode *snode,
1589  const bNodeLink &link,
1590  float vec[4][2])
1591 {
1592  float cursor[2] = {0.0f, 0.0f};
1593 
1594  /* this function can be called with snode null (via cut_links_intersect) */
1595  /* XXX map snode->runtime->cursor back to view space */
1596  if (snode) {
1597  cursor[0] = snode->runtime->cursor[0] * UI_DPI_FAC;
1598  cursor[1] = snode->runtime->cursor[1] * UI_DPI_FAC;
1599  }
1600 
1601  /* in v0 and v3 we put begin/end points */
1602  if (link.fromsock) {
1603  vec[0][0] = link.fromsock->locx;
1604  vec[0][1] = link.fromsock->locy;
1605  if (link.fromsock->flag & SOCK_MULTI_INPUT) {
1607  {link.fromsock->locx, link.fromsock->locy},
1608  link.fromsock->total_inputs - 1,
1609  link.fromsock->total_inputs);
1610  copy_v2_v2(vec[0], position);
1611  }
1612  }
1613  else {
1614  if (snode == nullptr) {
1615  return false;
1616  }
1617  copy_v2_v2(vec[0], cursor);
1618  }
1619  if (link.tosock) {
1620  vec[3][0] = link.tosock->locx;
1621  vec[3][1] = link.tosock->locy;
1622  if (!(link.tonode->flag & NODE_HIDDEN) && link.tosock->flag & SOCK_MULTI_INPUT) {
1624  {link.tosock->locx, link.tosock->locy},
1626  link.tosock->total_inputs);
1627  copy_v2_v2(vec[3], position);
1628  }
1629  }
1630  else {
1631  if (snode == nullptr) {
1632  return false;
1633  }
1634  copy_v2_v2(vec[3], cursor);
1635  }
1636 
1637  /* may be called outside of drawing (so pass spacetype) */
1639 
1640  if (curving == 0) {
1641  /* Straight line: align all points. */
1642  mid_v2_v2v2(vec[1], vec[0], vec[3]);
1643  mid_v2_v2v2(vec[2], vec[1], vec[3]);
1644  return true;
1645  }
1646 
1647  const float dist = curving * 0.10f * fabsf(vec[0][0] - vec[3][0]);
1648 
1649  vec[1][0] = vec[0][0] + dist;
1650  vec[1][1] = vec[0][1];
1651 
1652  vec[2][0] = vec[3][0] - dist;
1653  vec[2][1] = vec[3][1];
1654 
1655  if (v2d && min_ffff(vec[0][0], vec[1][0], vec[2][0], vec[3][0]) > v2d->cur.xmax) {
1656  return false; /* clipped */
1657  }
1658  if (v2d && max_ffff(vec[0][0], vec[1][0], vec[2][0], vec[3][0]) < v2d->cur.xmin) {
1659  return false; /* clipped */
1660  }
1661 
1662  return true;
1663 }
1664 
1666  const SpaceNode *snode,
1667  const bNodeLink &link,
1668  float coord_array[][2],
1669  const int resol)
1670 {
1671  float vec[4][2];
1672 
1673  if (node_link_bezier_handles(v2d, snode, link, vec)) {
1674  /* always do all three, to prevent data hanging around */
1676  vec[0][0], vec[1][0], vec[2][0], vec[3][0], coord_array[0] + 0, resol, sizeof(float[2]));
1678  vec[0][1], vec[1][1], vec[2][1], vec[3][1], coord_array[0] + 1, resol, sizeof(float[2]));
1679 
1680  return true;
1681  }
1682  return false;
1683 }
1684 
1685 #define NODELINK_GROUP_SIZE 256
1686 #define LINK_RESOL 24
1687 #define LINK_WIDTH (2.5f * UI_DPI_FAC)
1688 #define ARROW_SIZE (7 * UI_DPI_FAC)
1689 
1690 /* Reroute arrow shape and mute bar. These are expanded here and shrunk in the glsl code.
1691  * See: gpu_shader_2D_nodelink_vert.glsl */
1692 static float arrow_verts[3][2] = {{-1.0f, 1.0f}, {0.0f, 0.0f}, {-1.0f, -1.0f}};
1693 static float arrow_expand_axis[3][2] = {{0.7071f, 0.7071f}, {M_SQRT2, 0.0f}, {0.7071f, -0.7071f}};
1694 static float mute_verts[3][2] = {{0.7071f, 1.0f}, {0.7071f, 0.0f}, {0.7071f, -1.0f}};
1695 static float mute_expand_axis[3][2] = {{1.0f, 0.0f}, {1.0f, 0.0f}, {1.0f, -0.0f}};
1696 
1697 /* Is zero initialized because it is static data. */
1698 static struct {
1699  GPUBatch *batch; /* for batching line together */
1700  GPUBatch *batch_single; /* for single line */
1715  bool enabled;
1717 
1719 {
1725  g_batch_link.inst_vbo, g_batch_link.colid_id, &g_batch_link.colid_step);
1727  g_batch_link.inst_vbo, g_batch_link.muted_id, &g_batch_link.muted_step);
1729  g_batch_link.inst_vbo, g_batch_link.dim_factor_id, &g_batch_link.dim_factor_step);
1731  g_batch_link.inst_vbo, g_batch_link.thickness_id, &g_batch_link.thickness_step);
1733  g_batch_link.inst_vbo, g_batch_link.dash_factor_id, &g_batch_link.dash_factor_step);
1735  g_batch_link.inst_vbo, g_batch_link.dash_alpha_id, &g_batch_link.dash_alpha_step);
1737  g_batch_link.inst_vbo, g_batch_link.start_color_id, &g_batch_link.start_color_step);
1739  g_batch_link.inst_vbo, g_batch_link.end_color_id, &g_batch_link.end_color_step);
1740  g_batch_link.count = 0;
1741 }
1742 
1744  uint uv_id,
1745  uint pos_id,
1746  uint exp_id,
1747  uint v,
1748  const uchar uv[2],
1749  const float pos[2],
1750  const float exp[2])
1751 {
1752  GPU_vertbuf_attr_set(vbo, uv_id, v, uv);
1753  GPU_vertbuf_attr_set(vbo, pos_id, v, pos);
1754  GPU_vertbuf_attr_set(vbo, exp_id, v, exp);
1755 }
1756 
1757 static void nodelink_batch_init()
1758 {
1759  GPUVertFormat format = {0};
1764  int vcount = LINK_RESOL * 2; /* curve */
1765  vcount += 2; /* restart strip */
1766  vcount += 3 * 2; /* arrow */
1767  vcount += 2; /* restart strip */
1768  vcount += 3 * 2; /* mute */
1769  vcount *= 2; /* shadow */
1770  vcount += 2; /* restart strip */
1771  GPU_vertbuf_data_alloc(vbo, vcount);
1772  int v = 0;
1773 
1774  for (int k = 0; k < 2; k++) {
1775  uchar uv[2] = {0, 0};
1776  float pos[2] = {0.0f, 0.0f};
1777  float exp[2] = {0.0f, 1.0f};
1778 
1779  /* restart */
1780  if (k == 1) {
1781  set_nodelink_vertex(vbo, uv_id, pos_id, expand_id, v++, uv, pos, exp);
1782  }
1783 
1784  /* curve strip */
1785  for (int i = 0; i < LINK_RESOL; i++) {
1786  uv[0] = 255 * (i / (float)(LINK_RESOL - 1));
1787  uv[1] = 0;
1788  set_nodelink_vertex(vbo, uv_id, pos_id, expand_id, v++, uv, pos, exp);
1789  uv[1] = 255;
1790  set_nodelink_vertex(vbo, uv_id, pos_id, expand_id, v++, uv, pos, exp);
1791  }
1792  /* restart */
1793  set_nodelink_vertex(vbo, uv_id, pos_id, expand_id, v++, uv, pos, exp);
1794 
1795  uv[0] = 127;
1796  uv[1] = 0;
1797  copy_v2_v2(pos, arrow_verts[0]);
1799  set_nodelink_vertex(vbo, uv_id, pos_id, expand_id, v++, uv, pos, exp);
1800  /* arrow */
1801  for (int i = 0; i < 3; i++) {
1802  uv[1] = 0;
1803  copy_v2_v2(pos, arrow_verts[i]);
1805  set_nodelink_vertex(vbo, uv_id, pos_id, expand_id, v++, uv, pos, exp);
1806 
1807  uv[1] = 255;
1808  set_nodelink_vertex(vbo, uv_id, pos_id, expand_id, v++, uv, pos, exp);
1809  }
1810 
1811  /* restart */
1812  set_nodelink_vertex(vbo, uv_id, pos_id, expand_id, v++, uv, pos, exp);
1813 
1814  uv[0] = 127;
1815  uv[1] = 0;
1816  copy_v2_v2(pos, mute_verts[0]);
1818  set_nodelink_vertex(vbo, uv_id, pos_id, expand_id, v++, uv, pos, exp);
1819  /* bar */
1820  for (int i = 0; i < 3; ++i) {
1821  uv[1] = 0;
1822  copy_v2_v2(pos, mute_verts[i]);
1824  set_nodelink_vertex(vbo, uv_id, pos_id, expand_id, v++, uv, pos, exp);
1825 
1826  uv[1] = 255;
1827  set_nodelink_vertex(vbo, uv_id, pos_id, expand_id, v++, uv, pos, exp);
1828  }
1829 
1830  /* restart */
1831  if (k == 0) {
1832  set_nodelink_vertex(vbo, uv_id, pos_id, expand_id, v++, uv, pos, exp);
1833  }
1834  }
1835 
1838 
1839  g_batch_link.batch_single = GPU_batch_create_ex(
1840  GPU_PRIM_TRI_STRIP, vbo, nullptr, GPU_BATCH_INVALID);
1842 
1843  /* Instances data */
1844  GPUVertFormat format_inst = {0};
1846  &format_inst, "P0", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
1848  &format_inst, "P1", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
1850  &format_inst, "P2", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
1852  &format_inst, "P3", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
1854  &format_inst, "colid_doarrow", GPU_COMP_U8, 4, GPU_FETCH_INT);
1855  g_batch_link.start_color_id = GPU_vertformat_attr_add(
1856  &format_inst, "start_color", GPU_COMP_F32, 4, GPU_FETCH_FLOAT);
1857  g_batch_link.end_color_id = GPU_vertformat_attr_add(
1858  &format_inst, "end_color", GPU_COMP_F32, 4, GPU_FETCH_FLOAT);
1860  &format_inst, "domuted", GPU_COMP_U8, 2, GPU_FETCH_INT);
1861  g_batch_link.dim_factor_id = GPU_vertformat_attr_add(
1862  &format_inst, "dim_factor", GPU_COMP_F32, 1, GPU_FETCH_FLOAT);
1863  g_batch_link.thickness_id = GPU_vertformat_attr_add(
1864  &format_inst, "thickness", GPU_COMP_F32, 1, GPU_FETCH_FLOAT);
1865  g_batch_link.dash_factor_id = GPU_vertformat_attr_add(
1866  &format_inst, "dash_factor", GPU_COMP_F32, 1, GPU_FETCH_FLOAT);
1867  g_batch_link.dash_alpha_id = GPU_vertformat_attr_add(
1868  &format_inst, "dash_alpha", GPU_COMP_F32, 1, GPU_FETCH_FLOAT);
1870  /* Alloc max count but only draw the range we need. */
1872 
1873  GPU_batch_instbuf_set(g_batch_link.batch, g_batch_link.inst_vbo, true);
1874 
1876 }
1877 
1878 static char nodelink_get_color_id(int th_col)
1879 {
1880  switch (th_col) {
1881  case TH_WIRE:
1882  return 1;
1883  case TH_WIRE_INNER:
1884  return 2;
1885  case TH_ACTIVE:
1886  return 3;
1887  case TH_EDGE_SELECT:
1888  return 4;
1889  case TH_REDALERT:
1890  return 5;
1891  }
1892  return 0;
1893 }
1894 
1895 static void nodelink_batch_draw(const SpaceNode &snode)
1896 {
1897  if (g_batch_link.count == 0) {
1898  return;
1899  }
1900 
1902  NodeLinkInstanceData node_link_data;
1903 
1908  node_link_data.colors[nodelink_get_color_id(TH_EDGE_SELECT)]);
1910  node_link_data.expandSize = snode.runtime->aspect * LINK_WIDTH;
1911  node_link_data.arrowSize = ARROW_SIZE;
1912 
1913  GPUUniformBuf *ubo = GPU_uniformbuf_create_ex(sizeof(node_link_data), &node_link_data, __func__);
1914 
1916  GPU_vertbuf_use(g_batch_link.inst_vbo); /* force update. */
1917 
1919  GPU_batch_uniformbuf_bind(g_batch_link.batch, "node_link_data", ubo);
1921 
1922  GPU_uniformbuf_unbind(ubo);
1923  GPU_uniformbuf_free(ubo);
1924 
1926 
1928 }
1929 
1931 {
1932  g_batch_link.enabled = true;
1933 }
1934 
1936 {
1937  nodelink_batch_draw(snode);
1938  g_batch_link.enabled = false;
1939 }
1940 
1941 static void nodelink_batch_add_link(const SpaceNode &snode,
1942  const float2 &p0,
1943  const float2 &p1,
1944  const float2 &p2,
1945  const float2 &p3,
1946  int th_col1,
1947  int th_col2,
1948  int th_col3,
1949  const float start_color[4],
1950  const float end_color[4],
1951  bool drawarrow,
1952  bool drawmuted,
1953  float dim_factor,
1954  float thickness,
1955  float dash_factor,
1956  float dash_alpha)
1957 {
1958  /* Only allow these colors. If more is needed, you need to modify the shader accordingly. */
1961  BLI_assert(ELEM(th_col3, TH_WIRE, TH_REDALERT, -1));
1962 
1963  g_batch_link.count++;
1964  copy_v2_v2((float *)GPU_vertbuf_raw_step(&g_batch_link.p0_step), p0);
1965  copy_v2_v2((float *)GPU_vertbuf_raw_step(&g_batch_link.p1_step), p1);
1966  copy_v2_v2((float *)GPU_vertbuf_raw_step(&g_batch_link.p2_step), p2);
1967  copy_v2_v2((float *)GPU_vertbuf_raw_step(&g_batch_link.p3_step), p3);
1968  char *colid = (char *)GPU_vertbuf_raw_step(&g_batch_link.colid_step);
1969  colid[0] = nodelink_get_color_id(th_col1);
1970  colid[1] = nodelink_get_color_id(th_col2);
1971  colid[2] = nodelink_get_color_id(th_col3);
1972  colid[3] = drawarrow;
1973  copy_v4_v4((float *)GPU_vertbuf_raw_step(&g_batch_link.start_color_step), start_color);
1974  copy_v4_v4((float *)GPU_vertbuf_raw_step(&g_batch_link.end_color_step), end_color);
1975  char *muted = (char *)GPU_vertbuf_raw_step(&g_batch_link.muted_step);
1976  muted[0] = drawmuted;
1977  *(float *)GPU_vertbuf_raw_step(&g_batch_link.dim_factor_step) = dim_factor;
1978  *(float *)GPU_vertbuf_raw_step(&g_batch_link.thickness_step) = thickness;
1979  *(float *)GPU_vertbuf_raw_step(&g_batch_link.dash_factor_step) = dash_factor;
1980  *(float *)GPU_vertbuf_raw_step(&g_batch_link.dash_alpha_step) = dash_alpha;
1981 
1982  if (g_batch_link.count == NODELINK_GROUP_SIZE) {
1983  nodelink_batch_draw(snode);
1984  }
1985 }
1986 
1988  const View2D &v2d,
1989  const SpaceNode &snode,
1990  const bNodeLink &link,
1991  const int th_col1,
1992  const int th_col2,
1993  const int th_col3,
1994  const bool selected)
1995 {
1996  const float dim_factor = selected ? 1.0f : node_link_dim_factor(v2d, link);
1997  float thickness = 1.5f;
1998  float dash_factor = 1.0f;
1999 
2000  bTheme *btheme = UI_GetTheme();
2001  const float dash_alpha = btheme->space_node.dash_alpha;
2002 
2003  if (snode.edittree->type == NTREE_GEOMETRY) {
2005  /* Make field links a bit thinner. */
2006  thickness = 1.0f;
2007  /* Draw field as dashes. */
2008  dash_factor = 0.75f;
2009  }
2010  }
2011 
2012  float vec[4][2];
2013  const bool highlighted = link.flag & NODE_LINK_TEMP_HIGHLIGHT;
2014  if (node_link_bezier_handles(&v2d, &snode, link, vec)) {
2015  int drawarrow = ((link.tonode && (link.tonode->type == NODE_REROUTE)) &&
2016  (link.fromnode && (link.fromnode->type == NODE_REROUTE)));
2017  int drawmuted = (link.flag & NODE_LINK_MUTED);
2018  if (g_batch_link.batch == nullptr) {
2020  }
2021  /* Draw single link. */
2022  float colors[3][4] = {{0.0f}};
2023  if (th_col3 != -1) {
2024  UI_GetThemeColor4fv(th_col3, colors[0]);
2025  }
2026 
2027  if (snode.overlay.flag & SN_OVERLAY_SHOW_OVERLAYS &&
2029  PointerRNA from_node_ptr, to_node_ptr;
2030  RNA_pointer_create((ID *)snode.edittree, &RNA_Node, link.fromnode, &from_node_ptr);
2031  RNA_pointer_create((ID *)snode.edittree, &RNA_Node, link.tonode, &to_node_ptr);
2032  if (link.fromsock) {
2033  node_socket_color_get(C, *snode.edittree, from_node_ptr, *link.fromsock, colors[1]);
2034  }
2035  else {
2036  node_socket_color_get(C, *snode.edittree, to_node_ptr, *link.tosock, colors[1]);
2037  }
2038 
2039  if (link.tosock) {
2040  node_socket_color_get(C, *snode.edittree, to_node_ptr, *link.tosock, colors[2]);
2041  }
2042  else {
2043  node_socket_color_get(C, *snode.edittree, from_node_ptr, *link.fromsock, colors[2]);
2044  }
2045  }
2046  else {
2047  UI_GetThemeColor4fv(th_col1, colors[1]);
2048  UI_GetThemeColor4fv(th_col2, colors[2]);
2049  }
2050 
2051  /* Highlight links connected to selected nodes. */
2052  if (selected) {
2053  float color_selected[4];
2054  UI_GetThemeColor4fv(TH_EDGE_SELECT, color_selected);
2055  const float alpha = color_selected[3];
2056 
2057  /* Interpolate color if highlight color is not fully transparent. */
2058  if (alpha != 0.0) {
2059  if (link.fromsock) {
2060  interp_v3_v3v3(colors[1], colors[1], color_selected, alpha);
2061  }
2062  if (link.tosock) {
2063  interp_v3_v3v3(colors[2], colors[2], color_selected, alpha);
2064  }
2065  }
2066  }
2067 
2068  if (g_batch_link.enabled && !highlighted) {
2069  /* Add link to batch. */
2071  vec[0],
2072  vec[1],
2073  vec[2],
2074  vec[3],
2075  th_col1,
2076  th_col2,
2077  th_col3,
2078  colors[1],
2079  colors[2],
2080  drawarrow,
2081  drawmuted,
2082  dim_factor,
2083  thickness,
2084  dash_factor,
2085  dash_alpha);
2086  }
2087  else {
2088  if (highlighted) {
2089  float link_preselection_highlight_color[4];
2090  UI_GetThemeColor4fv(TH_SELECT, link_preselection_highlight_color);
2091  copy_v4_v4(colors[2], link_preselection_highlight_color);
2092  }
2093 
2094  NodeLinkData node_link_data;
2095  for (int i = 0; i < 4; i++) {
2096  copy_v2_v2(node_link_data.bezierPts[i], vec[i]);
2097  }
2098  for (int i = 0; i < 3; i++) {
2099  copy_v4_v4(node_link_data.colors[i], colors[i]);
2100  }
2101  node_link_data.doArrow = drawarrow;
2102  node_link_data.doMuted = drawmuted;
2103  node_link_data.dim_factor = dim_factor;
2104  node_link_data.thickness = thickness;
2105  node_link_data.dash_factor = dash_factor;
2106  node_link_data.dash_alpha = dash_alpha;
2107  node_link_data.expandSize = snode.runtime->aspect * LINK_WIDTH;
2108  node_link_data.arrowSize = ARROW_SIZE;
2109 
2110  GPUBatch *batch = g_batch_link.batch_single;
2112  sizeof(NodeLinkData), &node_link_data, __func__);
2113 
2115  GPU_batch_uniformbuf_bind(batch, "node_link_data", ubo);
2117 
2118  GPU_uniformbuf_unbind(ubo);
2119  GPU_uniformbuf_free(ubo);
2120  }
2121  }
2122 }
2123 
2124 void node_draw_link(const bContext &C,
2125  const View2D &v2d,
2126  const SpaceNode &snode,
2127  const bNodeLink &link,
2128  const bool selected)
2129 {
2130  int th_col1 = TH_WIRE_INNER, th_col2 = TH_WIRE_INNER, th_col3 = TH_WIRE;
2131 
2132  if (link.fromsock == nullptr && link.tosock == nullptr) {
2133  return;
2134  }
2135 
2136  /* new connection */
2137  if (!link.fromsock || !link.tosock) {
2138  th_col1 = th_col2 = TH_ACTIVE;
2139  }
2140  else {
2141  /* going to give issues once... */
2142  if (link.tosock->flag & SOCK_UNAVAIL) {
2143  return;
2144  }
2145  if (link.fromsock->flag & SOCK_UNAVAIL) {
2146  return;
2147  }
2148 
2149  if (link.flag & NODE_LINK_VALID) {
2150  /* special indicated link, on drop-node */
2151  if (link.flag & NODE_LINKFLAG_HILITE) {
2152  th_col1 = th_col2 = TH_ACTIVE;
2153  }
2154  else if (link.flag & NODE_LINK_MUTED) {
2155  th_col1 = th_col2 = TH_REDALERT;
2156  }
2157  }
2158  else {
2159  /* Invalid link. */
2160  th_col1 = th_col2 = th_col3 = TH_REDALERT;
2161  // th_col3 = -1; /* no shadow */
2162  }
2163  }
2164  /* Links from field to non-field sockets are not allowed. */
2165  if (snode.edittree->type == NTREE_GEOMETRY && !(link.flag & NODE_LINK_DRAGGED)) {
2166  if ((link.fromsock && link.fromsock->display_shape == SOCK_DISPLAY_SHAPE_DIAMOND) &&
2168  th_col1 = th_col2 = th_col3 = TH_REDALERT;
2169  }
2170  }
2171 
2172  node_draw_link_bezier(C, v2d, snode, link, th_col1, th_col2, th_col3, selected);
2173 }
2174 
2175 } // namespace blender::ed::space_node
2176 
2177 void ED_node_draw_snap(View2D *v2d, const float cent[2], float size, NodeBorder border, uint pos)
2178 {
2180 
2181  if (border & (NODE_LEFT | NODE_RIGHT)) {
2182  immVertex2f(pos, cent[0], v2d->cur.ymin);
2183  immVertex2f(pos, cent[0], v2d->cur.ymax);
2184  }
2185  else {
2186  immVertex2f(pos, cent[0], cent[1] - size);
2187  immVertex2f(pos, cent[0], cent[1] + size);
2188  }
2189 
2190  if (border & (NODE_TOP | NODE_BOTTOM)) {
2191  immVertex2f(pos, v2d->cur.xmin, cent[1]);
2192  immVertex2f(pos, v2d->cur.xmax, cent[1]);
2193  }
2194  else {
2195  immVertex2f(pos, cent[0] - size, cent[1]);
2196  immVertex2f(pos, cent[0] + size, cent[1]);
2197  }
2198 
2199  immEnd();
2200 }
typedef float(TangentPoint)[2]
void immDrawBorderCorners(unsigned int pos, const struct rcti *border, float zoomx, float zoomy)
struct Scene * CTX_data_scene(const bContext *C)
Definition: context.c:1090
struct Main * CTX_data_main(const bContext *C)
Definition: context.c:1074
void BKE_curve_forward_diff_bezier(float q0, float q1, float q2, float q3, float *p, int it, int stride)
Definition: curve.cc:1717
void BKE_image_release_ibuf(struct Image *ima, struct ImBuf *ibuf, void *lock)
struct ImBuf * BKE_image_acquire_ibuf(struct Image *ima, struct ImageUser *iuser, void **r_lock)
struct Image * BKE_image_ensure_viewer(struct Main *bmain, int type, const char *name)
int BKE_image_user_frame_get(const struct ImageUser *iuser, int cfra, bool *r_is_in_range)
bool BKE_image_is_dirty(struct Image *image)
#define CMP_NODE_VALTORGB
Definition: BKE_node.h:1200
#define SH_NODE_COMBINE_COLOR
Definition: BKE_node.h:1182
#define NODE_TYPES_BEGIN(ntype)
Definition: BKE_node.h:567
#define CMP_NODE_MIX_RGB
Definition: BKE_node.h:1199
#define NODE_REROUTE
Definition: BKE_node.h:986
#define CMP_NODE_TIME
Definition: BKE_node.h:1209
#define CMP_NODE_VIEWER
Definition: BKE_node.h:1196
#define CMP_NODE_MASK_ELLIPSE
Definition: BKE_node.h:1279
#define TEX_NODE_PROC_MAX
Definition: BKE_node.h:1375
#define CMP_NODE_COMBYCCA_LEGACY
Definition: BKE_node.h:1227
#define CMP_NODE_SEPARATE_COLOR
Definition: BKE_node.h:1299
#define CMP_NODE_CRYPTOMATTE
Definition: BKE_node.h:1292
struct bNodeType NodeTypeUndefined
Definition: node.cc:111
#define TEX_NODE_BRICKS
Definition: BKE_node.h:1350
#define SH_NODE_TEX_ENVIRONMENT
Definition: BKE_node.h:1128
#define SH_NODE_VALUE
Definition: BKE_node.h:1080
#define CMP_NODE_TEXTURE
Definition: BKE_node.h:1219
#define CMP_NODE_HUECORRECT
Definition: BKE_node.h:1256
#define TEX_NODE_COMBINE_COLOR
Definition: BKE_node.h:1370
#define SH_NODE_MATH
Definition: BKE_node.h:1092
#define TEX_NODE_TEXTURE
Definition: BKE_node.h:1349
#define TEX_NODE_SEPARATE_COLOR
Definition: BKE_node.h:1371
#define CMP_NODE_VALUE
Definition: BKE_node.h:1198
#define CMP_NODE_MATH
Definition: BKE_node.h:1242
#define CMP_NODE_CRYPTOMATTE_LEGACY
Definition: BKE_node.h:1289
#define SH_NODE_OUTPUT_MATERIAL
Definition: BKE_node.h:1101
#define TEX_NODE_IMAGE
Definition: BKE_node.h:1355
#define CMP_NODE_OUTPUT_FILE
Definition: BKE_node.h:1218
#define CMP_NODE_CURVE_RGB
Definition: BKE_node.h:1204
#define SH_NODE_BSDF_GLOSSY
Definition: BKE_node.h:1110
#define CMP_NODE_COMBINE_COLOR
Definition: BKE_node.h:1298
#define SH_NODE_VALTORGB
Definition: BKE_node.h:1082
#define SH_NODE_CURVE_RGB
Definition: BKE_node.h:1090
#define CMP_NODE_RGB
Definition: BKE_node.h:1197
#define CMP_NODE_MASK_BOX
Definition: BKE_node.h:1278
#define TEX_NODE_OUTPUT
Definition: BKE_node.h:1347
#define TEX_NODE_CURVE_TIME
Definition: BKE_node.h:1359
#define CMP_CRYPTOMATTE_SRC_RENDER
Definition: BKE_node.h:1331
#define SH_NODE_BSDF_GLASS
Definition: BKE_node.h:1111
struct bNodeSocketType NodeSocketTypeUndefined
Definition: node.cc:112
const bNodeInstanceKey NODE_INSTANCE_KEY_NONE
Definition: node.cc:3897
#define NODE_FRAME
Definition: BKE_node.h:985
#define SH_NODE_DISPLACEMENT
Definition: BKE_node.h:1168
#define CMP_NODE_SEPYCCA_LEGACY
Definition: BKE_node.h:1226
#define TEX_NODE_MATH
Definition: BKE_node.h:1351
#define NODE_TYPES_END
Definition: BKE_node.h:574
#define SH_NODE_BSDF_REFRACTION
Definition: BKE_node.h:1144
#define CMP_NODE_IMAGE
Definition: BKE_node.h:1215
#define TEX_NODE_PROC
Definition: BKE_node.h:1374
#define CMP_NODE_NORMAL
Definition: BKE_node.h:1202
#define SH_NODE_OUTPUT_LIGHT
Definition: BKE_node.h:1103
#define TEX_NODE_MIX_RGB
Definition: BKE_node.h:1352
#define TEX_NODE_VALTORGB
Definition: BKE_node.h:1354
#define TEX_NODE_CURVE_RGB
Definition: BKE_node.h:1356
void BKE_ntree_update_tag_node_property(struct bNodeTree *ntree, struct bNode *node)
#define BLI_assert(a)
Definition: BLI_assert.h:46
int BLI_findindex(const struct ListBase *listbase, const void *vlink) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
MINLINE float max_ffff(float a, float b, float c, float d)
MINLINE float min_ffff(float a, float b, float c, float d)
#define M_SQRT2
Definition: BLI_math_base.h:29
MINLINE void copy_v4_v4(float r[4], const float a[4])
MINLINE void copy_v2_v2(float r[2], const float a[2])
MINLINE void copy_v3_v3(float r[3], const float a[3])
void interp_v3_v3v3(float r[3], const float a[3], const float b[3], float t)
Definition: math_vector.c:29
void mid_v2_v2v2(float r[2], const float a[2], const float b[2])
Definition: math_vector.c:244
MINLINE void copy_v4_fl(float r[4], float f)
void BLI_rcti_init(struct rcti *rect, int xmin, int xmax, int ymin, int ymax)
Definition: rct.c:417
bool BLI_rctf_isect_pt(const struct rctf *rect, float x, float y)
size_t BLI_snprintf(char *__restrict dst, size_t maxncpy, const char *__restrict format,...) ATTR_NONNULL(1
unsigned char uchar
Definition: BLI_sys_types.h:70
unsigned int uint
Definition: BLI_sys_types.h:67
void BLI_thread_unlock(int type)
Definition: threads.cc:361
@ LOCK_DRAW_IMAGE
Definition: BLI_threads.h:67
void BLI_thread_lock(int type)
Definition: threads.cc:356
#define UNUSED(x)
#define ELEM(...)
#define IFACE_(msgid)
@ CUMA_DRAW_SAMPLE
@ IMA_SRC_MOVIE
@ IMA_SRC_GENERATED
@ IMA_SRC_SEQUENCE
@ IMA_TYPE_MULTILAYER
@ IMA_TYPE_COMPOSITE
#define NODE_FRAME_RESIZEABLE
@ CMP_NODE_COMBSEP_COLOR_YCC
#define NODE_LINK_VALID
#define NTREE_TEXTURE
#define NODE_LINK_DRAGGED
#define NTREE_GEOMETRY
#define SHD_PROJ_BOX
#define NTREE_COMPOSIT
#define NTREE_VIEWER_BORDER
#define NODE_LINK_TEMP_HIGHLIGHT
#define NODE_HIDDEN
@ SOCK_OUT
@ SOCK_HIDE_LABEL
@ SOCK_HIDE_VALUE
@ SOCK_MULTI_INPUT
@ SOCK_IN_USE
@ SOCK_COMPACT
@ SOCK_UNAVAIL
@ SOCK_DISPLAY_SHAPE_CIRCLE
@ SOCK_DISPLAY_SHAPE_DIAMOND
@ SOCK_INT
@ SOCK_TEXTURE
@ SOCK_VECTOR
@ SOCK_BOOLEAN
@ SOCK_MATERIAL
@ SOCK_FLOAT
@ SOCK_IMAGE
@ SOCK_COLLECTION
@ SOCK_OBJECT
@ SOCK_STRING
@ SOCK_RGBA
#define NODE_SELECT
#define NODE_LINKFLAG_HILITE
#define NODE_LINK_MUTED
Object is a sort of wrapper for general info.
#define R_IMF_IMTYPE_MULTILAYER
@ SN_OVERLAY_SHOW_WIRE_COLORS
@ SN_OVERLAY_SHOW_OVERLAYS
@ SNODE_BACKDRAW
@ SPACE_NODE
#define TEX_CLOUDS
#define TEX_BLEND
#define TEX_MINKOVSKY
#define TEX_BAND
#define TEX_DISTNOISE
#define TEX_STUCCI
#define TEX_RING
#define TEX_MUSGRAVE
#define TEX_MARBLE
#define TEX_MAGIC
#define TEX_WOOD
void DRW_draw_view(const struct bContext *C)
bool ED_node_is_compositor(struct SpaceNode *snode)
Definition: node_edit.cc:466
NodeBorder
Definition: ED_node.h:29
@ NODE_LEFT
Definition: ED_node.h:32
@ NODE_RIGHT
Definition: ED_node.h:33
@ NODE_BOTTOM
Definition: ED_node.h:31
@ NODE_TOP
Definition: ED_node.h:30
void ED_node_tree_propagate_change(const struct bContext *C, struct Main *bmain, struct bNodeTree *ntree)
#define REGION_DRAW_BACKDROP
Definition: ED_space_api.h:65
void ED_region_draw_cb_draw(const struct bContext *C, struct ARegion *region, int type)
GPUBatch
Definition: GPU_batch.h:78
#define GPU_batch_uniformbuf_bind(batch, name, ubo)
Definition: GPU_batch.h:159
void GPU_batch_program_set_builtin(GPUBatch *batch, eGPUBuiltinShader shader_id)
Definition: gpu_batch.cc:287
void GPU_batch_instbuf_set(GPUBatch *, GPUVertBuf *, bool own_vbo)
Definition: gpu_batch.cc:122
GPUBatch * GPU_batch_create_ex(GPUPrimType prim, GPUVertBuf *vert, GPUIndexBuf *elem, eGPUBatchFlag owns_flag)
Definition: gpu_batch.cc:43
void GPU_batch_draw(GPUBatch *batch)
Definition: gpu_batch.cc:223
@ GPU_BATCH_INVALID
Definition: GPU_batch.h:27
@ GPU_BATCH_OWNS_VBO
Definition: GPU_batch.h:30
void gpu_batch_presets_register(struct GPUBatch *preset_batch)
struct GPUFrameBuffer GPUFrameBuffer
void GPU_framebuffer_bind_no_srgb(GPUFrameBuffer *fb)
void GPU_framebuffer_restore(void)
GPUFrameBuffer * GPU_framebuffer_active_get(void)
void immUnbindProgram(void)
void immVertex2f(uint attr_id, float x, float y)
void immUniformThemeColor(int color_id)
void immBindBuiltinProgram(eGPUBuiltinShader shader_id)
GPUVertFormat * immVertexFormat(void)
void immUniformColor3f(float r, float g, float b)
void immBegin(GPUPrimType, uint vertex_len)
void immEnd(void)
_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 y
_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
void GPU_matrix_pop(void)
Definition: gpu_matrix.cc:126
void GPU_matrix_pop_projection(void)
Definition: gpu_matrix.cc:140
void GPU_matrix_push(void)
Definition: gpu_matrix.cc:119
void GPU_matrix_identity_set(void)
Definition: gpu_matrix.cc:168
void GPU_matrix_push_projection(void)
Definition: gpu_matrix.cc:133
@ GPU_PRIM_LINE_LOOP
Definition: GPU_primitive.h:23
@ GPU_PRIM_LINES
Definition: GPU_primitive.h:20
@ GPU_PRIM_TRI_STRIP
Definition: GPU_primitive.h:24
@ GPU_SHADER_2D_NODELINK_INST
Definition: GPU_shader.h:359
@ GPU_SHADER_2D_UNIFORM_COLOR
Definition: GPU_shader.h:201
@ GPU_SHADER_2D_NODELINK
Definition: GPU_shader.h:358
@ GPU_BLEND_NONE
Definition: GPU_state.h:60
@ GPU_BLEND_ALPHA
Definition: GPU_state.h:62
void GPU_blend(eGPUBlend blend)
Definition: gpu_state.cc:39
@ GPU_DEPTH_NONE
Definition: GPU_state.h:83
void GPU_depth_test(eGPUDepthTest test)
Definition: gpu_state.cc:65
struct GPUUniformBuf GPUUniformBuf
void GPU_uniformbuf_unbind(GPUUniformBuf *ubo)
GPUUniformBuf * GPU_uniformbuf_create_ex(size_t size, const void *data, const char *name)
void GPU_uniformbuf_free(GPUUniformBuf *ubo)
struct GPUVertBuf GPUVertBuf
void GPU_vertbuf_data_alloc(GPUVertBuf *, uint v_len)
void GPU_vertbuf_use(GPUVertBuf *)
GPUVertBuf * GPU_vertbuf_create_with_format_ex(const GPUVertFormat *, GPUUsageType)
GPU_INLINE void * GPU_vertbuf_raw_step(GPUVertBufRaw *a)
void GPU_vertbuf_data_len_set(GPUVertBuf *, uint v_len)
void GPU_vertbuf_attr_get_raw_data(GPUVertBuf *, uint a_idx, GPUVertBufRaw *access)
void GPU_vertbuf_attr_set(GPUVertBuf *, uint a_idx, uint v_idx, const void *data)
@ GPU_USAGE_STATIC
@ GPU_USAGE_STREAM
@ GPU_FETCH_FLOAT
@ GPU_FETCH_INT_TO_FLOAT_UNIT
@ GPU_FETCH_INT
uint GPU_vertformat_attr_add(GPUVertFormat *, const char *name, GPUVertCompType, uint comp_len, GPUVertFetchMode)
@ GPU_COMP_F32
@ GPU_COMP_U8
bool IMB_colormanagement_space_name_is_data(const char *name)
Contains defines and structs used throughout the imbuf module.
Group Output data from inside of a node group A color picker SH_NODE_MIX_RGB
in reality light always falls off quadratically Particle Retrieve the data of the particle that spawned the object for example to give variation to multiple instances of an object Point Retrieve information about points in a point cloud Retrieve the edges of an object as it appears to Cycles topology will always appear triangulated Convert a blackbody temperature to an RGB value Normal Generate a perturbed normal from an RGB normal map image Typically used for faking highly detailed surfaces Generate an OSL shader from a file or text data block Image Sample an image file as a texture Sky Generate a procedural sky texture Noise Generate fractal Perlin noise Wave Generate procedural bands or rings with noise TEX_VORONOI
Group Output data from inside of a node group A color picker Mix two input colors RGB to Convert a color s luminance to a grayscale value Generate a normal vector and a dot product Bright Control the brightness and contrast of the input color Vector Map an input vectors to used to fine tune the interpolation of the input Camera Retrieve information about the camera and how it relates to the current shading point s position Clamp a value between a minimum and a maximum Vector Perform vector math operation Invert a producing a negative Combine Generate a color from its and blue Hue Saturation Apply a color transformation in the HSV color model Specular Similar to the Principled BSDF node but uses the specular workflow instead of which functions by specifying the so the result may not be physically accurate SH_NODE_OUTPUT_WORLD
NODE_GROUP
Group Output data from inside of a node group A color picker Mix two input colors RGB to Convert a color s luminance to a grayscale value SH_NODE_NORMAL
in reality light always falls off quadratically Particle Retrieve the data of the particle that spawned the object for example to give variation to multiple instances of an object Point Retrieve information about points in a point cloud Retrieve the edges of an object as it appears to Cycles topology will always appear triangulated Convert a blackbody temperature to an RGB value Normal Generate a perturbed normal from an RGB normal map image Typically used for faking highly detailed surfaces Generate an OSL shader from a file or text data block Image Sample an image file as a texture Sky Generate a procedural sky texture Noise Generate fractal Perlin noise Wave Generate procedural bands or rings with noise Voronoi Generate Worley noise based on the distance to random points Typically used to generate textures such as or biological cells Brick Generate a procedural texture producing bricks Texture Retrieve multiple types of texture coordinates nTypically used as inputs for texture nodes Vector Convert a or normal between and object coordinate space Combine Create a color from its and value channels Color Retrieve a color or the default fallback if none is specified Separate Split a vector into its and Z components Generates normals with round corners and may slow down renders SH_NODE_VECTOR_DISPLACEMENT
Group Output data from inside of a node group A color picker Mix two input colors RGB to Convert a color s luminance to a grayscale value Generate a normal vector and a dot product Bright Control the brightness and contrast of the input color SH_NODE_CURVE_VEC
in reality light always falls off quadratically Particle Retrieve the data of the particle that spawned the object for example to give variation to multiple instances of an object Point Retrieve information about points in a point cloud Retrieve the edges of an object as it appears to Cycles topology will always appear triangulated Convert a blackbody temperature to an RGB value Normal Generate a perturbed normal from an RGB normal map image Typically used for faking highly detailed surfaces Generate an OSL shader from a file or text data block Image Sample an image file as a texture Sky Generate a procedural sky texture Noise Generate fractal Perlin noise Wave Generate procedural bands or rings with noise Voronoi Generate Worley noise based on the distance to random points Typically used to generate textures such as or biological cells Brick Generate a procedural texture producing bricks Texture Retrieve multiple types of texture coordinates nTypically used as inputs for texture nodes Vector Convert a or normal between and object coordinate space Combine Create a color from its and value channels Color Retrieve a color or the default fallback if none is specified Separate Split a vector into its and Z components Generates normals with round corners and may slow down renders Vector Displace the surface along an arbitrary direction White Return a random value or color based on an input seed SH_NODE_CURVE_FLOAT
in reality light always falls off quadratically Particle Retrieve the data of the particle that spawned the object for example to give variation to multiple instances of an object Point Retrieve information about points in a point cloud Retrieve the edges of an object as it appears to Cycles topology will always appear triangulated Convert a blackbody temperature to an RGB value Normal Generate a perturbed normal from an RGB normal map image Typically used for faking highly detailed surfaces Generate an OSL shader from a file or text data block Image Sample an image file as a texture Sky Generate a procedural sky texture Noise Generate fractal Perlin noise Wave Generate procedural bands or rings with noise Voronoi Generate Worley noise based on the distance to random points Typically used to generate textures such as or biological cells Brick Generate a procedural texture producing bricks Texture Retrieve multiple types of texture coordinates nTypically used as inputs for texture nodes Vector Convert a or normal between and object coordinate space Combine Create a color from its and value channels Color Retrieve a color or the default fallback if none is specified Separate Split a vector into its and Z components Generates normals with round corners and may slow down renders Vector Displace the surface along an arbitrary direction White Return a random value or color based on an input seed Float Map an input float to a curve and outputs a float value SH_NODE_SEPARATE_COLOR
in reality light always falls off quadratically Particle Retrieve the data of the particle that spawned the object for example to give variation to multiple instances of an object Point Retrieve information about points in a point cloud Retrieve the edges of an object as it appears to Cycles topology will always appear triangulated Convert a blackbody temperature to an RGB value Normal Generate a perturbed normal from an RGB normal map image Typically used for faking highly detailed surfaces Generate an OSL shader from a file or text data block SH_NODE_TEX_IMAGE
Group Output data from inside of a node group SH_NODE_RGB
@ PROP_DIRECTION
Definition: RNA_types.h:155
#define C
Definition: RandGen.cpp:25
void uiLayoutSetActive(uiLayout *layout, bool active)
uiBlock * uiLayoutGetBlock(uiLayout *layout)
@ UI_EMBOSS_NONE
Definition: UI_interface.h:109
@ UI_EMBOSS_PULLDOWN
Definition: UI_interface.h:110
void uiTemplateCurveMapping(uiLayout *layout, struct PointerRNA *ptr, const char *propname, int type, bool levels, bool brush, bool neg_slope, bool tone)
void uiLayoutSetEnabled(uiLayout *layout, bool enabled)
uiLayout * uiLayoutColumn(uiLayout *layout, bool align)
void uiItemL(uiLayout *layout, const char *name, int icon)
void uiTemplateCryptoPicker(uiLayout *layout, struct PointerRNA *ptr, const char *propname, int icon)
uiLayout * uiLayoutRow(uiLayout *layout, bool align)
@ UI_ITEM_R_EXPAND
@ UI_ITEM_R_SLIDER
void UI_block_emboss_set(uiBlock *block, eUIEmbossType emboss)
Definition: interface.cc:3629
#define UI_DPI_FAC
Definition: UI_interface.h:305
void uiItemR(uiLayout *layout, struct PointerRNA *ptr, const char *propname, int flag, const char *name, int icon)
void uiTemplateImage(uiLayout *layout, struct bContext *C, struct PointerRNA *ptr, const char *propname, struct PointerRNA *userptr, bool compact, bool multiview)
void uiItemO(uiLayout *layout, const char *name, int icon, const char *opname)
void uiLayoutSetContextPointer(uiLayout *layout, const char *name, struct PointerRNA *ptr)
uiLayout * uiLayoutSplit(uiLayout *layout, float percentage, bool align)
void uiTemplateIDBrowse(uiLayout *layout, struct bContext *C, struct PointerRNA *ptr, const char *propname, const char *newop, const char *openop, const char *unlinkop, int filter, const char *text)
void uiTemplateID(uiLayout *layout, const struct bContext *C, struct PointerRNA *ptr, const char *propname, const char *newop, const char *openop, const char *unlinkop, int filter, bool live_icon, const char *text)
void uiTemplateColorRamp(uiLayout *layout, struct PointerRNA *ptr, const char *propname, bool expand)
void uiTemplateColorPicker(uiLayout *layout, struct PointerRNA *ptr, const char *propname, bool value_slider, bool lock, bool lock_luminosity, bool cubic)
void uiTemplateComponentMenu(uiLayout *layout, struct PointerRNA *ptr, const char *propname, const char *name)
@ UI_TEMPLATE_ID_FILTER_ALL
int UI_GetThemeValueType(int colorid, int spacetype)
Definition: resources.c:1159
@ TH_WIRE
Definition: UI_resources.h:69
@ TH_EDGE_SELECT
Definition: UI_resources.h:85
@ TH_REDALERT
Definition: UI_resources.h:34
@ TH_NODE_CURVING
Definition: UI_resources.h:225
@ TH_SELECT
Definition: UI_resources.h:72
@ TH_WIRE_INNER
Definition: UI_resources.h:70
@ TH_ACTIVE
Definition: UI_resources.h:73
struct bTheme * UI_GetTheme(void)
Definition: resources.c:1067
void UI_GetThemeColor4fv(int colorid, float col[4])
Definition: resources.c:1173
volatile int lock
ATTR_WARN_UNUSED_RESULT const BMVert * v
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
Definition: btDbvt.cpp:52
unsigned int U
Definition: btGjkEpa3.h:78
#define sinf(x)
Definition: cuda/compat.h:102
#define cosf(x)
Definition: cuda/compat.h:101
OperationNode * node
Scene scene
#define LINK_RESOL
Definition: drawnode.cc:1686
void ED_node_sample_set(const float col[4])
Definition: drawnode.cc:154
#define ARROW_SIZE
Definition: drawnode.cc:1688
void ED_init_custom_node_type(bNodeType *UNUSED(ntype))
Definition: drawnode.cc:1175
#define NODELINK_GROUP_SIZE
Definition: drawnode.cc:1685
void ED_init_node_socket_type_virtual(bNodeSocketType *stype)
Definition: drawnode.cc:1490
static float _sample_col[4]
Definition: drawnode.cc:153
void ED_node_draw_snap(View2D *v2d, const float cent[2], float size, NodeBorder border, uint pos)
Definition: drawnode.cc:2177
#define DEFAULT_FLAGS
Definition: drawnode.cc:71
void ED_init_custom_node_socket_type(bNodeSocketType *stype)
Definition: drawnode.cc:1179
void ED_init_standard_node_socket_type(bNodeSocketType *stype)
Definition: drawnode.cc:1481
void ED_node_init_butfuncs()
Definition: drawnode.cc:1145
#define SAMPLE_FLT_ISNONE
Definition: drawnode.cc:151
#define LINK_WIDTH
Definition: drawnode.cc:1687
depth_tx normal_tx diffuse_light_tx specular_light_tx volume_light_tx environment_tx ambient_occlusion_tx aov_value_tx in_weight_img image(1, GPU_R32F, Qualifier::WRITE, ImageType::FLOAT_2D_ARRAY, "out_weight_img") .image(3
bNodeTree * ntree
uint pos
uint col
IconTextureDrawCall border
ccl_global KernelShaderEvalInput ccl_global float * output
ccl_global KernelShaderEvalInput * input
format
Definition: logImageCore.h:38
ccl_device_inline float3 exp(float3 v)
Definition: math_float3.h:392
#define fabsf(x)
Definition: metal/compat.h:219
static void node_buts_curvevec(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
Definition: drawnode.cc:139
static void node_buts_normal(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
Definition: drawnode.cc:185
static const float virtual_node_socket_color[4]
Definition: drawnode.cc:1186
static void node_shader_buts_tex_environment_ex(uiLayout *layout, bContext *C, PointerRNA *ptr)
Definition: drawnode.cc:434
static void node_socket_template_properties_update(bNodeType *ntype, bNodeSocketTemplate *stemp)
Definition: drawnode.cc:1078
static void node_buts_curvecol(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
Definition: drawnode.cc:166
static void node_composit_buts_image(uiLayout *layout, bContext *C, PointerRNA *ptr)
Definition: drawnode.cc:543
static void node_buts_frame_ex(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
Definition: drawnode.cc:285
static void node_buts_value(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
Definition: drawnode.cc:86
static void node_composit_buts_image_ex(uiLayout *layout, bContext *C, PointerRNA *ptr)
Definition: drawnode.cc:571
static const float std_node_socket_colors[][4]
Definition: drawnode.cc:1189
static void node_texture_buts_output(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
Definition: drawnode.cc:1000
static void node_socket_undefined_draw(bContext *UNUSED(C), uiLayout *layout, PointerRNA *UNUSED(ptr), PointerRNA *UNUSED(node_ptr), const char *UNUSED(text))
Definition: drawnode.cc:1104
static void node_buts_mix_rgb(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
Definition: drawnode.cc:111
GPUVertBufRaw dash_alpha_step
Definition: drawnode.cc:1713
static void std_node_socket_draw(bContext *C, uiLayout *layout, PointerRNA *ptr, PointerRNA *node_ptr, const char *text)
Definition: drawnode.cc:1285
static float mute_expand_axis[3][2]
Definition: drawnode.cc:1695
static void node_socket_undefined_interface_draw(bContext *UNUSED(C), uiLayout *layout, PointerRNA *UNUSED(ptr))
Definition: drawnode.cc:1124
static void node_texture_buts_image_ex(uiLayout *layout, bContext *C, PointerRNA *ptr)
Definition: drawnode.cc:991
static void node_composit_backdrop_boxmask(SpaceNode *snode, ImBuf *backdrop, bNode *node, int x, int y)
Definition: drawnode.cc:644
void node_draw_link_bezier(const bContext &C, const View2D &v2d, const SpaceNode &snode, const bNodeLink &link, const int th_col1, const int th_col2, const int th_col3, const bool selected)
Definition: drawnode.cc:1987
static void node_shader_buts_glossy(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
Definition: drawnode.cc:448
static void node_buts_colorramp(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
Definition: drawnode.cc:134
void node_geometry_add_attribute_search_button(const bContext &UNUSED(C), const bNode &node, PointerRNA &socket_ptr, uiLayout &layout)
static void node_texture_buts_combsep_color(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
Definition: drawnode.cc:1005
static void node_template_properties_update(bNodeType *ntype)
Definition: drawnode.cc:1088
void nodelink_batch_end(SpaceNode &snode)
Definition: drawnode.cc:1935
GPUVertBuf * inst_vbo
Definition: drawnode.cc:1701
static void node_composit_buts_huecorrect(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
Definition: drawnode.cc:581
GPUVertBufRaw p1_step
Definition: drawnode.cc:1708
static float arrow_expand_axis[3][2]
Definition: drawnode.cc:1693
static void node_buts_curvefloat(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
Definition: drawnode.cc:144
void node_socket_color_get(const bContext &C, const bNodeTree &ntree, PointerRNA &node_ptr, const bNodeSocket &sock, float r_color[4])
Definition: node_draw.cc:764
static void std_node_socket_interface_draw_color(bContext *UNUSED(C), PointerRNA *ptr, float *r_color)
Definition: drawnode.cc:1216
void node_draw_link(const bContext &C, const View2D &v2d, const SpaceNode &snode, const bNodeLink &link, const bool selected)
Definition: drawnode.cc:2124
static void nodelink_batch_reset()
Definition: drawnode.cc:1718
float2 node_link_calculate_multi_input_position(const float2 &socket_position, const int index, const int total_inputs)
Definition: node_edit.cc:104
static void node_draw_buttons_group(uiLayout *layout, bContext *C, PointerRNA *ptr)
Definition: drawnode.cc:279
static void node_buts_rgb(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
Definition: drawnode.cc:97
static void nodelink_batch_init()
Definition: drawnode.cc:1757
static void set_nodelink_vertex(GPUVertBuf *vbo, uint uv_id, uint pos_id, uint exp_id, uint v, const uchar uv[2], const float pos[2], const float exp[2])
Definition: drawnode.cc:1743
bool node_link_bezier_points(const View2D *v2d, const SpaceNode *snode, const bNodeLink &link, float coord_array[][2], const int resol)
Definition: drawnode.cc:1665
static void nodelink_batch_add_link(const SpaceNode &snode, const float2 &p0, const float2 &p1, const float2 &p2, const float2 &p3, int th_col1, int th_col2, int th_col3, const float start_color[4], const float end_color[4], bool drawarrow, bool drawmuted, float dim_factor, float thickness, float dash_factor, float dash_alpha)
Definition: drawnode.cc:1941
static char nodelink_get_color_id(int th_col)
Definition: drawnode.cc:1878
GPUVertBufRaw p2_step
Definition: drawnode.cc:1708
static void std_node_socket_draw_color(bContext *UNUSED(C), PointerRNA *ptr, PointerRNA *UNUSED(node_ptr), float *r_color)
Definition: drawnode.cc:1207
static struct blender::ed::space_node::@535 g_batch_link
static void node_composit_buts_combsep_color(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
Definition: drawnode.cc:602
GPUVertBufRaw end_color_step
Definition: drawnode.cc:1709
GPUVertBufRaw dim_factor_step
Definition: drawnode.cc:1710
void draw_nodespace_back_pix(const bContext &C, ARegion &region, SpaceNode &snode, bNodeInstanceKey parent_key)
Definition: drawnode.cc:1501
static void node_socket_undefined_interface_draw_color(bContext *UNUSED(C), PointerRNA *UNUSED(ptr), float *r_color)
Definition: drawnode.cc:1131
static void node_buts_math(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
Definition: drawnode.cc:211
static void node_composit_buts_ycc(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
Definition: drawnode.cc:597
float node_link_dim_factor(const View2D &v2d, const bNodeLink &link)
Definition: node_edit.cc:1301
GPUVertBufRaw thickness_step
Definition: drawnode.cc:1711
static void node_composit_buts_cryptomatte_legacy(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
Definition: drawnode.cc:734
static void node_buts_texture(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
Definition: drawnode.cc:196
static void node_shader_buts_tex_image_ex(uiLayout *layout, bContext *C, PointerRNA *ptr)
Definition: drawnode.cc:405
static void node_buts_output_shader(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
Definition: drawnode.cc:453
static void node_composit_set_butfunc(bNodeType *ntype)
Definition: drawnode.cc:810
static void node_socket_virtual_draw_color(bContext *UNUSED(C), PointerRNA *UNUSED(ptr), PointerRNA *UNUSED(node_ptr), float *r_color)
Definition: drawnode.cc:1471
NodeResizeDirection node_get_resize_direction(const bNode *node, const int x, const int y)
Definition: drawnode.cc:222
void nodelink_batch_start(SpaceNode &UNUSED(snode))
Definition: drawnode.cc:1930
static void node_texture_buts_image(uiLayout *layout, bContext *C, PointerRNA *ptr)
Definition: drawnode.cc:977
static float arrow_verts[3][2]
Definition: drawnode.cc:1692
static void node_socket_undefined_draw_color(bContext *UNUSED(C), PointerRNA *UNUSED(ptr), PointerRNA *UNUSED(node_ptr), float *r_color)
Definition: drawnode.cc:1113
GPUVertBufRaw dash_factor_step
Definition: drawnode.cc:1712
static void node_composit_backdrop_ellipsemask(SpaceNode *snode, ImBuf *backdrop, bNode *node, int x, int y)
Definition: drawnode.cc:689
GPUVertBufRaw muted_step
Definition: drawnode.cc:1709
static void node_texture_buts_proc(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
Definition: drawnode.cc:889
static void node_socket_button_label(bContext *UNUSED(C), uiLayout *layout, PointerRNA *UNUSED(ptr), PointerRNA *UNUSED(node_ptr), const char *text)
Definition: drawnode.cc:75
static void node_texture_buts_bricks(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
Definition: drawnode.cc:876
static void node_texture_set_butfunc(bNodeType *ntype)
Definition: drawnode.cc:1011
static void node_composit_buts_cryptomatte(uiLayout *layout, bContext *C, PointerRNA *ptr)
Definition: drawnode.cc:757
static void node_file_output_socket_draw(bContext *C, uiLayout *layout, PointerRNA *ptr, PointerRNA *node_ptr)
Definition: drawnode.cc:1227
static void nodelink_batch_draw(const SpaceNode &snode)
Definition: drawnode.cc:1895
static void node_composit_buts_cryptomatte_legacy_ex(uiLayout *layout, bContext *UNUSED(C), PointerRNA *UNUSED(ptr))
Definition: drawnode.cc:749
static void node_buts_image_user(uiLayout *layout, bContext *C, PointerRNA *ptr, PointerRNA *imaptr, PointerRNA *iuserptr, const bool show_layer_selection, const bool show_color_management)
Definition: drawnode.cc:306
static void node_shader_set_butfunc(bNodeType *ntype)
Definition: drawnode.cc:459
static void node_shader_buts_tex_environment(uiLayout *layout, bContext *C, PointerRNA *ptr)
Definition: drawnode.cc:411
GPUVertBufRaw p3_step
Definition: drawnode.cc:1708
static void node_property_update_default(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr)
Definition: drawnode.cc:1070
bool node_link_bezier_handles(const View2D *v2d, const SpaceNode *snode, const bNodeLink &link, float vec[4][2])
Definition: drawnode.cc:1587
static void node_buts_image_views(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr, PointerRNA *imaptr)
Definition: drawnode.cc:520
static void node_common_set_butfunc(bNodeType *ntype)
Definition: drawnode.cc:292
static void node_buts_combsep_color(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
Definition: drawnode.cc:217
static void node_shader_buts_displacement(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
Definition: drawnode.cc:443
GPUVertBufRaw colid_step
Definition: drawnode.cc:1709
GPUVertBufRaw start_color_step
Definition: drawnode.cc:1709
static void node_composit_backdrop_viewer(SpaceNode *snode, ImBuf *backdrop, bNode *node, int x, int y)
Definition: drawnode.cc:615
static float mute_verts[3][2]
Definition: drawnode.cc:1694
static void std_node_socket_interface_draw(bContext *UNUSED(C), uiLayout *layout, PointerRNA *ptr)
Definition: drawnode.cc:1427
GPUVertBufRaw p0_step
Definition: drawnode.cc:1708
static void node_shader_buts_tex_image(uiLayout *layout, bContext *C, PointerRNA *ptr)
Definition: drawnode.cc:374
static void node_buts_time(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
Definition: drawnode.cc:125
static bool socket_needs_attribute_search(bNode &node, bNodeSocket &socket)
Definition: drawnode.cc:1273
void split(const std::string &s, const char delim, std::vector< std::string > &tokens)
Definition: abc_util.cc:92
#define NODE_RESIZE_MARGIN
Definition: node_intern.hh:122
static void expand_id(BlendExpander *expander, ID *id)
Definition: readfile.c:4455
void RNA_pointer_create(ID *id, StructRNA *type, void *data, PointerRNA *r_ptr)
Definition: rna_access.c:136
PointerRNA RNA_pointer_get(PointerRNA *ptr, const char *name)
Definition: rna_access.c:5167
PropertyRNA * RNA_struct_find_property(PointerRNA *ptr, const char *identifier)
Definition: rna_access.c:717
PropertyRNA * RNA_struct_type_find_property(StructRNA *srna, const char *identifier)
Definition: rna_access.c:806
int RNA_property_enum_get(PointerRNA *ptr, PropertyRNA *prop)
Definition: rna_access.c:3402
bool RNA_boolean_get(PointerRNA *ptr, const char *name)
Definition: rna_access.c:4863
int RNA_enum_get(PointerRNA *ptr, const char *name)
Definition: rna_access.c:5004
bool RNA_property_enum_name(bContext *C, PointerRNA *ptr, PropertyRNA *prop, const int value, const char **name)
Definition: rna_access.c:1777
void RNA_def_property_update_runtime(PropertyRNA *prop, const void *func)
Definition: rna_define.c:2911
StructRNA * srna
Definition: RNA_types.h:766
Definition: DNA_ID.h:368
void * first
Definition: DNA_listBase.h:31
Definition: BKE_main.h:121
float4 colors[3]
float4 bezierPts[4]
void * data
Definition: RNA_types.h:38
struct ID * owner_id
Definition: RNA_types.h:36
struct RenderData r
SpaceNode_Runtime * runtime
struct bNodeTree * edittree
SpaceNodeOverlay overlay
struct bNodeTree * nodetree
short stype
short vn_distm
short type
unsigned int value
Compact definition of a node socket.
Definition: BKE_node.h:84
char identifier[64]
Definition: BKE_node.h:94
Defines a socket type.
Definition: BKE_node.h:143
void(* draw_color)(struct bContext *C, struct PointerRNA *ptr, struct PointerRNA *node_ptr, float *r_color)
Definition: BKE_node.h:154
void(* interface_draw_color)(struct bContext *C, struct PointerRNA *ptr, float *r_color)
Definition: BKE_node.h:160
void(* draw)(struct bContext *C, struct uiLayout *layout, struct PointerRNA *ptr, struct PointerRNA *node_ptr, const char *text)
Definition: BKE_node.h:149
void(* interface_draw)(struct bContext *C, struct uiLayout *layout, struct PointerRNA *ptr)
Definition: BKE_node.h:159
struct bNodeSocketType * typeinfo
short total_inputs
ListBase nodes
bNodeInstanceKey active_viewer_key
rctf viewer_border
Defines a node type.
Definition: BKE_node.h:226
ExtensionRNA rna_ext
Definition: BKE_node.h:341
int type
Definition: BKE_node.h:228
bNodeSocketTemplate * outputs
Definition: BKE_node.h:239
void(* draw_buttons_ex)(struct uiLayout *, struct bContext *C, struct PointerRNA *ptr)
Definition: BKE_node.h:246
void(* draw_buttons)(struct uiLayout *, struct bContext *C, struct PointerRNA *ptr)
Definition: BKE_node.h:244
bNodeSocketTemplate * inputs
Definition: BKE_node.h:239
void(* draw_backdrop)(struct SpaceNode *snode, struct ImBuf *backdrop, struct bNode *node, int x, int y)
Definition: BKE_node.h:249
short type
ThemeSpace space_node
float xmax
Definition: DNA_vec_types.h:69
float xmin
Definition: DNA_vec_types.h:69
float ymax
Definition: DNA_vec_types.h:70
float ymin
Definition: DNA_vec_types.h:70
PointerRNA * ptr
Definition: wm_files.c:3480
void wmOrtho2_region_pixelspace(const ARegion *region)
Definition: wm_subwindow.c:103