2
* $Id: DNA_node_types.h,v 1.12 2006/06/17 13:04:09 ton Exp $
4
* ***** BEGIN GPL LICENSE BLOCK *****
6
* This program is free software; you can redistribute it and/or
7
* modify it under the terms of the GNU General Public License
8
* as published by the Free Software Foundation; either version 2
9
* of the License, or (at your option) any later version.
11
* This program is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
* GNU General Public License for more details.
16
* You should have received a copy of the GNU General Public License
17
* along with this program; if not, write to the Free Software Foundation,
18
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20
* The Original Code is Copyright (C) 2005 Blender Foundation.
21
* All rights reserved.
23
* The Original Code is: all of this file.
25
* Contributor(s): none yet.
27
* ***** END GPL LICENSE BLOCK *****
30
#ifndef DNA_NODE_TYPES_H
31
#define DNA_NODE_TYPES_H
34
#include "DNA_vec_types.h"
35
#include "DNA_listBase.h"
43
#define NODE_MAXSTR 32
46
typedef struct bNodeStack {
48
float min, max; /* min/max for values (UI writes it, execute might use it) */
50
short hasinput; /* when input has link, tagged before executing */
51
short hasoutput; /* when output is linked, tagged before executing */
52
short datatype; /* type of data pointer */
56
/* ns->datatype, shadetree only */
57
#define NS_OSA_VECTORS 1
58
#define NS_OSA_VALUES 2
60
typedef struct bNodeSocket {
61
struct bNodeSocket *next, *prev;
64
bNodeStack ns; /* custom data for inputs, only UI writes in this */
66
short type, flag; /* type is copy from socket type struct */
67
short limit, stack_index; /* limit for dependency sort, stack_index for exec */
68
short intern; /* intern = tag for group nodes */
69
short stack_index_ext; /* for groups, to find the caller stack index */
74
/* internal data to retrieve relations and groups */
76
int own_index, to_index; /* group socket identifiers, to find matching pairs after reading files */
78
struct bNodeSocket *tosock; /* group-node sockets point to the internal group counterpart sockets, set after read file */
79
struct bNodeLink *link; /* a link pointer, set in nodeSolveOrder() */
88
/* sock->flag, first bit is select */
90
/* only used now for groups... */
95
typedef struct bNodePreview {
101
/* limit data in bNode to what we want to see saved? */
102
typedef struct bNode {
103
struct bNode *next, *prev, *new;
107
short done, level; /* both for dependency and sorting */
108
short lasty, menunr; /* lasty: check preview render status, menunr: browse ID blocks */
109
short stack_index; /* for groupnode, offset in global caller stack */
110
short nr; /* number of this node in list, used for UI exec events */
112
ListBase inputs, outputs;
113
struct ID *id; /* optional link to libdata */
114
void *storage; /* custom data, must be struct, for storage in file */
116
float locx, locy; /* root offset for drawing */
117
float width, miniwidth;
118
short custom1, custom2; /* to be abused for buttons */
120
short need_exec, exec; /* need_exec is set as UI execution event, exec is flag during exec */
122
rctf totr; /* entire boundbox */
123
rctf butr; /* optional buttons area */
124
rctf prvr; /* optional preview area */
125
bNodePreview *preview; /* optional preview image */
127
struct bNodeType *typeinfo; /* lookup of callbacks and defaults */
132
#define NODE_SELECT 1
133
#define NODE_OPTIONS 2
134
#define NODE_PREVIEW 4
135
#define NODE_HIDDEN 8
136
#define NODE_ACTIVE 16
137
#define NODE_ACTIVE_ID 32
138
#define NODE_DO_OUTPUT 64
139
#define NODE_GROUP_EDIT 128
141
typedef struct bNodeLink {
142
struct bNodeLink *next, *prev;
144
bNode *fromnode, *tonode;
145
bNodeSocket *fromsock, *tosock;
149
/* the basis for a Node tree, all links and nodes reside internal here */
150
/* only re-usable node trees are in the library though, materials allocate own tree struct */
151
typedef struct bNodeTree {
154
ListBase nodes, links;
156
bNodeStack *stack; /* stack is only while executing, no read/write in file */
157
bNodeStack *stack1; /* for other thread, easy to expand though... */
159
int type, init; /* set init on fileread */
160
int stacksize; /* amount of elements in stack */
161
int cur_index; /* sockets in groups have unique identifiers, adding new sockets always will increase this counter */
162
struct bNodeType **alltypes; /* type definitions, set on fileread, no read/write */
163
struct bNodeType *owntype; /* for groups or dynamic trees, no read/write */
166
void (*timecursor)(int nr);
167
void (*stats_draw)(char *str);
168
int (*test_break)(void);
171
/* ntree->type, index */
172
#define NTREE_SHADER 0
173
#define NTREE_COMPOSIT 1
175
/* ntree->init, flag */
176
#define NTREE_TYPE_INIT 1
177
#define NTREE_EXEC_INIT 2
179
/* data structs, for node->storage */
181
typedef struct NodeImageAnim {
182
int frames, sfra, nr;
187
typedef struct NodeBlurData {
188
short sizex, sizey, samples, maxspeed, minspeed, pad1;
195
typedef struct NodeHueSat {