Blender  V2.93
node_util.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) 2007 Blender Foundation.
17  * All rights reserved.
18  */
19 
24 #pragma once
25 
26 #include "DNA_listBase.h"
27 
28 #include "BLI_utildefines.h"
29 
30 #include "BKE_node.h"
31 
32 #include "MEM_guardedalloc.h"
33 
34 #include "NOD_socket.h"
35 
36 #include "GPU_material.h" /* For Shader muting GPU code... */
37 
38 #include "RNA_access.h"
39 
40 #ifdef __cplusplus
41 extern "C" {
42 #endif
43 
44 struct bNode;
45 struct bNodeTree;
46 
47 /* data for initializing node execution */
48 typedef struct bNodeExecContext {
51 
52 typedef struct bNodeExecData {
53  void *data; /* custom data storage */
54  struct bNodePreview *preview; /* optional preview image */
56 
57 /**** Storage Data ****/
58 
59 extern void node_free_curves(struct bNode *node);
60 extern void node_free_standard_storage(struct bNode *node);
61 
62 extern void node_copy_curves(struct bNodeTree *dest_ntree,
63  struct bNode *dest_node,
64  const struct bNode *src_node);
65 extern void node_copy_standard_storage(struct bNodeTree *dest_ntree,
66  struct bNode *dest_node,
67  const struct bNode *src_node);
69  struct bNode *node,
70  bNodeInstanceKey key);
71 
72 /**** Updates ****/
73 void node_sock_label(struct bNodeSocket *sock, const char *name);
74 void node_sock_label_clear(struct bNodeSocket *sock);
75 void node_math_update(struct bNodeTree *ntree, struct bNode *node);
76 
77 /**** Labels ****/
78 void node_blend_label(struct bNodeTree *ntree, struct bNode *node, char *label, int maxlen);
79 void node_image_label(struct bNodeTree *ntree, struct bNode *node, char *label, int maxlen);
80 void node_math_label(struct bNodeTree *ntree, struct bNode *node, char *label, int maxlen);
81 void node_vector_math_label(struct bNodeTree *ntree, struct bNode *node, char *label, int maxlen);
82 void node_filter_label(struct bNodeTree *ntree, struct bNode *node, char *label, int maxlen);
83 
84 /*** Link Handling */
85 void node_insert_link_default(struct bNodeTree *ntree, struct bNode *node, struct bNodeLink *link);
87 
88 float node_socket_get_float(struct bNodeTree *ntree, struct bNode *node, struct bNodeSocket *sock);
90  struct bNode *node,
91  struct bNodeSocket *sock,
92  float value);
94  struct bNode *node,
95  struct bNodeSocket *sock,
96  float *value);
98  struct bNode *node,
99  struct bNodeSocket *sock,
100  const float *value);
102  struct bNode *node,
103  struct bNodeSocket *sock,
104  float *value);
106  struct bNode *node,
107  struct bNodeSocket *sock,
108  const float *value);
109 
110 #ifdef __cplusplus
111 }
112 #endif
These structs are the foundation for all linked lists in the library system.
Read Guarded memory(de)allocation.
OperationNode * node
const char * label
bNodeTree * ntree
void node_insert_link_default(struct bNodeTree *ntree, struct bNode *node, struct bNodeLink *link)
Definition: node_util.c:305
void node_image_label(struct bNodeTree *ntree, struct bNode *node, char *label, int maxlen)
void node_copy_standard_storage(struct bNodeTree *dest_ntree, struct bNode *dest_node, const struct bNode *src_node)
struct bNodeExecData bNodeExecData
void node_sock_label_clear(struct bNodeSocket *sock)
Definition: node_util.c:93
void node_sock_label(struct bNodeSocket *sock, const char *name)
Definition: node_util.c:88
void node_math_update(struct bNodeTree *ntree, struct bNode *node)
void node_free_curves(struct bNode *node)
Definition: node_util.c:50
void * node_initexec_curves(struct bNodeExecContext *context, struct bNode *node, bNodeInstanceKey key)
void node_update_internal_links_default(struct bNodeTree *ntree, struct bNode *node)
Definition: node_util.c:503
void node_filter_label(struct bNodeTree *ntree, struct bNode *node, char *label, int maxlen)
void node_socket_get_vector(struct bNodeTree *ntree, struct bNode *node, struct bNodeSocket *sock, float *value)
void node_blend_label(struct bNodeTree *ntree, struct bNode *node, char *label, int maxlen)
void node_free_standard_storage(struct bNode *node)
Definition: node_util.c:55
void node_socket_set_vector(struct bNodeTree *ntree, struct bNode *node, struct bNodeSocket *sock, const float *value)
void node_socket_get_color(struct bNodeTree *ntree, struct bNode *node, struct bNodeSocket *sock, float *value)
struct bNodeExecContext bNodeExecContext
float node_socket_get_float(struct bNodeTree *ntree, struct bNode *node, struct bNodeSocket *sock)
void node_copy_curves(struct bNodeTree *dest_ntree, struct bNode *dest_node, const struct bNode *src_node)
void node_socket_set_float(struct bNodeTree *ntree, struct bNode *node, struct bNodeSocket *sock, float value)
void node_vector_math_label(struct bNodeTree *ntree, struct bNode *node, char *label, int maxlen)
void node_math_label(struct bNodeTree *ntree, struct bNode *node, char *label, int maxlen)
void node_socket_set_color(struct bNodeTree *ntree, struct bNode *node, struct bNodeSocket *sock, const float *value)
struct SELECTID_Context context
Definition: select_engine.c:47
struct bNodeInstanceHash * previews
Definition: node_util.h:49
void * data
Definition: node_util.h:53
struct bNodePreview * preview
Definition: node_util.h:54