Blender  V2.93
BKE_node.h
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU General Public License
4  * as published by the Free Software Foundation; either version 2
5  * of the License, or (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software Foundation,
14  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15  *
16  * The Original Code is Copyright (C) 2005 Blender Foundation.
17  * All rights reserved.
18  */
19 
20 #pragma once
21 
26 #include "BLI_compiler_compat.h"
27 #include "BLI_ghash.h"
28 
29 #include "DNA_listBase.h"
30 
31 /* for FOREACH_NODETREE_BEGIN */
32 #include "DNA_node_types.h"
33 
34 #include "RNA_types.h"
35 
36 #ifdef __cplusplus
37 extern "C" {
38 #endif
39 
40 /* not very important, but the stack solver likes to know a maximum */
41 #define MAX_SOCKET 512
42 
43 struct ARegion;
44 struct BlendDataReader;
45 struct BlendExpander;
46 struct BlendLibReader;
47 struct BlendWriter;
50 struct CryptomatteSession;
51 struct FreestyleLineStyle;
52 struct GPUMaterial;
53 struct GPUNodeStack;
54 struct ID;
55 struct ImBuf;
56 struct ImageFormatData;
57 struct Light;
58 struct ListBase;
59 struct MTex;
60 struct Main;
61 struct Material;
62 struct PointerRNA;
63 struct RenderData;
64 struct Scene;
65 struct SpaceNode;
66 struct Tex;
67 struct World;
68 struct bContext;
69 struct bNode;
70 struct bNodeExecContext;
71 struct bNodeExecData;
72 struct bNodeInstanceHash;
73 struct bNodeLink;
74 struct bNodeSocket;
75 struct bNodeStack;
76 struct bNodeTree;
77 struct bNodeTreeExec;
78 struct bNodeTreeType;
79 struct uiLayout;
80 
81 /* -------------------------------------------------------------------- */
95 typedef struct bNodeSocketTemplate {
96  int type;
97  char name[64]; /* MAX_NAME */
98  float val1, val2, val3, val4; /* default alloc value for inputs */
99  float min, max;
100  int subtype; /* would use PropertySubType but this is a bad level include to use RNA */
101  int flag;
102 
103  /* after this line is used internal only */
104  struct bNodeSocket *sock; /* used to hold verified socket */
105  char identifier[64]; /* generated from name */
107 
108 /* Use `void *` for callbacks that require C++. This is rather ugly, but works well for now. This
109  * would not be necessary if we would use bNodeSocketType and bNodeType only in C++ code.
110  * However, achieving this requires quite a few changes currently. */
111 #ifdef __cplusplus
112 namespace blender {
113 namespace nodes {
114 class SocketMFNetworkBuilder;
115 class NodeMFNetworkBuilder;
116 class GeoNodeExecParams;
117 } // namespace nodes
118 namespace fn {
119 class CPPType;
120 class MFDataType;
121 } // namespace fn
122 } // namespace blender
123 
127 using SocketGetCPPValueFunction = void (*)(const struct bNodeSocket &socket, void *r_value);
129 
130 #else
136 #endif
137 
143 typedef struct bNodeSocketType {
144  char idname[64]; /* identifier name */
145 
146  void (*draw)(struct bContext *C,
147  struct uiLayout *layout,
148  struct PointerRNA *ptr,
149  struct PointerRNA *node_ptr,
150  const char *text);
151  void (*draw_color)(struct bContext *C,
152  struct PointerRNA *ptr,
153  struct PointerRNA *node_ptr,
154  float *r_color);
155 
156  void (*interface_draw)(struct bContext *C, struct uiLayout *layout, struct PointerRNA *ptr);
157  void (*interface_draw_color)(struct bContext *C, struct PointerRNA *ptr, float *r_color);
159  struct bNodeSocket *stemp,
160  struct StructRNA *data_srna);
162  struct bNodeSocket *stemp,
163  struct bNode *node,
164  struct bNodeSocket *sock,
165  const char *data_path);
167  struct bNodeSocket *stemp,
168  struct bNode *node,
169  struct bNodeSocket *sock,
170  const char *data_path);
172  struct bNodeSocket *stemp,
173  struct bNode *node,
174  struct bNodeSocket *sock);
175 
176  /* RNA integration */
179 
180  /* for standard socket types in C */
181  int type, subtype;
182 
183  /* When set, bNodeSocket->limit does not have any effect anymore. */
187 
188  /* Callback to free the socket type. */
189  void (*free_self)(struct bNodeSocketType *stype);
190 
191  /* Expands the socket into a multi-function node that outputs the socket value. */
193  /* Return the CPPType of this socket. */
195  /* Get the value of this socket in a generic way. */
198 
199 typedef void *(*NodeInitExecFunction)(struct bNodeExecContext *context,
200  struct bNode *node,
201  bNodeInstanceKey key);
202 typedef void (*NodeFreeExecFunction)(void *nodedata);
203 typedef void (*NodeExecFunction)(void *data,
204  int thread,
205  struct bNode *,
206  struct bNodeExecData *execdata,
207  struct bNodeStack **in,
208  struct bNodeStack **out);
209 typedef int (*NodeGPUExecFunction)(struct GPUMaterial *mat,
210  struct bNode *node,
211  struct bNodeExecData *execdata,
212  struct GPUNodeStack *in,
213  struct GPUNodeStack *out);
214 
221 typedef struct bNodeType {
222  void *next, *prev;
223 
224  char idname[64]; /* identifier name */
225  int type;
226 
227  char ui_name[64]; /* MAX_NAME */
228  char ui_description[256];
229  int ui_icon;
230 
233  short nclass, flag;
234 
235  /* templates for static sockets */
237 
238  char storagename[64]; /* struct name for DNA */
239 
240  /* Main draw function for the node */
241  void (*draw_nodetype)(const struct bContext *C,
242  struct ARegion *region,
243  struct SpaceNode *snode,
244  struct bNodeTree *ntree,
245  struct bNode *node,
246  bNodeInstanceKey key);
247  /* Updates the node geometry attributes according to internal state before actual drawing */
248  void (*draw_nodetype_prepare)(const struct bContext *C,
249  struct bNodeTree *ntree,
250  struct bNode *node);
251 
252  /* Draw the option buttons on the node */
253  void (*draw_buttons)(struct uiLayout *, struct bContext *C, struct PointerRNA *ptr);
254  /* Additional parameters in the side panel */
255  void (*draw_buttons_ex)(struct uiLayout *, struct bContext *C, struct PointerRNA *ptr);
256 
257  /* Additional drawing on backdrop */
258  void (*draw_backdrop)(
259  struct SpaceNode *snode, struct ImBuf *backdrop, struct bNode *node, int x, int y);
260 
265  void (*labelfunc)(struct bNodeTree *ntree, struct bNode *node, char *label, int maxlen);
267  int (*resize_area_func)(struct bNode *node, int x, int y);
269  int (*select_area_func)(struct bNode *node, int x, int y);
271  int (*tweak_area_func)(struct bNode *node, int x, int y);
272 
274  void (*updatefunc)(struct bNodeTree *ntree, struct bNode *node);
276  void (*group_update_func)(struct bNodeTree *ntree, struct bNode *node);
277 
279  void (*initfunc)(struct bNodeTree *ntree, struct bNode *node);
281  void (*freefunc)(struct bNode *node);
283  void (*copyfunc)(struct bNodeTree *dest_ntree,
284  struct bNode *dest_node,
285  const struct bNode *src_node);
286 
287  /* Registerable API callback versions, called in addition to C callbacks */
288  void (*initfunc_api)(const struct bContext *C, struct PointerRNA *ptr);
289  void (*freefunc_api)(struct PointerRNA *ptr);
290  void (*copyfunc_api)(struct PointerRNA *ptr, const struct bNode *src_node);
291 
301  bool (*poll)(struct bNodeType *ntype, struct bNodeTree *nodetree, const char **r_disabled_hint);
305  bool (*poll_instance)(struct bNode *node,
306  struct bNodeTree *nodetree,
307  const char **r_disabled_hint);
308 
309  /* optional handling of link insertion */
310  void (*insert_link)(struct bNodeTree *ntree, struct bNode *node, struct bNodeLink *link);
311  /* Update the internal links list, for muting and disconnect operators. */
312  void (*update_internal_links)(struct bNodeTree *, struct bNode *node);
313 
314  void (*free_self)(struct bNodeType *ntype);
315 
316  /* **** execution callbacks **** */
320  /* gpu */
322 
323  /* Expands the bNode into nodes in a multi-function network, which will be evaluated later on. */
325 
326  /* Execute a geometry node. */
328 
329  /* RNA integration */
332 
333 /* nodetype->nclass, for add-menu and themes */
334 #define NODE_CLASS_INPUT 0
335 #define NODE_CLASS_OUTPUT 1
336 #define NODE_CLASS_OP_COLOR 3
337 #define NODE_CLASS_OP_VECTOR 4
338 #define NODE_CLASS_OP_FILTER 5
339 #define NODE_CLASS_GROUP 6
340 // #define NODE_CLASS_FILE 7
341 #define NODE_CLASS_CONVERTOR 8
342 #define NODE_CLASS_MATTE 9
343 #define NODE_CLASS_DISTORT 10
344 // #define NODE_CLASS_OP_DYNAMIC 11 /* deprecated */
345 #define NODE_CLASS_PATTERN 12
346 #define NODE_CLASS_TEXTURE 13
347 // #define NODE_CLASS_EXECUTION 14
348 // #define NODE_CLASS_GETDATA 15
349 // #define NODE_CLASS_SETDATA 16
350 // #define NODE_CLASS_MATH 17
351 // #define NODE_CLASS_MATH_VECTOR 18
352 // #define NODE_CLASS_MATH_ROTATION 19
353 // #define NODE_CLASS_PARTICLES 25
354 // #define NODE_CLASS_TRANSFORM 30
355 // #define NODE_CLASS_COMBINE 31
356 #define NODE_CLASS_SCRIPT 32
357 #define NODE_CLASS_INTERFACE 33
358 #define NODE_CLASS_SHADER 40
359 #define NODE_CLASS_GEOMETRY 41
360 #define NODE_CLASS_ATTRIBUTE 42
361 #define NODE_CLASS_LAYOUT 100
362 
363 /* node resize directions */
364 #define NODE_RESIZE_TOP 1
365 #define NODE_RESIZE_BOTTOM 2
366 #define NODE_RESIZE_RIGHT 4
367 #define NODE_RESIZE_LEFT 8
368 
369 typedef enum eNodeSizePreset {
375 
376 struct bNodeTreeExec;
377 
378 typedef void (*bNodeClassCallback)(void *calldata, int nclass, const char *name);
379 typedef struct bNodeTreeType {
380  int type; /* type identifier */
381  char idname[64]; /* identifier name */
382 
383  char ui_name[64];
384  char ui_description[256];
385  int ui_icon;
386 
387  /* callbacks */
388  void (*free_cache)(struct bNodeTree *ntree);
389  void (*free_node_cache)(struct bNodeTree *ntree, struct bNode *node);
390  /* Iteration over all node classes. */
391  void (*foreach_nodeclass)(struct Scene *scene, void *calldata, bNodeClassCallback func);
392  /* Check visibility in the node editor */
393  bool (*poll)(const struct bContext *C, struct bNodeTreeType *ntreetype);
394  /* Select a node tree from the context */
395  void (*get_from_context)(const struct bContext *C,
396  struct bNodeTreeType *ntreetype,
397  struct bNodeTree **r_ntree,
398  struct ID **r_id,
399  struct ID **r_from);
400 
401  /* calls allowing threaded composite */
402  void (*localize)(struct bNodeTree *localtree, struct bNodeTree *ntree);
403  void (*local_sync)(struct bNodeTree *localtree, struct bNodeTree *ntree);
404  void (*local_merge)(struct Main *bmain, struct bNodeTree *localtree, struct bNodeTree *ntree);
405 
406  /* Tree update. Overrides nodetype->updatetreefunc! */
407  void (*update)(struct bNodeTree *ntree);
408 
409  bool (*validate_link)(struct bNodeTree *ntree, struct bNodeLink *link);
410 
411  void (*node_add_init)(struct bNodeTree *ntree, struct bNode *bnode);
412 
413  /* RNA integration */
416 
419 /* -------------------------------------------------------------------- */
423 struct bNodeTreeType *ntreeTypeFind(const char *idname);
424 void ntreeTypeAdd(struct bNodeTreeType *nt);
425 void ntreeTypeFreeLink(const struct bNodeTreeType *nt);
426 bool ntreeIsRegistered(struct bNodeTree *ntree);
427 struct GHashIterator *ntreeTypeGetIterator(void);
428 
429 /* helper macros for iterating over tree types */
430 #define NODE_TREE_TYPES_BEGIN(ntype) \
431  { \
432  GHashIterator *__node_tree_type_iter__ = ntreeTypeGetIterator(); \
433  for (; !BLI_ghashIterator_done(__node_tree_type_iter__); \
434  BLI_ghashIterator_step(__node_tree_type_iter__)) { \
435  bNodeTreeType *ntype = (bNodeTreeType *)BLI_ghashIterator_getValue(__node_tree_type_iter__);
436 
437 #define NODE_TREE_TYPES_END \
438  } \
439  BLI_ghashIterator_free(__node_tree_type_iter__); \
440  } \
441  (void)0
442 
443 void ntreeSetTypes(const struct bContext *C, struct bNodeTree *ntree);
444 
445 struct bNodeTree *ntreeAddTree(struct Main *bmain, const char *name, const char *idname);
446 
447 /* copy/free funcs, need to manage ID users */
448 void ntreeFreeTree(struct bNodeTree *ntree);
449 /* Free tree which is embedded into another datablock. */
452  struct Main *bmain,
453  const bool do_id_user);
454 struct bNodeTree *ntreeCopyTree(struct Main *bmain, const struct bNodeTree *ntree);
455 
456 struct bNodeTree **BKE_ntree_ptr_from_id(struct ID *id);
457 struct bNodeTree *ntreeFromID(struct ID *id);
458 
459 void ntreeFreeLocalNode(struct bNodeTree *ntree, struct bNode *node);
460 void ntreeFreeLocalTree(struct bNodeTree *ntree);
461 struct bNode *ntreeFindType(const struct bNodeTree *ntree, int type);
462 bool ntreeHasType(const struct bNodeTree *ntree, int type);
463 bool ntreeHasTree(const struct bNodeTree *ntree, const struct bNodeTree *lookup);
464 void ntreeUpdateTree(struct Main *main, struct bNodeTree *ntree);
465 void ntreeUpdateAllNew(struct Main *main);
466 void ntreeUpdateAllUsers(struct Main *main, struct ID *id);
467 
469  struct bNode ***r_deplist,
470  int *r_deplist_len);
471 
472 /* XXX old trees handle output flags automatically based on special output
473  * node types and last active selection.
474  * New tree types have a per-output socket flag to indicate the final output to use explicitly.
475  */
476 void ntreeSetOutput(struct bNodeTree *ntree);
477 
478 void ntreeFreeCache(struct bNodeTree *ntree);
479 
480 bool ntreeNodeExists(const struct bNodeTree *ntree, const struct bNode *testnode);
481 bool ntreeOutputExists(const struct bNode *node, const struct bNodeSocket *testsock);
482 void ntreeNodeFlagSet(const bNodeTree *ntree, const int flag, const bool enable);
483 struct bNodeTree *ntreeLocalize(struct bNodeTree *ntree);
484 void ntreeLocalSync(struct bNodeTree *localtree, struct bNodeTree *ntree);
485 void ntreeLocalMerge(struct Main *bmain, struct bNodeTree *localtree, struct bNodeTree *ntree);
486 
487 void ntreeBlendWrite(struct BlendWriter *writer, struct bNodeTree *ntree);
488 void ntreeBlendReadData(struct BlendDataReader *reader, struct bNodeTree *ntree);
489 void ntreeBlendReadLib(struct BlendLibReader *reader, struct bNodeTree *ntree);
490 void ntreeBlendReadExpand(struct BlendExpander *expander, struct bNodeTree *ntree);
491 
494 /* -------------------------------------------------------------------- */
499  const char *identifier);
502  const char *idname,
503  const char *name);
506  const char *idname,
507  struct bNodeSocket *next_sock,
508  const char *name);
510  struct bNode *from_node,
511  struct bNodeSocket *from_sock);
513  struct bNodeSocket *next_sock,
514  struct bNode *from_node,
515  struct bNodeSocket *from_sock);
516 void ntreeRemoveSocketInterface(struct bNodeTree *ntree, struct bNodeSocket *sock);
517 
518 struct StructRNA *ntreeInterfaceTypeGet(struct bNodeTree *ntree, bool create);
521 
524 /* -------------------------------------------------------------------- */
528 struct bNodeType *nodeTypeFind(const char *idname);
529 void nodeRegisterType(struct bNodeType *ntype);
530 void nodeUnregisterType(struct bNodeType *ntype);
531 bool nodeTypeUndefined(struct bNode *node);
532 struct GHashIterator *nodeTypeGetIterator(void);
533 
534 /* helper macros for iterating over node types */
535 #define NODE_TYPES_BEGIN(ntype) \
536  { \
537  GHashIterator *__node_type_iter__ = nodeTypeGetIterator(); \
538  for (; !BLI_ghashIterator_done(__node_type_iter__); \
539  BLI_ghashIterator_step(__node_type_iter__)) { \
540  bNodeType *ntype = (bNodeType *)BLI_ghashIterator_getValue(__node_type_iter__);
541 
542 #define NODE_TYPES_END \
543  } \
544  BLI_ghashIterator_free(__node_type_iter__); \
545  } \
546  ((void)0)
547 
548 struct bNodeSocketType *nodeSocketTypeFind(const char *idname);
549 void nodeRegisterSocketType(struct bNodeSocketType *stype);
550 void nodeUnregisterSocketType(struct bNodeSocketType *stype);
551 bool nodeSocketIsRegistered(struct bNodeSocket *sock);
553 const char *nodeStaticSocketType(int type, int subtype);
554 const char *nodeStaticSocketInterfaceType(int type, int subtype);
555 
556 /* helper macros for iterating over node types */
557 #define NODE_SOCKET_TYPES_BEGIN(stype) \
558  { \
559  GHashIterator *__node_socket_type_iter__ = nodeSocketTypeGetIterator(); \
560  for (; !BLI_ghashIterator_done(__node_socket_type_iter__); \
561  BLI_ghashIterator_step(__node_socket_type_iter__)) { \
562  bNodeSocketType *stype = (bNodeSocketType *)BLI_ghashIterator_getValue( \
563  __node_socket_type_iter__);
564 
565 #define NODE_SOCKET_TYPES_END \
566  } \
567  BLI_ghashIterator_free(__node_socket_type_iter__); \
568  } \
569  ((void)0)
570 
571 struct bNodeSocket *nodeFindSocket(const struct bNode *node,
573  const char *identifier);
574 struct bNodeSocket *nodeAddSocket(struct bNodeTree *ntree,
575  struct bNode *node,
577  const char *idname,
578  const char *identifier,
579  const char *name);
581  struct bNode *node,
583  const char *idname,
584  struct bNodeSocket *next_sock,
585  const char *identifier,
586  const char *name);
588  struct bNode *node,
590  int type,
591  int subtype,
592  const char *identifier,
593  const char *name);
595  struct bNode *node,
597  int type,
598  int subtype,
599  struct bNodeSocket *next_sock,
600  const char *identifier,
601  const char *name);
602 void nodeRemoveSocket(struct bNodeTree *ntree, struct bNode *node, struct bNodeSocket *sock);
603 void nodeRemoveAllSockets(struct bNodeTree *ntree, struct bNode *node);
605  struct bNodeTree *ntree, struct bNode *node, struct bNodeSocket *sock, int type, int subtype);
606 
607 struct bNode *nodeAddNode(const struct bContext *C, struct bNodeTree *ntree, const char *idname);
608 struct bNode *nodeAddStaticNode(const struct bContext *C, struct bNodeTree *ntree, int type);
609 void nodeUnlinkNode(struct bNodeTree *ntree, struct bNode *node);
610 void nodeUniqueName(struct bNodeTree *ntree, struct bNode *node);
611 
612 /* Delete node, associated animation data and ID user count. */
613 void nodeRemoveNode(struct Main *bmain,
614  struct bNodeTree *ntree,
615  struct bNode *node,
616  bool do_id_user);
617 
619  const struct bNode *node_src,
620  const int flag,
621  const bool unique_name);
622 
623 /* Same as BKE_node_copy_ex() but stores pointers to a new node and its sockets in the source
624  * node.
625  *
626  * NOTE: DANGER ZONE!
627  *
628  * TODO(sergey): Maybe it's better to make BKE_node_copy_ex() return a mapping from old node and
629  * sockets to new one. */
631  struct bNode *node_src,
632  const int flag);
634  struct Main *bmain,
635  const bool do_id_user);
636 
637 struct bNodeLink *nodeAddLink(struct bNodeTree *ntree,
638  struct bNode *fromnode,
639  struct bNodeSocket *fromsock,
640  struct bNode *tonode,
641  struct bNodeSocket *tosock);
642 void nodeRemLink(struct bNodeTree *ntree, struct bNodeLink *link);
643 void nodeRemSocketLinks(struct bNodeTree *ntree, struct bNodeSocket *sock);
644 void nodeMuteLinkToggle(struct bNodeTree *ntree, struct bNodeLink *link);
645 bool nodeLinkIsHidden(const struct bNodeLink *link);
646 void nodeInternalRelink(struct bNodeTree *ntree, struct bNode *node);
647 
648 void nodeToView(const struct bNode *node, float x, float y, float *rx, float *ry);
649 void nodeFromView(const struct bNode *node, float x, float y, float *rx, float *ry);
650 bool nodeAttachNodeCheck(const struct bNode *node, const struct bNode *parent);
651 void nodeAttachNode(struct bNode *node, struct bNode *parent);
652 void nodeDetachNode(struct bNode *node);
653 
654 void nodePositionRelative(struct bNode *from_node,
655  struct bNode *to_node,
656  struct bNodeSocket *from_sock,
657  struct bNodeSocket *to_sock);
658 void nodePositionPropagate(struct bNode *node);
659 
660 struct bNode *nodeFindNodebyName(struct bNodeTree *ntree, const char *name);
661 bool nodeFindNode(struct bNodeTree *ntree,
662  struct bNodeSocket *sock,
663  struct bNode **r_node,
664  int *r_sockindex);
666 
667 bool nodeIsChildOf(const bNode *parent, const bNode *child);
668 
669 void nodeChainIter(const bNodeTree *ntree,
670  const bNode *node_start,
671  bool (*callback)(bNode *, bNode *, void *, const bool),
672  void *userdata,
673  const bool reversed);
675  const bNode *node_start,
676  bool (*callback)(bNode *, bNode *, void *),
677  void *userdata,
678  int recursion_lvl);
679 void nodeParentsIter(bNode *node, bool (*callback)(bNode *, void *), void *userdata);
680 
682  const struct bNodeSocket *from,
683  const struct bNodeSocket *to);
684 int nodeCountSocketLinks(const struct bNodeTree *ntree, const struct bNodeSocket *sock);
685 
686 void nodeSetSelected(struct bNode *node, bool select);
687 void nodeSetActive(struct bNodeTree *ntree, struct bNode *node);
688 struct bNode *nodeGetActive(struct bNodeTree *ntree);
689 struct bNode *nodeGetActiveID(struct bNodeTree *ntree, short idtype);
690 bool nodeSetActiveID(struct bNodeTree *ntree, short idtype, struct ID *id);
691 void nodeClearActive(struct bNodeTree *ntree);
692 void nodeClearActiveID(struct bNodeTree *ntree, short idtype);
693 struct bNode *nodeGetActiveTexture(struct bNodeTree *ntree);
694 
695 void nodeUpdate(struct bNodeTree *ntree, struct bNode *node);
696 bool nodeUpdateID(struct bNodeTree *ntree, struct ID *id);
697 void nodeUpdateInternalLinks(struct bNodeTree *ntree, struct bNode *node);
698 
699 int nodeSocketIsHidden(const struct bNodeSocket *sock);
700 void ntreeTagUsedSockets(struct bNodeTree *ntree);
701 void nodeSetSocketAvailability(struct bNodeSocket *sock, bool is_available);
702 
703 int nodeSocketLinkLimit(const struct bNodeSocket *sock);
704 
705 /* Node Clipboard */
706 void BKE_node_clipboard_init(const struct bNodeTree *ntree);
707 void BKE_node_clipboard_clear(void);
708 void BKE_node_clipboard_free(void);
709 bool BKE_node_clipboard_validate(void);
711 void BKE_node_clipboard_add_link(struct bNodeLink *link);
712 const struct ListBase *BKE_node_clipboard_get_nodes(void);
713 const struct ListBase *BKE_node_clipboard_get_links(void);
715 
716 /* Node Instance Hash */
717 typedef struct bNodeInstanceHash {
718  GHash *ghash; /* XXX should be made a direct member, GHash allocation needs to support it */
720 
721 typedef void (*bNodeInstanceValueFP)(void *value);
722 
725 
727  const struct bNodeTree *ntree,
728  const struct bNode *node);
729 
735  bNodeInstanceKey key,
736  bNodeInstanceValueFP valfreefp);
741 
746  bNodeInstanceValueFP valfreefp);
747 
749 
751 {
752  return BLI_ghashIterator_new(hash->ghash);
753 }
756 {
757  BLI_ghashIterator_init(iter, hash->ghash);
758 }
760 {
762 }
765 {
767 }
769 {
770  return BLI_ghashIterator_getValue(iter);
771 }
773 {
775 }
777 {
778  return BLI_ghashIterator_done(iter);
779 }
780 
781 #define NODE_INSTANCE_HASH_ITER(iter_, hash_) \
782  for (BKE_node_instance_hash_iterator_init(&iter_, hash_); \
783  BKE_node_instance_hash_iterator_done(&iter_) == false; \
784  BKE_node_instance_hash_iterator_step(&iter_))
785 
786 /* Node Previews */
787 
788 bool BKE_node_preview_used(const struct bNode *node);
790  struct bNodeInstanceHash *previews, bNodeInstanceKey key, int xsize, int ysize, bool create);
792 void BKE_node_preview_free(struct bNodePreview *preview);
794  int xsize,
795  int ysize,
796  bool create_previews);
799 void BKE_node_preview_clear(struct bNodePreview *preview);
801 
802 void BKE_node_preview_sync_tree(struct bNodeTree *to_ntree, struct bNodeTree *from_ntree);
803 void BKE_node_preview_merge_tree(struct bNodeTree *to_ntree,
804  struct bNodeTree *from_ntree,
805  bool remove_old);
806 
808  struct bNodePreview *preview, const float col[4], int x, int y, bool do_manage);
809 
812 /* -------------------------------------------------------------------- */
816 void nodeLabel(struct bNodeTree *ntree, struct bNode *node, char *label, int maxlen);
817 const char *nodeSocketLabel(const struct bNodeSocket *sock);
818 
819 bool nodeGroupPoll(struct bNodeTree *nodetree,
820  struct bNodeTree *grouptree,
821  const char **r_disabled_hint);
822 
823 /* Init a new node type struct with default values and callbacks */
824 void node_type_base(struct bNodeType *ntype, int type, const char *name, short nclass, short flag);
826  struct bNodeType *ntype, const char *idname, const char *name, short nclass, short flag);
827 void node_type_socket_templates(struct bNodeType *ntype,
828  struct bNodeSocketTemplate *inputs,
829  struct bNodeSocketTemplate *outputs);
830 void node_type_size(struct bNodeType *ntype, int width, int minwidth, int maxwidth);
832 void node_type_init(struct bNodeType *ntype,
833  void (*initfunc)(struct bNodeTree *ntree, struct bNode *node));
834 void node_type_storage(struct bNodeType *ntype,
835  const char *storagename,
836  void (*freefunc)(struct bNode *node),
837  void (*copyfunc)(struct bNodeTree *dest_ntree,
838  struct bNode *dest_node,
839  const struct bNode *src_node));
841  struct bNodeType *ntype,
842  void (*labelfunc)(struct bNodeTree *ntree, struct bNode *, char *label, int maxlen));
843 void node_type_update(struct bNodeType *ntype,
844  void (*updatefunc)(struct bNodeTree *ntree, struct bNode *node));
845 void node_type_group_update(struct bNodeType *ntype,
846  void (*group_update_func)(struct bNodeTree *ntree,
847  struct bNode *node));
848 
849 void node_type_exec(struct bNodeType *ntype,
850  NodeInitExecFunction init_exec_fn,
851  NodeFreeExecFunction free_exec_fn,
852  NodeExecFunction exec_fn);
853 void node_type_gpu(struct bNodeType *ntype, NodeGPUExecFunction gpu_fn);
855  void (*update_internal_links)(struct bNodeTree *, struct bNode *));
856 
859 /* -------------------------------------------------------------------- */
864 
865 /* ************** COMMON NODES *************** */
866 
867 #define NODE_UNDEFINED -2 /* node type is not registered */
868 #define NODE_CUSTOM -1 /* for dynamically registered custom types */
869 #define NODE_GROUP 2
870 // #define NODE_FORLOOP 3 /* deprecated */
871 // #define NODE_WHILELOOP 4 /* deprecated */
872 #define NODE_FRAME 5
873 #define NODE_REROUTE 6
874 #define NODE_GROUP_INPUT 7
875 #define NODE_GROUP_OUTPUT 8
876 #define NODE_CUSTOM_GROUP 9
877 
878 void BKE_node_tree_unlink_id(ID *id, struct bNodeTree *ntree);
879 
882 /* -------------------------------------------------------------------- */
918 /* should be an opaque type, only for internal use by BKE_node_tree_iter_*** */
922  struct Material *mat;
924  struct Light *light;
925  struct World *world;
928 };
929 
930 void BKE_node_tree_iter_init(struct NodeTreeIterStore *ntreeiter, struct Main *bmain);
931 bool BKE_node_tree_iter_step(struct NodeTreeIterStore *ntreeiter,
932  struct bNodeTree **r_nodetree,
933  struct ID **r_id);
934 
935 #define FOREACH_NODETREE_BEGIN(bmain, _nodetree, _id) \
936  { \
937  struct NodeTreeIterStore _nstore; \
938  bNodeTree *_nodetree; \
939  ID *_id; \
940  /* avoid compiler warning about unused variables */ \
941  BKE_node_tree_iter_init(&_nstore, bmain); \
942  while (BKE_node_tree_iter_step(&_nstore, &_nodetree, &_id) == true) { \
943  if (_nodetree) {
944 
945 #define FOREACH_NODETREE_END \
946  } \
947  } \
948  } \
949  ((void)0)
952 /* -------------------------------------------------------------------- */
957  struct Scene *scene,
958  const int layer_index);
959 
960 /* -------------------------------------------------------------------- */
964 /* note: types are needed to restore callbacks, don't change values */
965 /* range 1 - 100 is reserved for common nodes */
966 /* using toolbox, we add node groups by assuming the values below
967  * don't exceed NODE_GROUP_MENU for now. */
968 
969 //#define SH_NODE_OUTPUT 1
970 
971 //#define SH_NODE_MATERIAL 100
972 #define SH_NODE_RGB 101
973 #define SH_NODE_VALUE 102
974 #define SH_NODE_MIX_RGB 103
975 #define SH_NODE_VALTORGB 104
976 #define SH_NODE_RGBTOBW 105
977 #define SH_NODE_SHADERTORGB 106
978 //#define SH_NODE_TEXTURE 106
979 #define SH_NODE_NORMAL 107
980 //#define SH_NODE_GEOMETRY 108
981 #define SH_NODE_MAPPING 109
982 #define SH_NODE_CURVE_VEC 110
983 #define SH_NODE_CURVE_RGB 111
984 #define SH_NODE_CAMERA 114
985 #define SH_NODE_MATH 115
986 #define SH_NODE_VECTOR_MATH 116
987 #define SH_NODE_SQUEEZE 117
988 //#define SH_NODE_MATERIAL_EXT 118
989 #define SH_NODE_INVERT 119
990 #define SH_NODE_SEPRGB 120
991 #define SH_NODE_COMBRGB 121
992 #define SH_NODE_HUE_SAT 122
993 #define NODE_DYNAMIC 123
994 
995 #define SH_NODE_OUTPUT_MATERIAL 124
996 #define SH_NODE_OUTPUT_WORLD 125
997 #define SH_NODE_OUTPUT_LIGHT 126
998 #define SH_NODE_FRESNEL 127
999 #define SH_NODE_MIX_SHADER 128
1000 #define SH_NODE_ATTRIBUTE 129
1001 #define SH_NODE_BACKGROUND 130
1002 #define SH_NODE_BSDF_ANISOTROPIC 131
1003 #define SH_NODE_BSDF_DIFFUSE 132
1004 #define SH_NODE_BSDF_GLOSSY 133
1005 #define SH_NODE_BSDF_GLASS 134
1006 #define SH_NODE_BSDF_TRANSLUCENT 137
1007 #define SH_NODE_BSDF_TRANSPARENT 138
1008 #define SH_NODE_BSDF_VELVET 139
1009 #define SH_NODE_EMISSION 140
1010 #define SH_NODE_NEW_GEOMETRY 141
1011 #define SH_NODE_LIGHT_PATH 142
1012 #define SH_NODE_TEX_IMAGE 143
1013 #define SH_NODE_TEX_SKY 145
1014 #define SH_NODE_TEX_GRADIENT 146
1015 #define SH_NODE_TEX_VORONOI 147
1016 #define SH_NODE_TEX_MAGIC 148
1017 #define SH_NODE_TEX_WAVE 149
1018 #define SH_NODE_TEX_NOISE 150
1019 #define SH_NODE_TEX_MUSGRAVE 152
1020 #define SH_NODE_TEX_COORD 155
1021 #define SH_NODE_ADD_SHADER 156
1022 #define SH_NODE_TEX_ENVIRONMENT 157
1023 // #define SH_NODE_OUTPUT_TEXTURE 158
1024 #define SH_NODE_HOLDOUT 159
1025 #define SH_NODE_LAYER_WEIGHT 160
1026 #define SH_NODE_VOLUME_ABSORPTION 161
1027 #define SH_NODE_VOLUME_SCATTER 162
1028 #define SH_NODE_GAMMA 163
1029 #define SH_NODE_TEX_CHECKER 164
1030 #define SH_NODE_BRIGHTCONTRAST 165
1031 #define SH_NODE_LIGHT_FALLOFF 166
1032 #define SH_NODE_OBJECT_INFO 167
1033 #define SH_NODE_PARTICLE_INFO 168
1034 #define SH_NODE_TEX_BRICK 169
1035 #define SH_NODE_BUMP 170
1036 #define SH_NODE_SCRIPT 171
1037 #define SH_NODE_AMBIENT_OCCLUSION 172
1038 #define SH_NODE_BSDF_REFRACTION 173
1039 #define SH_NODE_TANGENT 174
1040 #define SH_NODE_NORMAL_MAP 175
1041 #define SH_NODE_HAIR_INFO 176
1042 #define SH_NODE_SUBSURFACE_SCATTERING 177
1043 #define SH_NODE_WIREFRAME 178
1044 #define SH_NODE_BSDF_TOON 179
1045 #define SH_NODE_WAVELENGTH 180
1046 #define SH_NODE_BLACKBODY 181
1047 #define SH_NODE_VECT_TRANSFORM 182
1048 #define SH_NODE_SEPHSV 183
1049 #define SH_NODE_COMBHSV 184
1050 #define SH_NODE_BSDF_HAIR 185
1051 // #define SH_NODE_LAMP 186
1052 #define SH_NODE_UVMAP 187
1053 #define SH_NODE_SEPXYZ 188
1054 #define SH_NODE_COMBXYZ 189
1055 #define SH_NODE_OUTPUT_LINESTYLE 190
1056 #define SH_NODE_UVALONGSTROKE 191
1057 #define SH_NODE_TEX_POINTDENSITY 192
1058 #define SH_NODE_BSDF_PRINCIPLED 193
1059 #define SH_NODE_TEX_IES 194
1060 #define SH_NODE_EEVEE_SPECULAR 195
1061 #define SH_NODE_BEVEL 197
1062 #define SH_NODE_DISPLACEMENT 198
1063 #define SH_NODE_VECTOR_DISPLACEMENT 199
1064 #define SH_NODE_VOLUME_PRINCIPLED 200
1065 /* 201..700 occupied by other node types, continue from 701 */
1066 #define SH_NODE_BSDF_HAIR_PRINCIPLED 701
1067 #define SH_NODE_MAP_RANGE 702
1068 #define SH_NODE_CLAMP 703
1069 #define SH_NODE_TEX_WHITE_NOISE 704
1070 #define SH_NODE_VOLUME_INFO 705
1071 #define SH_NODE_VERTEX_COLOR 706
1072 #define SH_NODE_OUTPUT_AOV 707
1073 #define SH_NODE_VECTOR_ROTATE 708
1074 
1075 /* custom defines options for Material node */
1076 // #define SH_NODE_MAT_DIFF 1
1077 // #define SH_NODE_MAT_SPEC 2
1078 // #define SH_NODE_MAT_NEG 4
1079 
1080 /* API */
1081 
1084 struct bNode *ntreeShaderOutputNode(struct bNodeTree *ntree, int target);
1085 
1086 void ntreeGPUMaterialNodes(struct bNodeTree *localtree,
1087  struct GPUMaterial *mat,
1088  bool *has_surface_output,
1089  bool *has_volume_output);
1090 
1093 /* -------------------------------------------------------------------- */
1097 /* output socket defines */
1098 #define RRES_OUT_IMAGE 0
1099 #define RRES_OUT_ALPHA 1
1100 // #define RRES_OUT_Z 2
1101 // #define RRES_OUT_NORMAL 3
1102 // #define RRES_OUT_UV 4
1103 // #define RRES_OUT_VEC 5
1104 // #define RRES_OUT_RGBA 6
1105 #define RRES_OUT_DIFF 7
1106 // #define RRES_OUT_SPEC 8
1107 // #define RRES_OUT_SHADOW 9
1108 // #define RRES_OUT_AO 10
1109 // #define RRES_OUT_REFLECT 11
1110 // #define RRES_OUT_REFRACT 12
1111 // #define RRES_OUT_INDIRECT 13
1112 // #define RRES_OUT_INDEXOB 14
1113 // #define RRES_OUT_INDEXMA 15
1114 // #define RRES_OUT_MIST 16
1115 // #define RRES_OUT_EMIT 17
1116 // #define RRES_OUT_ENV 18
1117 // #define RRES_OUT_DIFF_DIRECT 19
1118 // #define RRES_OUT_DIFF_INDIRECT 20
1119 // #define RRES_OUT_DIFF_COLOR 21
1120 // #define RRES_OUT_GLOSSY_DIRECT 22
1121 // #define RRES_OUT_GLOSSY_INDIRECT 23
1122 // #define RRES_OUT_GLOSSY_COLOR 24
1123 // #define RRES_OUT_TRANSM_DIRECT 25
1124 // #define RRES_OUT_TRANSM_INDIRECT 26
1125 // #define RRES_OUT_TRANSM_COLOR 27
1126 // #define RRES_OUT_SUBSURFACE_DIRECT 28
1127 // #define RRES_OUT_SUBSURFACE_INDIRECT 29
1128 // #define RRES_OUT_SUBSURFACE_COLOR 30
1129 // #define RRES_OUT_DEBUG 31
1130 
1131 /* note: types are needed to restore callbacks, don't change values */
1132 #define CMP_NODE_VIEWER 201
1133 #define CMP_NODE_RGB 202
1134 #define CMP_NODE_VALUE 203
1135 #define CMP_NODE_MIX_RGB 204
1136 #define CMP_NODE_VALTORGB 205
1137 #define CMP_NODE_RGBTOBW 206
1138 #define CMP_NODE_NORMAL 207
1139 #define CMP_NODE_CURVE_VEC 208
1140 #define CMP_NODE_CURVE_RGB 209
1141 #define CMP_NODE_ALPHAOVER 210
1142 #define CMP_NODE_BLUR 211
1143 #define CMP_NODE_FILTER 212
1144 #define CMP_NODE_MAP_VALUE 213
1145 #define CMP_NODE_TIME 214
1146 #define CMP_NODE_VECBLUR 215
1147 #define CMP_NODE_SEPRGBA 216
1148 #define CMP_NODE_SEPHSVA 217
1149 #define CMP_NODE_SETALPHA 218
1150 #define CMP_NODE_HUE_SAT 219
1151 #define CMP_NODE_IMAGE 220
1152 #define CMP_NODE_R_LAYERS 221
1153 #define CMP_NODE_COMPOSITE 222
1154 #define CMP_NODE_OUTPUT_FILE 223
1155 #define CMP_NODE_TEXTURE 224
1156 #define CMP_NODE_TRANSLATE 225
1157 #define CMP_NODE_ZCOMBINE 226
1158 #define CMP_NODE_COMBRGBA 227
1159 #define CMP_NODE_DILATEERODE 228
1160 #define CMP_NODE_ROTATE 229
1161 #define CMP_NODE_SCALE 230
1162 #define CMP_NODE_SEPYCCA 231
1163 #define CMP_NODE_COMBYCCA 232
1164 #define CMP_NODE_SEPYUVA 233
1165 #define CMP_NODE_COMBYUVA 234
1166 #define CMP_NODE_DIFF_MATTE 235
1167 #define CMP_NODE_COLOR_SPILL 236
1168 #define CMP_NODE_CHROMA_MATTE 237
1169 #define CMP_NODE_CHANNEL_MATTE 238
1170 #define CMP_NODE_FLIP 239
1171 #define CMP_NODE_SPLITVIEWER 240
1172 // #define CMP_NODE_INDEX_MASK 241
1173 #define CMP_NODE_MAP_UV 242
1174 #define CMP_NODE_ID_MASK 243
1175 #define CMP_NODE_DEFOCUS 244
1176 #define CMP_NODE_DISPLACE 245
1177 #define CMP_NODE_COMBHSVA 246
1178 #define CMP_NODE_MATH 247
1179 #define CMP_NODE_LUMA_MATTE 248
1180 #define CMP_NODE_BRIGHTCONTRAST 249
1181 #define CMP_NODE_GAMMA 250
1182 #define CMP_NODE_INVERT 251
1183 #define CMP_NODE_NORMALIZE 252
1184 #define CMP_NODE_CROP 253
1185 #define CMP_NODE_DBLUR 254
1186 #define CMP_NODE_BILATERALBLUR 255
1187 #define CMP_NODE_PREMULKEY 256
1188 #define CMP_NODE_DIST_MATTE 257
1189 #define CMP_NODE_VIEW_LEVELS 258
1190 #define CMP_NODE_COLOR_MATTE 259
1191 #define CMP_NODE_COLORBALANCE 260
1192 #define CMP_NODE_HUECORRECT 261
1193 #define CMP_NODE_MOVIECLIP 262
1194 #define CMP_NODE_STABILIZE2D 263
1195 #define CMP_NODE_TRANSFORM 264
1196 #define CMP_NODE_MOVIEDISTORTION 265
1197 #define CMP_NODE_DOUBLEEDGEMASK 266
1198 #define CMP_NODE_OUTPUT_MULTI_FILE__DEPRECATED \
1199  267 /* DEPRECATED multi file node has been merged into regular CMP_NODE_OUTPUT_FILE */
1200 #define CMP_NODE_MASK 268
1201 #define CMP_NODE_KEYINGSCREEN 269
1202 #define CMP_NODE_KEYING 270
1203 #define CMP_NODE_TRACKPOS 271
1204 #define CMP_NODE_INPAINT 272
1205 #define CMP_NODE_DESPECKLE 273
1206 #define CMP_NODE_ANTIALIASING 274
1207 
1208 #define CMP_NODE_GLARE 301
1209 #define CMP_NODE_TONEMAP 302
1210 #define CMP_NODE_LENSDIST 303
1211 #define CMP_NODE_SUNBEAMS 304
1212 
1213 #define CMP_NODE_COLORCORRECTION 312
1214 #define CMP_NODE_MASK_BOX 313
1215 #define CMP_NODE_MASK_ELLIPSE 314
1216 #define CMP_NODE_BOKEHIMAGE 315
1217 #define CMP_NODE_BOKEHBLUR 316
1218 #define CMP_NODE_SWITCH 317
1219 #define CMP_NODE_PIXELATE 318
1220 
1221 #define CMP_NODE_MAP_RANGE 319
1222 #define CMP_NODE_PLANETRACKDEFORM 320
1223 #define CMP_NODE_CORNERPIN 321
1224 #define CMP_NODE_SWITCH_VIEW 322
1225 #define CMP_NODE_CRYPTOMATTE_LEGACY 323
1226 #define CMP_NODE_DENOISE 324
1227 #define CMP_NODE_EXPOSURE 325
1228 #define CMP_NODE_CRYPTOMATTE 326
1229 
1230 /* channel toggles */
1231 #define CMP_CHAN_RGB 1
1232 #define CMP_CHAN_A 2
1233 
1234 /* filter types */
1235 #define CMP_FILT_SOFT 0
1236 #define CMP_FILT_SHARP 1
1237 #define CMP_FILT_LAPLACE 2
1238 #define CMP_FILT_SOBEL 3
1239 #define CMP_FILT_PREWITT 4
1240 #define CMP_FILT_KIRSCH 5
1241 #define CMP_FILT_SHADOW 6
1242 
1243 /* scale node type, in custom1 */
1244 #define CMP_SCALE_RELATIVE 0
1245 #define CMP_SCALE_ABSOLUTE 1
1246 #define CMP_SCALE_SCENEPERCENT 2
1247 #define CMP_SCALE_RENDERPERCENT 3
1248 /* custom2 */
1249 #define CMP_SCALE_RENDERSIZE_FRAME_ASPECT (1 << 0)
1250 #define CMP_SCALE_RENDERSIZE_FRAME_CROP (1 << 1)
1251 
1252 /* track position node, in custom1 */
1253 #define CMP_TRACKPOS_ABSOLUTE 0
1254 #define CMP_TRACKPOS_RELATIVE_START 1
1255 #define CMP_TRACKPOS_RELATIVE_FRAME 2
1256 #define CMP_TRACKPOS_ABSOLUTE_FRAME 3
1257 
1258 /* Cryptomatte source. */
1259 #define CMP_CRYPTOMATTE_SRC_RENDER 0
1260 #define CMP_CRYPTOMATTE_SRC_IMAGE 1
1261 
1262 /* API */
1264  struct bNodeTree *ntree,
1265  struct RenderData *rd,
1266  int rendering,
1267  int do_previews,
1268  const struct ColorManagedViewSettings *view_settings,
1269  const struct ColorManagedDisplaySettings *display_settings,
1270  const char *view_name);
1271 void ntreeCompositTagRender(struct Scene *scene);
1274  struct Scene *scene,
1275  struct ViewLayer *view_layer,
1276  const char *name,
1278 void ntreeCompositClearTags(struct bNodeTree *ntree);
1279 
1281  struct bNode *node,
1282  const char *name,
1283  struct ImageFormatData *im_format);
1286  struct bNodeSocket *sock,
1287  const char *name);
1289  struct bNodeSocket *sock,
1290  const char *name);
1291 /* needed in do_versions */
1293  struct bNodeSocket *sock,
1294  const char defname[],
1295  char delim);
1297  struct bNodeSocket *sock,
1298  const char defname[],
1299  char delim);
1300 
1303 
1309  const bNode *node,
1310  char *r_prefix,
1311  size_t prefix_len);
1312 /* Update the runtime layer names with the cryptomatte layer names of the references
1313  * render layer or image. */
1316 
1319 /* -------------------------------------------------------------------- */
1323 struct TexResult;
1324 
1325 #define TEX_NODE_OUTPUT 401
1326 #define TEX_NODE_CHECKER 402
1327 #define TEX_NODE_TEXTURE 403
1328 #define TEX_NODE_BRICKS 404
1329 #define TEX_NODE_MATH 405
1330 #define TEX_NODE_MIX_RGB 406
1331 #define TEX_NODE_RGBTOBW 407
1332 #define TEX_NODE_VALTORGB 408
1333 #define TEX_NODE_IMAGE 409
1334 #define TEX_NODE_CURVE_RGB 410
1335 #define TEX_NODE_INVERT 411
1336 #define TEX_NODE_HUE_SAT 412
1337 #define TEX_NODE_CURVE_TIME 413
1338 #define TEX_NODE_ROTATE 414
1339 #define TEX_NODE_VIEWER 415
1340 #define TEX_NODE_TRANSLATE 416
1341 #define TEX_NODE_COORD 417
1342 #define TEX_NODE_DISTANCE 418
1343 #define TEX_NODE_COMPOSE 419
1344 #define TEX_NODE_DECOMPOSE 420
1345 #define TEX_NODE_VALTONOR 421
1346 #define TEX_NODE_SCALE 422
1347 #define TEX_NODE_AT 423
1348 
1349 /* 501-599 reserved. Use like this: TEX_NODE_PROC + TEX_CLOUDS, etc */
1350 #define TEX_NODE_PROC 500
1351 #define TEX_NODE_PROC_MAX 600
1352 
1353 /* API */
1354 void ntreeTexCheckCyclics(struct bNodeTree *ntree);
1355 
1357 void ntreeTexEndExecTree(struct bNodeTreeExec *exec);
1359  struct TexResult *target,
1360  const float co[3],
1361  float dxt[3],
1362  float dyt[3],
1363  int osatex,
1364  const short thread,
1365  const struct Tex *tex,
1366  short which_output,
1367  int cfra,
1368  int preview,
1369  struct MTex *mtex);
1372 /* -------------------------------------------------------------------- */
1376 #define GEO_NODE_TRIANGULATE 1000
1377 #define GEO_NODE_EDGE_SPLIT 1001
1378 #define GEO_NODE_TRANSFORM 1002
1379 #define GEO_NODE_BOOLEAN 1003
1380 #define GEO_NODE_POINT_DISTRIBUTE 1004
1381 #define GEO_NODE_POINT_INSTANCE 1005
1382 #define GEO_NODE_SUBDIVISION_SURFACE 1006
1383 #define GEO_NODE_OBJECT_INFO 1007
1384 #define GEO_NODE_ATTRIBUTE_RANDOMIZE 1008
1385 #define GEO_NODE_ATTRIBUTE_MATH 1009
1386 #define GEO_NODE_JOIN_GEOMETRY 1010
1387 #define GEO_NODE_ATTRIBUTE_FILL 1011
1388 #define GEO_NODE_ATTRIBUTE_MIX 1012
1389 #define GEO_NODE_ATTRIBUTE_COLOR_RAMP 1013
1390 #define GEO_NODE_POINT_SEPARATE 1014
1391 #define GEO_NODE_ATTRIBUTE_COMPARE 1015
1392 #define GEO_NODE_POINT_ROTATE 1016
1393 #define GEO_NODE_ATTRIBUTE_VECTOR_MATH 1017
1394 #define GEO_NODE_ALIGN_ROTATION_TO_VECTOR 1018
1395 #define GEO_NODE_POINT_TRANSLATE 1019
1396 #define GEO_NODE_POINT_SCALE 1020
1397 #define GEO_NODE_ATTRIBUTE_SAMPLE_TEXTURE 1021
1398 #define GEO_NODE_POINTS_TO_VOLUME 1022
1399 #define GEO_NODE_COLLECTION_INFO 1023
1400 #define GEO_NODE_IS_VIEWPORT 1024
1401 #define GEO_NODE_ATTRIBUTE_PROXIMITY 1025
1402 #define GEO_NODE_VOLUME_TO_MESH 1026
1403 #define GEO_NODE_ATTRIBUTE_COMBINE_XYZ 1027
1404 #define GEO_NODE_ATTRIBUTE_SEPARATE_XYZ 1028
1405 #define GEO_NODE_SUBDIVIDE 1029
1406 #define GEO_NODE_ATTRIBUTE_REMOVE 1030
1407 #define GEO_NODE_ATTRIBUTE_CONVERT 1031
1408 #define GEO_NODE_MESH_PRIMITIVE_CUBE 1032
1409 #define GEO_NODE_MESH_PRIMITIVE_CIRCLE 1033
1410 #define GEO_NODE_MESH_PRIMITIVE_UV_SPHERE 1034
1411 #define GEO_NODE_MESH_PRIMITIVE_CYLINDER 1035
1412 #define GEO_NODE_MESH_PRIMITIVE_ICO_SPHERE 1036
1413 #define GEO_NODE_MESH_PRIMITIVE_CONE 1037
1414 #define GEO_NODE_MESH_PRIMITIVE_LINE 1038
1415 #define GEO_NODE_MESH_PRIMITIVE_GRID 1039
1416 #define GEO_NODE_ATTRIBUTE_MAP_RANGE 1040
1417 #define GEO_NODE_ATTRIBUTE_CLAMP 1041
1418 #define GEO_NODE_BOUNDING_BOX 1042
1419 
1422 /* -------------------------------------------------------------------- */
1426 #define FN_NODE_BOOLEAN_MATH 1200
1427 #define FN_NODE_FLOAT_COMPARE 1202
1428 #define FN_NODE_RANDOM_FLOAT 1206
1429 #define FN_NODE_INPUT_VECTOR 1207
1430 #define FN_NODE_INPUT_STRING 1208
1431 
1434 void BKE_node_system_init(void);
1435 void BKE_node_system_exit(void);
1436 
1437 /* -------------------------------------------------------------------- */
1438 /* evaluation support, */
1439 
1440 struct Depsgraph;
1441 
1443  struct bNodeTree *ntree_dst,
1444  const struct bNodeTree *ntree_src);
1445 
1446 extern struct bNodeType NodeTypeUndefined;
1448 
1449 #ifdef __cplusplus
1450 }
1451 #endif
void node_type_gpu(struct bNodeType *ntype, NodeGPUExecFunction gpu_fn)
Definition: node.cc:4645
void nodeFromView(const struct bNode *node, float x, float y, float *rx, float *ry)
void ntreeTypeAdd(struct bNodeTreeType *nt)
Definition: node.cc:1219
void nodeSetSocketAvailability(struct bNodeSocket *sock, bool is_available)
Definition: node.cc:3726
void BKE_node_clipboard_init(const struct bNodeTree *ntree)
Definition: node.cc:3783
void *(* NodeInitExecFunction)(struct bNodeExecContext *context, struct bNode *node, bNodeInstanceKey key)
Definition: BKE_node.h:199
void nodeUniqueName(struct bNodeTree *ntree, struct bNode *node)
Definition: node.cc:1985
struct bNodeLink * nodeFindLink(struct bNodeTree *ntree, const struct bNodeSocket *from, const struct bNodeSocket *to)
void ntreeNodeFlagSet(const bNodeTree *ntree, const int flag, const bool enable)
Definition: node.cc:3173
struct bNodeTree * ntreeLocalize(struct bNodeTree *ntree)
Definition: node.cc:3186
BLI_INLINE void BKE_node_instance_hash_iterator_free(bNodeInstanceHashIterator *iter)
Definition: BKE_node.h:759
const struct ListBase * BKE_node_clipboard_get_links(void)
Definition: node.cc:3889
struct bNodeTree * ntreeFromID(struct ID *id)
Definition: node.cc:3147
bNodePreview * BKE_node_preview_verify(struct bNodeInstanceHash *previews, bNodeInstanceKey key, int xsize, int ysize, bool create)
Definition: node.cc:2580
void node_type_base(struct bNodeType *ntype, int type, const char *name, short nclass, short flag)
Definition: node.cc:4443
void BKE_node_preview_free(struct bNodePreview *preview)
Definition: node.cc:2627
struct CryptomatteSession * ntreeCompositCryptomatteSession(const Scene *scene, bNode *node)
struct GHashIterator * nodeSocketTypeGetIterator(void)
Definition: node.cc:1371
void BKE_node_clipboard_add_node(struct bNode *node)
Definition: node.cc:3849
bool ntreeOutputExists(const struct bNode *node, const struct bNodeSocket *testsock)
void nodeRegisterSocketType(struct bNodeSocketType *stype)
Definition: node.cc:1352
void ntreeTagUsedSockets(struct bNodeTree *ntree)
Definition: node.cc:4149
void node_type_size(struct bNodeType *ntype, int width, int minwidth, int maxwidth)
Definition: node.cc:4565
bool nodeLinkIsHidden(const struct bNodeLink *link)
void nodeClearActiveID(struct bNodeTree *ntree, short idtype)
Definition: node.cc:3651
bool nodeTypeUndefined(struct bNode *node)
Definition: node.cc:1316
struct bNodeSocket * ntreeInsertSocketInterfaceFromSocket(struct bNodeTree *ntree, struct bNodeSocket *next_sock, struct bNode *from_node, struct bNodeSocket *from_sock)
Definition: node.cc:3351
bool nodeAttachNodeCheck(const struct bNode *node, const struct bNode *parent)
void ntreeTexEndExecTree(struct bNodeTreeExec *exec)
bNodeInstanceHash * BKE_node_instance_hash_new(const char *info)
Definition: node.cc:3955
struct bNodeSocket * nodeAddSocket(struct bNodeTree *ntree, struct bNode *node, eNodeSocketInOut in_out, const char *idname, const char *identifier, const char *name)
Definition: node.cc:1533
void BKE_node_tree_unlink_id(ID *id, struct bNodeTree *ntree)
Definition: node_common.c:411
void BKE_node_preview_sync_tree(struct bNodeTree *to_ntree, struct bNodeTree *from_ntree)
Definition: node.cc:2749
void nodeInternalRelink(struct bNodeTree *ntree, struct bNode *node)
Definition: node.cc:2364
void node_type_socket_templates(struct bNodeType *ntype, struct bNodeSocketTemplate *inputs, struct bNodeSocketTemplate *outputs)
Definition: node.cc:4527
struct bNode * ntreeFindType(const struct bNodeTree *ntree, int type)
bool nodeGroupPoll(struct bNodeTree *nodetree, struct bNodeTree *grouptree, const char **r_disabled_hint)
Definition: node_common.c:96
void ntreeBlendWrite(struct BlendWriter *writer, struct bNodeTree *ntree)
Definition: node.cc:472
const bNodeInstanceKey NODE_INSTANCE_KEY_BASE
Definition: node.cc:3908
void nodeRemSocketLinks(struct bNodeTree *ntree, struct bNodeSocket *sock)
Definition: node.cc:2348
void ntreeBlendReadData(struct BlendDataReader *reader, struct bNodeTree *ntree)
Definition: node.cc:626
BLI_INLINE bNodeInstanceKey BKE_node_instance_hash_iterator_get_key(bNodeInstanceHashIterator *iter)
Definition: BKE_node.h:764
void node_type_update(struct bNodeType *ntype, void(*updatefunc)(struct bNodeTree *ntree, struct bNode *node))
Definition: node.cc:4623
void ntreeCompositColorBalanceSyncFromCDL(bNodeTree *ntree, bNode *node)
struct bNodeTreeType * ntreeTypeFind(const char *idname)
Definition: node.cc:1207
void * NodeGeometryExecFunction
Definition: BKE_node.h:133
void BKE_node_preview_clear_tree(struct bNodeTree *ntree)
Definition: node.cc:2723
struct bNodeType NodeTypeUndefined
Definition: node.cc:98
void ntreeLocalSync(struct bNodeTree *localtree, struct bNodeTree *ntree)
Definition: node.cc:3227
bool ntreeHasTree(const struct bNodeTree *ntree, const struct bNodeTree *lookup)
struct bNodeTreeExec * ntreeShaderBeginExecTree(struct bNodeTree *ntree)
void ntreeBlendReadLib(struct BlendLibReader *reader, struct bNodeTree *ntree)
Definition: node.cc:828
bool nodeIsChildOf(const bNode *parent, const bNode *child)
Definition: node.cc:1861
void ntreeFreeLocalNode(struct bNodeTree *ntree, struct bNode *node)
Definition: node.cc:2925
void BKE_node_instance_hash_insert(bNodeInstanceHash *hash, bNodeInstanceKey key, void *value)
Definition: node.cc:3969
void BKE_node_tree_iter_init(struct NodeTreeIterStore *ntreeiter, struct Main *bmain)
Definition: node.cc:5075
void ntreeCompositTagRender(struct Scene *scene)
struct StructRNA * ntreeInterfaceTypeGet(struct bNodeTree *ntree, bool create)
Definition: node.cc:3450
int ntreeTexExecTree(struct bNodeTree *ntree, struct TexResult *target, const float co[3], float dxt[3], float dyt[3], int osatex, const short thread, const struct Tex *tex, short which_output, int cfra, int preview, struct MTex *mtex)
void BKE_node_preview_remove_unused(struct bNodeTree *ntree)
Definition: node.cc:2690
bNodePreview * BKE_node_preview_copy(struct bNodePreview *preview)
Definition: node.cc:2618
int ntreeCompositOutputFileRemoveActiveSocket(struct bNodeTree *ntree, struct bNode *node)
void ntreeCompositColorBalanceSyncFromLGG(bNodeTree *ntree, bNode *node)
void nodeChainIter(const bNodeTree *ntree, const bNode *node_start, bool(*callback)(bNode *, bNode *, void *, const bool), void *userdata, const bool reversed)
Definition: node.cc:1879
void(* bNodeInstanceValueFP)(void *value)
Definition: BKE_node.h:721
void(* bNodeClassCallback)(void *calldata, int nclass, const char *name)
Definition: BKE_node.h:378
const struct ListBase * BKE_node_clipboard_get_nodes(void)
Definition: node.cc:3884
void node_type_base_custom(struct bNodeType *ntype, const char *idname, const char *name, short nclass, short flag)
Definition: node.cc:4478
void ntreeCompositUpdateRLayers(struct bNodeTree *ntree)
void BKE_node_preview_free_tree(struct bNodeTree *ntree)
Definition: node.cc:2704
BLI_INLINE void * BKE_node_instance_hash_iterator_get_value(bNodeInstanceHashIterator *iter)
Definition: BKE_node.h:768
void(* NodeExecFunction)(void *data, int thread, struct bNode *, struct bNodeExecData *execdata, struct bNodeStack **in, struct bNodeStack **out)
Definition: BKE_node.h:203
struct bNode * ntreeShaderOutputNode(struct bNodeTree *ntree, int target)
void ntreeFreeCache(struct bNodeTree *ntree)
Definition: node.cc:3039
struct bNodeSocketType bNodeSocketType
Defines a socket type.
BLI_INLINE void BKE_node_instance_hash_iterator_init(bNodeInstanceHashIterator *iter, bNodeInstanceHash *hash)
Definition: BKE_node.h:754
struct GHashIterator * ntreeTypeGetIterator(void)
Definition: node.cc:1249
void nodeUpdate(struct bNodeTree *ntree, struct bNode *node)
Definition: node.cc:4326
void ntreeRemoveSocketInterface(struct bNodeTree *ntree, struct bNodeSocket *sock)
Definition: node.cc:3370
void ntreeCompositExecTree(struct Scene *scene, struct bNodeTree *ntree, struct RenderData *rd, int rendering, int do_previews, const struct ColorManagedViewSettings *view_settings, const struct ColorManagedDisplaySettings *display_settings, const char *view_name)
void(* NodeFreeExecFunction)(void *nodedata)
Definition: BKE_node.h:202
struct bNodeTree * ntreeCopyTree_ex(const struct bNodeTree *ntree, struct Main *bmain, const bool do_id_user)
void BKE_node_preview_set_pixel(struct bNodePreview *preview, const float col[4], int x, int y, bool do_manage)
Definition: node.cc:2809
void nodePositionPropagate(struct bNode *node)
Definition: node.cc:2518
void ntreeFreeTree(struct bNodeTree *ntree)
Definition: node.cc:3015
void nodeAttachNode(struct bNode *node, struct bNode *parent)
Definition: node.cc:2449
struct bNode * nodeFindNodebyName(struct bNodeTree *ntree, const char *name)
Definition: node.cc:1817
void ntreeInterfaceTypeFree(struct bNodeTree *ntree)
Definition: node.cc:3484
void ntreeCompositCryptomatteLayerPrefix(const Scene *scene, const bNode *node, char *r_prefix, size_t prefix_len)
void node_type_init(struct bNodeType *ntype, void(*initfunc)(struct bNodeTree *ntree, struct bNode *node))
Definition: node.cc:4559
int BKE_node_instance_hash_remove(bNodeInstanceHash *hash, bNodeInstanceKey key, bNodeInstanceValueFP valfreefp)
Definition: node.cc:3982
void ntreeCompositOutputFileUniqueLayer(struct ListBase *list, struct bNodeSocket *sock, const char defname[], char delim)
void * SocketGetCPPValueFunction
Definition: BKE_node.h:135
void nodeRemoveAllSockets(struct bNodeTree *ntree, struct bNode *node)
Definition: node.cc:1793
struct bNode * nodeGetActive(struct bNodeTree *ntree)
Definition: node.cc:3561
void nodeRemLink(struct bNodeTree *ntree, struct bNodeLink *link)
Definition: node.cc:2231
int nodeSocketIsHidden(const struct bNodeSocket *sock)
bool nodeUpdateID(struct bNodeTree *ntree, struct ID *id)
Definition: node.cc:4346
BLI_INLINE bool BKE_node_instance_hash_iterator_done(bNodeInstanceHashIterator *iter)
Definition: BKE_node.h:776
void BKE_node_system_exit(void)
Definition: node.cc:5030
struct bNodeSocket * nodeAddStaticSocket(struct bNodeTree *ntree, struct bNode *node, eNodeSocketInOut in_out, int type, int subtype, const char *identifier, const char *name)
Definition: node.cc:1716
void node_type_size_preset(struct bNodeType *ntype, eNodeSizePreset size)
Definition: node.cc:4577
struct bNode * BKE_node_copy_ex(struct bNodeTree *ntree, const struct bNode *node_src, const int flag, const bool unique_name)
void ntreeCompositOutputFileUniquePath(struct ListBase *list, struct bNodeSocket *sock, const char defname[], char delim)
struct bNodeSocket * ntreeAddSocketInterfaceFromSocket(struct bNodeTree *ntree, struct bNode *from_node, struct bNodeSocket *from_sock)
Definition: node.cc:3337
bool ntreeHasType(const struct bNodeTree *ntree, int type)
void nodeRemoveNode(struct Main *bmain, struct bNodeTree *ntree, struct bNode *node, bool do_id_user)
Definition: node.cc:2932
int BKE_node_clipboard_get_type(void)
Definition: node.cc:3894
struct bNodeSocket * ntreeCompositOutputFileAddSocket(struct bNodeTree *ntree, struct bNode *node, const char *name, struct ImageFormatData *im_format)
void nodeMuteLinkToggle(struct bNodeTree *ntree, struct bNodeLink *link)
Definition: node.cc:2325
void * BKE_node_instance_hash_pop(bNodeInstanceHash *hash, bNodeInstanceKey key)
Definition: node.cc:3994
int BKE_node_instance_hash_haskey(bNodeInstanceHash *hash, bNodeInstanceKey key)
Definition: node.cc:3999
void BKE_node_clipboard_add_link(struct bNodeLink *link)
Definition: node.cc:3879
struct bNodeType bNodeType
Defines a node type.
void ntreeInterfaceTypeUpdate(struct bNodeTree *ntree)
Definition: node.cc:3492
int ntreeCompositCryptomatteRemoveSocket(bNodeTree *ntree, bNode *node)
bool BKE_node_preview_used(const struct bNode *node)
void nodeLabel(struct bNodeTree *ntree, struct bNode *node, char *label, int maxlen)
Definition: node.cc:4391
void ntreeUpdateTree(struct Main *main, struct bNodeTree *ntree)
Definition: node.cc:4262
struct bNode * BKE_node_copy_store_new_pointers(struct bNodeTree *ntree, struct bNode *node_src, const int flag)
Definition: node.cc:2155
void ntreeCompositCryptomatteSyncFromRemove(bNode *node)
struct bNodeTreeType bNodeTreeType
void ntreeCompositClearTags(struct bNodeTree *ntree)
bool BKE_node_is_connected_to_output(struct bNodeTree *ntree, struct bNode *node)
Definition: node_common.c:399
void ntreeCompositOutputFileSetPath(struct bNode *node, struct bNodeSocket *sock, const char *name)
bool BKE_node_tree_iter_step(struct NodeTreeIterStore *ntreeiter, struct bNodeTree **r_nodetree, struct ID **r_id)
Definition: node.cc:5086
int nodeSocketLinkLimit(const struct bNodeSocket *sock)
bool BKE_node_instance_hash_tag_key(bNodeInstanceHash *hash, bNodeInstanceKey key)
Definition: node.cc:4027
void BKE_node_preview_merge_tree(struct bNodeTree *to_ntree, struct bNodeTree *from_ntree, bool remove_old)
Definition: node.cc:2770
void BKE_node_instance_hash_clear(bNodeInstanceHash *hash, bNodeInstanceValueFP valfreefp)
Definition: node.cc:3989
void node_type_internal_links(struct bNodeType *ntype, void(*update_internal_links)(struct bNodeTree *, struct bNode *))
void nodePositionRelative(struct bNode *from_node, struct bNode *to_node, struct bNodeSocket *from_sock, struct bNodeSocket *to_sock)
Definition: node.cc:2476
BLI_INLINE void BKE_node_instance_hash_iterator_step(bNodeInstanceHashIterator *iter)
Definition: BKE_node.h:772
void node_type_group_update(struct bNodeType *ntype, void(*group_update_func)(struct bNodeTree *ntree, struct bNode *node))
Definition: node.cc:4629
void ntreeTexCheckCyclics(struct bNodeTree *ntree)
void ntreeFreeEmbeddedTree(struct bNodeTree *ntree)
Definition: node.cc:3021
bool nodeSetActiveID(struct bNodeTree *ntree, short idtype, struct ID *id)
Definition: node.cc:3617
const char * nodeStaticSocketType(int type, int subtype)
Definition: node.cc:1574
struct bNodeSocketTemplate bNodeSocketTemplate
Compact definition of a node socket.
struct bNodeType * nodeTypeFind(const char *idname)
Definition: node.cc:1254
struct bNodeSocket * nodeInsertSocket(struct bNodeTree *ntree, struct bNode *node, eNodeSocketInOut in_out, const char *idname, struct bNodeSocket *next_sock, const char *identifier, const char *name)
Definition: node.cc:1555
bool nodeSocketIsRegistered(struct bNodeSocket *sock)
Definition: node.cc:1366
void ntreeSetOutput(struct bNodeTree *ntree)
Definition: node.cc:3050
void BKE_node_system_init(void)
Definition: node.cc:5003
void node_type_storage(struct bNodeType *ntype, const char *storagename, void(*freefunc)(struct bNode *node), void(*copyfunc)(struct bNodeTree *dest_ntree, struct bNode *dest_node, const struct bNode *src_node))
Definition: node.cc:4599
const char * nodeStaticSocketInterfaceType(int type, int subtype)
Definition: node.cc:1645
void BKE_nodetree_remove_layer_n(struct bNodeTree *ntree, struct Scene *scene, const int layer_index)
Definition: node.cc:5140
struct bNodeLink * nodeAddLink(struct bNodeTree *ntree, struct bNode *fromnode, struct bNodeSocket *fromsock, struct bNode *tonode, struct bNodeSocket *tosock)
Definition: node.cc:2189
int(* NodeGPUExecFunction)(struct GPUMaterial *mat, struct bNode *node, struct bNodeExecData *execdata, struct GPUNodeStack *in, struct GPUNodeStack *out)
Definition: BKE_node.h:209
void nodeClearActive(struct bNodeTree *ntree)
Definition: node.cc:3682
void nodeParentsIter(bNode *node, bool(*callback)(bNode *, void *), void *userdata)
Definition: node.cc:1972
void nodeRemoveSocket(struct bNodeTree *ntree, struct bNode *node, struct bNodeSocket *sock)
Definition: node.cc:1775
int BKE_node_instance_hash_size(bNodeInstanceHash *hash)
Definition: node.cc:4004
void BKE_node_preview_clear(struct bNodePreview *preview)
Definition: node.cc:2716
struct bNodeSocket * nodeFindSocket(const struct bNode *node, eNodeSocketInOut in_out, const char *identifier)
struct bNodeTreeExec * ntreeTexBeginExecTree(struct bNodeTree *ntree)
void ntreeCompositCryptomatteSyncFromAdd(const Scene *scene, bNode *node)
void BKE_nodetree_shading_params_eval(struct Depsgraph *depsgraph, struct bNodeTree *ntree_dst, const struct bNodeTree *ntree_src)
struct bNodeTree * ntreeCopyTree(struct Main *bmain, const struct bNodeTree *ntree)
void ntreeGPUMaterialNodes(struct bNodeTree *localtree, struct GPUMaterial *mat, bool *has_surface_output, bool *has_volume_output)
struct bNodeSocket * nodeInsertStaticSocket(struct bNodeTree *ntree, struct bNode *node, eNodeSocketInOut in_out, int type, int subtype, struct bNodeSocket *next_sock, const char *identifier, const char *name)
Definition: node.cc:1736
void BKE_node_instance_hash_remove_untagged(bNodeInstanceHash *hash, bNodeInstanceValueFP valfreefp)
Definition: node.cc:4040
struct bNode * nodeAddNode(const struct bContext *C, struct bNodeTree *ntree, const char *idname)
Definition: node.cc:1991
struct bNode * nodeFindRootParent(bNode *node)
Definition: node.cc:1849
void ntreeLocalMerge(struct Main *bmain, struct bNodeTree *localtree, struct bNodeTree *ntree)
Definition: node.cc:3238
void ntreeTypeFreeLink(const struct bNodeTreeType *nt)
void ntreeShaderEndExecTree(struct bNodeTreeExec *exec)
void BKE_node_instance_hash_tag(bNodeInstanceHash *hash, void *value)
bool ntreeIsRegistered(struct bNodeTree *ntree)
Definition: node.cc:1244
void ntreeUpdateAllUsers(struct Main *main, struct ID *id)
Definition: node.cc:4219
void nodeSetSelected(struct bNode *node, bool select)
Definition: node.cc:3664
struct bNodeTree ** BKE_ntree_ptr_from_id(struct ID *id)
Definition: node.cc:3124
struct bNode * nodeGetActiveID(struct bNodeTree *ntree, short idtype)
Definition: node.cc:3608
void nodeUpdateInternalLinks(struct bNodeTree *ntree, struct bNode *node)
Definition: node.cc:4380
struct GHashIterator * nodeTypeGetIterator(void)
Definition: node.cc:1323
struct bNode * nodeGetActiveTexture(struct bNodeTree *ntree)
bNodeSocket * ntreeCompositCryptomatteAddSocket(bNodeTree *ntree, bNode *node)
bool ntreeNodeExists(const struct bNodeTree *ntree, const struct bNode *testnode)
struct bNodeSocket * ntreeFindSocketInterface(struct bNodeTree *ntree, eNodeSocketInOut in_out, const char *identifier)
Definition: node.cc:3289
struct bNodeTree * ntreeCopyTree_ex_new_pointers(const struct bNodeTree *ntree, struct Main *bmain, const bool do_id_user)
struct bNodeSocketType NodeSocketTypeUndefined
Definition: node.cc:99
void BKE_node_preview_init_tree(struct bNodeTree *ntree, int xsize, int ysize, bool create_previews)
Definition: node.cc:2659
void ntreeBlendReadExpand(struct BlendExpander *expander, struct bNodeTree *ntree)
Definition: node.cc:914
void nodeChainIterBackwards(const bNodeTree *ntree, const bNode *node_start, bool(*callback)(bNode *, bNode *, void *), void *userdata, int recursion_lvl)
Definition: node.cc:1944
void ntreeFreeLocalTree(struct bNodeTree *ntree)
Definition: node.cc:3028
const bNodeInstanceKey NODE_INSTANCE_KEY_NONE
Definition: node.cc:3909
struct bNodeInstanceHash bNodeInstanceHash
void ntreeCompositOutputFileSetLayer(struct bNode *node, struct bNodeSocket *sock, const char *name)
bool nodeFindNode(struct bNodeTree *ntree, struct bNodeSocket *sock, struct bNode **r_node, int *r_sockindex)
Definition: node.cc:1823
struct bNodeTree * ntreeAddTree(struct Main *bmain, const char *name, const char *idname)
Definition: node.cc:2529
void nodeUnregisterSocketType(struct bNodeSocketType *stype)
Definition: node.cc:1361
struct bNodeSocket * ntreeAddSocketInterface(struct bNodeTree *ntree, eNodeSocketInOut in_out, const char *idname, const char *name)
Definition: node.cc:3302
struct bNode * nodeAddStaticNode(const struct bContext *C, struct bNodeTree *ntree, int type)
Definition: node.cc:2004
void * SocketGetCPPTypeFunction
Definition: BKE_node.h:134
void BKE_node_instance_hash_clear_tags(bNodeInstanceHash *hash)
Definition: node.cc:4009
bool BKE_node_clipboard_validate(void)
Definition: node.cc:3806
int nodeCountSocketLinks(const struct bNodeTree *ntree, const struct bNodeSocket *sock)
void ntreeUpdateAllNew(struct Main *main)
Definition: node.cc:4200
void BKE_node_clipboard_clear(void)
Definition: node.cc:3788
void nodeToView(const struct bNode *node, float x, float y, float *rx, float *ry)
void node_type_exec(struct bNodeType *ntype, NodeInitExecFunction init_exec_fn, NodeFreeExecFunction free_exec_fn, NodeExecFunction exec_fn)
Definition: node.cc:4635
struct bNodeSocket * ntreeInsertSocketInterface(struct bNodeTree *ntree, eNodeSocketInOut in_out, const char *idname, struct bNodeSocket *next_sock, const char *name)
Definition: node.cc:3319
void nodeDetachNode(struct bNode *node)
Definition: node.cc:2462
void ntreeGetDependencyList(struct bNodeTree *ntree, struct bNode ***r_deplist, int *r_deplist_len)
Definition: node.cc:4107
void * BKE_node_instance_hash_lookup(bNodeInstanceHash *hash, bNodeInstanceKey key)
Definition: node.cc:3977
struct bNodeSocketType * nodeSocketTypeFind(const char *idname)
Definition: node.cc:1328
void ntreeSetTypes(const struct bContext *C, struct bNodeTree *ntree)
Definition: node.cc:1178
void nodeUnregisterType(struct bNodeType *ntype)
Definition: node.cc:1311
void BKE_node_instance_hash_free(bNodeInstanceHash *hash, bNodeInstanceValueFP valfreefp)
Definition: node.cc:3963
void nodeRegisterType(struct bNodeType *ntype)
Definition: node.cc:1298
void node_type_label(struct bNodeType *ntype, void(*labelfunc)(struct bNodeTree *ntree, struct bNode *, char *label, int maxlen))
void nodeUnlinkNode(struct bNodeTree *ntree, struct bNode *node)
Definition: node.cc:2833
void nodeSetActive(struct bNodeTree *ntree, struct bNode *node)
Definition: node.cc:3694
GHashIterator bNodeInstanceHashIterator
Definition: BKE_node.h:748
void BKE_node_clipboard_free(void)
Definition: node.cc:3899
BLI_INLINE bNodeInstanceHashIterator * BKE_node_instance_hash_iterator_new(bNodeInstanceHash *hash)
Definition: BKE_node.h:750
void * NodeExpandInMFNetworkFunction
Definition: BKE_node.h:131
void nodeModifySocketType(struct bNodeTree *ntree, struct bNode *node, struct bNodeSocket *sock, int type, int subtype)
const char * nodeSocketLabel(const struct bNodeSocket *sock)
void ntreeCompositRegisterPass(struct bNodeTree *ntree, struct Scene *scene, struct ViewLayer *view_layer, const char *name, eNodeSocketDatatype type)
eNodeSizePreset
Definition: BKE_node.h:369
@ NODE_SIZE_DEFAULT
Definition: BKE_node.h:370
@ NODE_SIZE_LARGE
Definition: BKE_node.h:373
@ NODE_SIZE_SMALL
Definition: BKE_node.h:371
@ NODE_SIZE_MIDDLE
Definition: BKE_node.h:372
void * SocketExpandInMFNetworkFunction
Definition: BKE_node.h:132
void ntreeCompositCryptomatteUpdateLayerNames(const Scene *scene, bNode *node)
bNodeInstanceKey BKE_node_instance_key(bNodeInstanceKey parent_key, const struct bNodeTree *ntree, const struct bNode *node)
#define BLI_INLINE
BLI_INLINE void * BLI_ghashIterator_getKey(GHashIterator *ghi) ATTR_WARN_UNUSED_RESULT
Definition: BLI_ghash.h:146
void BLI_ghashIterator_step(GHashIterator *ghi)
Definition: BLI_ghash.c:1086
BLI_INLINE bool BLI_ghashIterator_done(GHashIterator *ghi) ATTR_WARN_UNUSED_RESULT
Definition: BLI_ghash.h:158
void BLI_ghashIterator_free(GHashIterator *ghi)
Definition: BLI_ghash.c:1105
BLI_INLINE void * BLI_ghashIterator_getValue(GHashIterator *ghi) ATTR_WARN_UNUSED_RESULT
Definition: BLI_ghash.h:150
GHashIterator * BLI_ghashIterator_new(GHash *gh) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT
Definition: BLI_ghash.c:1050
void BLI_ghashIterator_init(GHashIterator *ghi, GHash *gh)
Definition: BLI_ghash.c:1065
struct Depsgraph Depsgraph
Definition: DEG_depsgraph.h:51
These structs are the foundation for all linked lists in the library system.
eNodeSocketInOut
eNodeSocketDatatype
_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 width
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum type
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint y
#define C
Definition: RandGen.cpp:39
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
Definition: btDbvt.cpp:52
OperationNode * node
StackEntry * from
const char * label
Scene scene
const Depsgraph * depsgraph
DEGForeachIDComponentCallback callback
bNodeTree * ntree
uint col
uiWidgetBaseParameters params[MAX_WIDGET_BASE_BATCH]
int main(int argc, char **argv)
Definition: msgfmt.c:457
static bNodeSocketTemplate outputs[]
static bNodeSocketTemplate inputs[]
static void exec(void *data, int UNUSED(thread), bNode *node, bNodeExecData *execdata, bNodeStack **in, bNodeStack **out)
static void unique_name(bNode *node)
#define hash
Definition: noise.c:169
struct SELECTID_Context context
Definition: select_engine.c:47
Definition: DNA_ID.h:273
Definition: BKE_main.h:116
struct Simulation * simulation
Definition: BKE_node.h:927
struct Light * light
Definition: BKE_node.h:924
struct World * world
Definition: BKE_node.h:925
struct FreestyleLineStyle * linestyle
Definition: BKE_node.h:926
struct Material * mat
Definition: BKE_node.h:922
bNodeTree * ngroup
Definition: BKE_node.h:920
Compact definition of a node socket.
Definition: BKE_node.h:95
struct bNodeSocket * sock
Definition: BKE_node.h:104
char identifier[64]
Definition: BKE_node.h:105
Defines a socket type.
Definition: BKE_node.h:143
void(* interface_init_socket)(struct bNodeTree *ntree, struct bNodeSocket *stemp, struct bNode *node, struct bNodeSocket *sock, const char *data_path)
Definition: BKE_node.h:161
void(* draw_color)(struct bContext *C, struct PointerRNA *ptr, struct PointerRNA *node_ptr, float *r_color)
Definition: BKE_node.h:151
int input_link_limit
Definition: BKE_node.h:185
ExtensionRNA ext_interface
Definition: BKE_node.h:178
void(* interface_register_properties)(struct bNodeTree *ntree, struct bNodeSocket *stemp, struct StructRNA *data_srna)
Definition: BKE_node.h:158
ExtensionRNA ext_socket
Definition: BKE_node.h:177
void(* interface_draw_color)(struct bContext *C, struct PointerRNA *ptr, float *r_color)
Definition: BKE_node.h:157
int output_link_limit
Definition: BKE_node.h:186
void(* interface_verify_socket)(struct bNodeTree *ntree, struct bNodeSocket *stemp, struct bNode *node, struct bNodeSocket *sock, const char *data_path)
Definition: BKE_node.h:166
void(* draw)(struct bContext *C, struct uiLayout *layout, struct PointerRNA *ptr, struct PointerRNA *node_ptr, const char *text)
Definition: BKE_node.h:146
bool use_link_limits_of_type
Definition: BKE_node.h:184
void(* free_self)(struct bNodeSocketType *stype)
Definition: BKE_node.h:189
SocketGetCPPTypeFunction get_cpp_type
Definition: BKE_node.h:194
SocketExpandInMFNetworkFunction expand_in_mf_network
Definition: BKE_node.h:192
SocketGetCPPValueFunction get_cpp_value
Definition: BKE_node.h:196
void(* interface_draw)(struct bContext *C, struct uiLayout *layout, struct PointerRNA *ptr)
Definition: BKE_node.h:156
char idname[64]
Definition: BKE_node.h:144
void(* interface_from_socket)(struct bNodeTree *ntree, struct bNodeSocket *stemp, struct bNode *node, struct bNodeSocket *sock)
Definition: BKE_node.h:171
char name[64]
char identifier[64]
char idname[64]
bool(* poll)(const struct bContext *C, struct bNodeTreeType *ntreetype)
Definition: BKE_node.h:393
char idname[64]
Definition: BKE_node.h:381
void(* free_node_cache)(struct bNodeTree *ntree, struct bNode *node)
Definition: BKE_node.h:389
void(* update)(struct bNodeTree *ntree)
Definition: BKE_node.h:407
void(* local_merge)(struct Main *bmain, struct bNodeTree *localtree, struct bNodeTree *ntree)
Definition: BKE_node.h:404
void(* get_from_context)(const struct bContext *C, struct bNodeTreeType *ntreetype, struct bNodeTree **r_ntree, struct ID **r_id, struct ID **r_from)
Definition: BKE_node.h:395
bool(* validate_link)(struct bNodeTree *ntree, struct bNodeLink *link)
Definition: BKE_node.h:409
void(* free_cache)(struct bNodeTree *ntree)
Definition: BKE_node.h:388
char ui_name[64]
Definition: BKE_node.h:383
void(* localize)(struct bNodeTree *localtree, struct bNodeTree *ntree)
Definition: BKE_node.h:402
char ui_description[256]
Definition: BKE_node.h:384
void(* foreach_nodeclass)(struct Scene *scene, void *calldata, bNodeClassCallback func)
Definition: BKE_node.h:391
void(* local_sync)(struct bNodeTree *localtree, struct bNodeTree *ntree)
Definition: BKE_node.h:403
void(* node_add_init)(struct bNodeTree *ntree, struct bNode *bnode)
Definition: BKE_node.h:411
ExtensionRNA rna_ext
Definition: BKE_node.h:414
char idname[64]
Defines a node type.
Definition: BKE_node.h:221
void(* copyfunc)(struct bNodeTree *dest_ntree, struct bNode *dest_node, const struct bNode *src_node)
Definition: BKE_node.h:283
NodeGeometryExecFunction geometry_node_execute
Definition: BKE_node.h:327
int(* tweak_area_func)(struct bNode *node, int x, int y)
Definition: BKE_node.h:271
float minwidth
Definition: BKE_node.h:231
void(* group_update_func)(struct bNodeTree *ntree, struct bNode *node)
Definition: BKE_node.h:276
float width
Definition: BKE_node.h:231
short flag
Definition: BKE_node.h:233
char ui_name[64]
Definition: BKE_node.h:227
void(* draw_nodetype)(const struct bContext *C, struct ARegion *region, struct SpaceNode *snode, struct bNodeTree *ntree, struct bNode *node, bNodeInstanceKey key)
Definition: BKE_node.h:241
NodeExpandInMFNetworkFunction expand_in_mf_network
Definition: BKE_node.h:324
bool(* poll)(struct bNodeType *ntype, struct bNodeTree *nodetree, const char **r_disabled_hint)
Definition: BKE_node.h:301
float maxwidth
Definition: BKE_node.h:231
void(* update_internal_links)(struct bNodeTree *, struct bNode *node)
Definition: BKE_node.h:312
ExtensionRNA rna_ext
Definition: BKE_node.h:330
int type
Definition: BKE_node.h:225
NodeInitExecFunction init_exec_fn
Definition: BKE_node.h:317
void(* updatefunc)(struct bNodeTree *ntree, struct bNode *node)
Definition: BKE_node.h:274
bNodeSocketTemplate * outputs
Definition: BKE_node.h:236
void(* initfunc_api)(const struct bContext *C, struct PointerRNA *ptr)
Definition: BKE_node.h:288
void(* free_self)(struct bNodeType *ntype)
Definition: BKE_node.h:314
short nclass
Definition: BKE_node.h:233
char ui_description[256]
Definition: BKE_node.h:228
void(* insert_link)(struct bNodeTree *ntree, struct bNode *node, struct bNodeLink *link)
Definition: BKE_node.h:310
void(* freefunc)(struct bNode *node)
Definition: BKE_node.h:281
NodeGPUExecFunction gpu_fn
Definition: BKE_node.h:321
void(* draw_buttons_ex)(struct uiLayout *, struct bContext *C, struct PointerRNA *ptr)
Definition: BKE_node.h:255
void(* draw_nodetype_prepare)(const struct bContext *C, struct bNodeTree *ntree, struct bNode *node)
Definition: BKE_node.h:248
void * next
Definition: BKE_node.h:222
void(* draw_buttons)(struct uiLayout *, struct bContext *C, struct PointerRNA *ptr)
Definition: BKE_node.h:253
float minheight
Definition: BKE_node.h:232
void(* freefunc_api)(struct PointerRNA *ptr)
Definition: BKE_node.h:289
float height
Definition: BKE_node.h:232
void(* labelfunc)(struct bNodeTree *ntree, struct bNode *node, char *label, int maxlen)
Definition: BKE_node.h:265
bNodeSocketTemplate * inputs
Definition: BKE_node.h:236
char storagename[64]
Definition: BKE_node.h:238
float maxheight
Definition: BKE_node.h:232
NodeExecFunction exec_fn
Definition: BKE_node.h:319
void * prev
Definition: BKE_node.h:222
bool(* poll_instance)(struct bNode *node, struct bNodeTree *nodetree, const char **r_disabled_hint)
Definition: BKE_node.h:305
void(* initfunc)(struct bNodeTree *ntree, struct bNode *node)
Definition: BKE_node.h:279
int(* select_area_func)(struct bNode *node, int x, int y)
Definition: BKE_node.h:269
char idname[64]
Definition: BKE_node.h:224
int(* resize_area_func)(struct bNode *node, int x, int y)
Definition: BKE_node.h:267
void(* draw_backdrop)(struct SpaceNode *snode, struct ImBuf *backdrop, struct bNode *node, int x, int y)
Definition: BKE_node.h:258
void(* copyfunc_api)(struct PointerRNA *ptr, const struct bNode *src_node)
Definition: BKE_node.h:290
NodeFreeExecFunction free_exec_fn
Definition: BKE_node.h:318
int ui_icon
Definition: BKE_node.h:229
struct bNode * parent
char name[64]
char idname[64]
__forceinline const avxb select(const avxb &m, const avxb &t, const avxb &f)
Definition: util_avxb.h:167
PointerRNA * ptr
Definition: wm_files.c:3157