|
Blender
V2.59
|
00001 /* 00002 * $Id: DNA_node_types.h 38609 2011-07-22 15:28:50Z ton $ 00003 * 00004 * ***** BEGIN GPL LICENSE BLOCK ***** 00005 * 00006 * This program is free software; you can redistribute it and/or 00007 * modify it under the terms of the GNU General Public License 00008 * as published by the Free Software Foundation; either version 2 00009 * of the License, or (at your option) any later version. 00010 * 00011 * This program is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 * GNU General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU General Public License 00017 * along with this program; if not, write to the Free Software Foundation, 00018 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 00019 * 00020 * The Original Code is Copyright (C) 2005 Blender Foundation. 00021 * All rights reserved. 00022 * 00023 * The Original Code is: all of this file. 00024 * 00025 * Contributor(s): Bob Holcomb, Xavier Thomas 00026 * 00027 * ***** END GPL LICENSE BLOCK ***** 00028 */ 00029 00030 #ifndef DNA_NODE_TYPES_H 00031 #define DNA_NODE_TYPES_H 00032 00037 #include "DNA_ID.h" 00038 #include "DNA_vec_types.h" 00039 #include "DNA_listBase.h" 00040 00041 struct ListBase; 00042 struct SpaceNode; 00043 struct bNodeLink; 00044 struct bNodeType; 00045 struct bNodeGroup; 00046 struct AnimData; 00047 struct bGPdata; 00048 struct uiBlock; 00049 00050 #define NODE_MAXSTR 32 00051 00052 00053 typedef struct bNodeStack { 00054 float vec[4]; 00055 float min, max; /* min/max for values (UI writes it, execute might use it) */ 00056 void *data; 00057 short hasinput; /* when input has link, tagged before executing */ 00058 short hasoutput; /* when output is linked, tagged before executing */ 00059 short datatype; /* type of data pointer */ 00060 short sockettype; /* type of socket stack comes from, to remap linking different sockets */ 00061 } bNodeStack; 00062 00063 /* ns->datatype, shadetree only */ 00064 #define NS_OSA_VECTORS 1 00065 #define NS_OSA_VALUES 2 00066 00067 typedef struct bNodeSocket { 00068 struct bNodeSocket *next, *prev, *new_sock; 00069 00070 char name[32]; 00071 bNodeStack ns; /* custom data for inputs, only UI writes in this */ 00072 00073 short type, flag; 00074 short limit; /* max. number of links */ 00075 00076 /* stack data info (only during execution!) */ 00077 short stack_type; /* type of stack reference */ 00078 /* XXX only one of stack_ptr or stack_index is used (depending on stack_type). 00079 * could store the index in the pointer with SET_INT_IN_POINTER (a bit ugly). 00080 * (union won't work here, not supported by DNA) 00081 */ 00082 struct bNodeStack *stack_ptr; /* constant input value */ 00083 short stack_index; /* local stack index or external input number */ 00084 short pad1; 00085 00086 float locx, locy; 00087 00088 /* internal data to retrieve relations and groups */ 00089 00090 int own_index; /* group socket identifiers, to find matching pairs after reading files */ 00091 struct bNodeSocket *groupsock; 00092 int to_index; /* XXX deprecated, only used for restoring old group node links */ 00093 int pad2; 00094 00095 struct bNodeLink *link; /* a link pointer, set in nodeSolveOrder() */ 00096 } bNodeSocket; 00097 00098 /* sock->type */ 00099 #define SOCK_VALUE 0 00100 #define SOCK_VECTOR 1 00101 #define SOCK_RGBA 2 00102 00103 /* sock->flag, first bit is select */ 00104 /* hidden is user defined, to hide unused */ 00105 #define SOCK_HIDDEN 2 00106 /* only used now for groups... */ 00107 #define SOCK_IN_USE 4 00108 /* unavailable is for dynamic sockets */ 00109 #define SOCK_UNAVAIL 8 00110 00111 /* sock->stack_type */ 00112 #define SOCK_STACK_LOCAL 1 /* part of the local tree stack */ 00113 #define SOCK_STACK_EXTERN 2 /* use input stack pointer */ 00114 #define SOCK_STACK_CONST 3 /* use pointer to constant input value */ 00115 00116 typedef struct bNodePreview { 00117 unsigned char *rect; 00118 short xsize, ysize; 00119 int pad; 00120 } bNodePreview; 00121 00122 00123 /* limit data in bNode to what we want to see saved? */ 00124 typedef struct bNode { 00125 struct bNode *next, *prev, *new_node; 00126 00127 char name[32]; 00128 short type, flag; 00129 short done, level; /* both for dependency and sorting */ 00130 short lasty, menunr; /* lasty: check preview render status, menunr: browse ID blocks */ 00131 short stack_index; /* for groupnode, offset in global caller stack */ 00132 short nr; /* number of this node in list, used for UI exec events */ 00133 00134 ListBase inputs, outputs; 00135 struct ID *id; /* optional link to libdata */ 00136 void *storage; /* custom data, must be struct, for storage in file */ 00137 00138 float locx, locy; /* root offset for drawing */ 00139 float width, miniwidth; 00140 char label[32]; /* custom user-defined label */ 00141 short custom1, custom2; /* to be abused for buttons */ 00142 float custom3, custom4; 00143 00144 short need_exec, exec; /* need_exec is set as UI execution event, exec is flag during exec */ 00145 void *threaddata; /* optional extra storage for use in thread (read only then!) */ 00146 00147 rctf totr; /* entire boundbox */ 00148 rctf butr; /* optional buttons area */ 00149 rctf prvr; /* optional preview area */ 00150 bNodePreview *preview; /* optional preview image */ 00151 struct uiBlock *block; /* runtime during drawing */ 00152 00153 struct bNodeType *typeinfo; /* lookup of callbacks and defaults */ 00154 00155 } bNode; 00156 00157 /* node->flag */ 00158 #define NODE_SELECT 1 00159 #define NODE_OPTIONS 2 00160 #define NODE_PREVIEW 4 00161 #define NODE_HIDDEN 8 00162 #define NODE_ACTIVE 16 00163 #define NODE_ACTIVE_ID 32 00164 #define NODE_DO_OUTPUT 64 00165 #define NODE_GROUP_EDIT 128 00166 /* free test flag, undefined */ 00167 #define NODE_TEST 256 00168 /* composite: don't do node but pass on buffer(s) */ 00169 #define NODE_MUTED 512 00170 #define NODE_CUSTOM_NAME 1024 /* deprecated! */ 00171 00172 typedef struct bNodeLink { 00173 struct bNodeLink *next, *prev; 00174 00175 bNode *fromnode, *tonode; 00176 bNodeSocket *fromsock, *tosock; 00177 00178 int flag, pad; 00179 00180 } bNodeLink; 00181 00182 00183 /* link->flag */ 00184 #define NODE_LINKFLAG_HILITE 1 00185 00186 /* the basis for a Node tree, all links and nodes reside internal here */ 00187 /* only re-usable node trees are in the library though, materials and textures allocate own tree struct */ 00188 typedef struct bNodeTree { 00189 ID id; 00190 struct AnimData *adt; /* animation data (must be immediately after id for utilities to use it) */ 00191 00192 struct bGPdata *gpd; /* grease pencil data */ 00193 00194 ListBase nodes, links; 00195 00196 bNodeStack *stack; /* stack is only while executing, no read/write in file */ 00197 struct ListBase *threadstack; /* same as above */ 00198 00199 int type, init; /* set init on fileread */ 00200 int stacksize; /* amount of elements in stack */ 00201 int cur_index; /* sockets in groups have unique identifiers, adding new sockets always 00202 will increase this counter */ 00203 int flag, pad; 00204 00205 ListBase alltypes; /* type definitions */ 00206 ListBase inputs, outputs; /* external sockets for group nodes */ 00207 00208 int pad2[2]; 00209 00210 /* callbacks */ 00211 void (*progress)(void *, float progress); 00212 void (*stats_draw)(void *, char *str); 00213 int (*test_break)(void *); 00214 void *tbh, *prh, *sdh; 00215 00216 } bNodeTree; 00217 00218 /* ntree->type, index */ 00219 #define NTREE_SHADER 0 00220 #define NTREE_COMPOSIT 1 00221 #define NTREE_TEXTURE 2 00222 00223 /* ntree->init, flag */ 00224 #define NTREE_TYPE_INIT 1 00225 #define NTREE_EXEC_INIT 2 00226 00227 /* ntree->flag */ 00228 #define NTREE_DS_EXPAND 1 /* for animation editors */ 00229 /* XXX not nice, but needed as a temporary flag 00230 * for group updates after library linking. 00231 */ 00232 #define NTREE_DO_VERSIONS 1024 00233 00234 /* data structs, for node->storage */ 00235 00236 /* this one has been replaced with ImageUser, keep it for do_versions() */ 00237 typedef struct NodeImageAnim { 00238 int frames, sfra, nr; 00239 char cyclic, movie; 00240 short pad; 00241 } NodeImageAnim; 00242 00243 typedef struct NodeBlurData { 00244 short sizex, sizey; 00245 short samples, maxspeed, minspeed, relative, aspect; 00246 short curved; 00247 float fac, percentx, percenty; 00248 short filtertype; 00249 char bokeh, gamma; 00250 int image_in_width, image_in_height; /* needed for absolute/relative conversions */ 00251 } NodeBlurData; 00252 00253 typedef struct NodeDBlurData { 00254 float center_x, center_y, distance, angle, spin, zoom; 00255 short iter; 00256 char wrap, pad; 00257 } NodeDBlurData; 00258 00259 typedef struct NodeBilateralBlurData { 00260 float sigma_color, sigma_space; 00261 short iter, pad; 00262 } NodeBilateralBlurData; 00263 00264 typedef struct NodeHueSat { 00265 float hue, sat, val; 00266 } NodeHueSat; 00267 00268 typedef struct NodeImageFile { 00269 char name[256]; 00270 short imtype, subimtype, quality, codec; 00271 int sfra, efra; 00272 } NodeImageFile; 00273 00274 typedef struct NodeChroma { 00275 float t1,t2,t3; 00276 float fsize,fstrength,falpha; 00277 float key[4]; 00278 short algorithm, channel; 00279 } NodeChroma; 00280 00281 typedef struct NodeTwoXYs { 00282 short x1, x2, y1, y2; 00283 float fac_x1, fac_x2, fac_y1, fac_y2; 00284 } NodeTwoXYs; 00285 00286 typedef struct NodeTwoFloats { 00287 float x, y; 00288 } NodeTwoFloats; 00289 00290 typedef struct NodeGeometry { 00291 char uvname[32]; 00292 char colname[32]; 00293 } NodeGeometry; 00294 00295 typedef struct NodeVertexCol { 00296 char name[32]; 00297 } NodeVertexCol; 00298 00299 /* qdn: Defocus blur node */ 00300 typedef struct NodeDefocus { 00301 char bktype, rotation, preview, gamco; 00302 short samples, no_zbuf; 00303 float fstop, maxblur, bthresh, scale; 00304 } NodeDefocus; 00305 00306 typedef struct NodeScriptDict { 00307 void *dict; /* for PyObject *dict */ 00308 void *node; /* for BPy_Node *node */ 00309 } NodeScriptDict; 00310 00311 /* qdn: glare node */ 00312 typedef struct NodeGlare { 00313 char quality, type, iter; 00314 char angle, angle_ofs, size, pad[2]; 00315 float colmod, mix, threshold, fade; 00316 } NodeGlare; 00317 00318 /* qdn: tonemap node */ 00319 typedef struct NodeTonemap { 00320 float key, offset, gamma; 00321 float f, m, a, c; 00322 int type; 00323 } NodeTonemap; 00324 00325 /* qdn: lens distortion node */ 00326 typedef struct NodeLensDist { 00327 short jit, proj, fit, pad; 00328 } NodeLensDist; 00329 00330 typedef struct NodeColorBalance { 00331 /* for processing */ 00332 float slope[3]; 00333 float offset[3]; 00334 float power[3]; 00335 00336 /* for ui representation */ 00337 float lift[3]; 00338 float gamma[3]; 00339 float gain[3]; 00340 00341 /* temp storage for inverted lift */ 00342 float lift_lgg[3]; 00343 float gamma_inv[3]; 00344 } NodeColorBalance; 00345 00346 typedef struct NodeColorspill { 00347 short limchan, unspill; 00348 float limscale; 00349 float uspillr, uspillg, uspillb; 00350 }NodeColorspill; 00351 00352 /* TEX_output */ 00353 typedef struct TexNodeOutput { 00354 char name[32]; 00355 } TexNodeOutput; 00356 00357 00358 /* comp channel matte */ 00359 #define CMP_NODE_CHANNEL_MATTE_CS_RGB 1 00360 #define CMP_NODE_CHANNEL_MATTE_CS_HSV 2 00361 #define CMP_NODE_CHANNEL_MATTE_CS_YUV 3 00362 #define CMP_NODE_CHANNEL_MATTE_CS_YCC 4 00363 00364 #define CMP_NODE_BLUR_ASPECT_NONE 0 00365 #define CMP_NODE_BLUR_ASPECT_Y 1 00366 #define CMP_NODE_BLUR_ASPECT_X 2 00367 00368 #endif