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 20 /** \file 21 * \ingroup nodes 22 */ 23 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 { 49 struct bNodeInstanceHash *previews; 50 } bNodeExecContext; 51 52 typedef struct bNodeExecData { 53 void *data; /* custom data storage */ 54 struct bNodePreview *preview; /* optional preview image */ 55 } bNodeExecData; 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); 68 extern void *node_initexec_curves(struct bNodeExecContext *context, 69 struct bNode *node, 70 bNodeInstanceKey key); 71 72 /**** Updates ****/ 73 void node_sock_label(struct bNodeSocket *sock, const char *name); 74 void node_math_update(struct bNodeTree *ntree, struct bNode *node); 75 76 /**** Labels ****/ 77 void node_blend_label(struct bNodeTree *ntree, struct bNode *node, char *label, int maxlen); 78 void node_image_label(struct bNodeTree *ntree, struct bNode *node, char *label, int maxlen); 79 void node_math_label(struct bNodeTree *ntree, struct bNode *node, char *label, int maxlen); 80 void node_vector_math_label(struct bNodeTree *ntree, struct bNode *node, char *label, int maxlen); 81 void node_filter_label(struct bNodeTree *ntree, struct bNode *node, char *label, int maxlen); 82 83 /*** Link Handling */ 84 void node_insert_link_default(struct bNodeTree *ntree, struct bNode *node, struct bNodeLink *link); 85 void node_update_internal_links_default(struct bNodeTree *ntree, struct bNode *node); 86 87 float node_socket_get_float(struct bNodeTree *ntree, struct bNode *node, struct bNodeSocket *sock); 88 void node_socket_set_float(struct bNodeTree *ntree, 89 struct bNode *node, 90 struct bNodeSocket *sock, 91 float value); 92 void node_socket_get_color(struct bNodeTree *ntree, 93 struct bNode *node, 94 struct bNodeSocket *sock, 95 float *value); 96 void node_socket_set_color(struct bNodeTree *ntree, 97 struct bNode *node, 98 struct bNodeSocket *sock, 99 const float *value); 100 void node_socket_get_vector(struct bNodeTree *ntree, 101 struct bNode *node, 102 struct bNodeSocket *sock, 103 float *value); 104 void node_socket_set_vector(struct bNodeTree *ntree, 105 struct bNode *node, 106 struct bNodeSocket *sock, 107 const float *value); 108 109 #ifdef __cplusplus 110 } 111 #endif 112