~siretart/ubuntu/utopic/blender/libav10

« back to all changes in this revision

Viewing changes to source/blender/blenkernel/BKE_node.h

  • Committer: Package Import Robot
  • Author(s): Matteo F. Vescovi
  • Date: 2012-07-23 08:54:18 UTC
  • mfrom: (14.2.16 sid)
  • mto: (14.2.19 sid)
  • mto: This revision was merged to the branch mainline in revision 42.
  • Revision ID: package-import@ubuntu.com-20120723085418-9foz30v6afaf5ffs
Tags: 2.63a-2
* debian/: Cycles support added (Closes: #658075)
  For now, this top feature has been enabled only
  on [any-amd64 any-i386] architectures because
  of OpenImageIO failing on all others
* debian/: scripts installation path changed
  from /usr/lib to /usr/share:
  + debian/patches/: patchset re-worked for path changing
  + debian/control: "Breaks" field added on yafaray-exporter

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/**
2
 
 * $Id: BKE_node.h 30134 2010-07-08 20:58:34Z bdiego $
3
 
 *
 
1
/*
4
2
 * ***** BEGIN GPL LICENSE BLOCK *****
5
3
 *
6
4
 * This program is free software; you can redistribute it and/or
7
5
 * modify it under the terms of the GNU General Public License
8
6
 * as published by the Free Software Foundation; either version 2
9
 
 * of the License, or (at your option) any later version. The Blender
10
 
 * Foundation also sells licenses for use in proprietary software under
11
 
 * the Blender License.  See http://www.blender.org/BL/ for information
12
 
 * about this.
 
7
 * of the License, or (at your option) any later version.
13
8
 *
14
9
 * This program is distributed in the hope that it will be useful,
15
10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
30
25
 * ***** END GPL LICENSE BLOCK *****
31
26
 */
32
27
 
33
 
#ifndef BKE_NODE_H
34
 
#define BKE_NODE_H
 
28
#ifndef __BKE_NODE_H__
 
29
#define __BKE_NODE_H__
 
30
 
 
31
/** \file BKE_node.h
 
32
 *  \ingroup bke
 
33
 */
 
34
 
 
35
#include "DNA_listBase.h"
 
36
 
 
37
#include "RNA_types.h"
35
38
 
36
39
/* not very important, but the stack solver likes to know a maximum */
37
40
#define MAX_SOCKET      64
38
41
 
39
 
struct ID;
40
 
struct bNodeTree;
 
42
struct bContext;
41
43
struct bNode;
42
44
struct bNodeLink;
43
45
struct bNodeSocket;
44
46
struct bNodeStack;
 
47
struct bNodeTree;
 
48
struct bNodeTreeExec;
 
49
struct GPUMaterial;
 
50
struct GPUNode;
 
51
struct GPUNodeStack;
 
52
struct ID;
 
53
struct ImageFormatData;
 
54
struct ListBase;
 
55
struct Main;
 
56
struct uiBlock;
45
57
struct uiLayout;
 
58
struct MTex;
 
59
struct PointerRNA;
46
60
struct rctf;
47
 
struct ListBase;
48
61
struct RenderData;
49
62
struct Scene;
50
 
struct Main;
51
63
struct Tex;
52
 
struct GPUMaterial;
53
 
struct GPUNode;
54
 
struct GPUNodeStack;
55
 
struct PointerRNA;
56
 
struct bContext;
 
64
struct SpaceNode;
 
65
struct ARegion;
 
66
struct Object;
57
67
 
58
68
/* ************** NODE TYPE DEFINITIONS ***** */
59
69
 
60
 
typedef struct bNodeSocketType {
 
70
/** Compact definition of a node socket.
 
71
 * Can be used to quickly define a list of static sockets for a node,
 
72
 * which are added to each new node of that type. 
 
73
 *
 
74
 * \deprecated New nodes should add default sockets in the initialization
 
75
 * function instead. This struct is mostly kept for old nodes and should
 
76
 * be removed some time.
 
77
 */
 
78
typedef struct bNodeSocketTemplate {
61
79
        int type, limit;
62
 
        char *name;
63
 
        float val1, val2, val3, val4;   /* default alloc value for inputs */
64
 
        float min, max;                                 /* default range for inputs */
 
80
        char name[64];  /* MAX_NAME */
 
81
        float val1, val2, val3, val4;   /* default alloc value for inputs */
 
82
        float min, max;
 
83
        PropertySubType subtype;
 
84
        int flag;
65
85
        
66
86
        /* after this line is used internal only */
67
 
        struct bNodeSocket *sock;               /* used during verify_types */
68
 
        struct bNodeSocket *internsock; /* group nodes, the internal socket counterpart */
69
 
        int own_index;                                  /* verify group nodes */
70
 
        
 
87
        struct bNodeSocket *sock;               /* used to hold verified socket */
 
88
} bNodeSocketTemplate;
 
89
 
 
90
typedef void (*NodeSocketButtonFunction)(const struct bContext *C, struct uiBlock *block, 
 
91
                                                                                 struct bNodeTree *ntree, struct bNode *node, struct bNodeSocket *sock,
 
92
                                                                                 const char *name, int x, int y, int width);
 
93
 
 
94
/** Defines a socket type.
 
95
 * Defines the appearance and behavior of a socket in the UI.
 
96
 */
 
97
typedef struct bNodeSocketType {
 
98
        int type;
 
99
        char ui_name[64];       /* MAX_NAME */
 
100
        char ui_description[128];
 
101
        int ui_icon;
 
102
        char ui_color[4];
 
103
        
 
104
        const char *value_structname;
 
105
        int value_structsize;
 
106
        
 
107
        NodeSocketButtonFunction buttonfunc;
71
108
} bNodeSocketType;
72
109
 
 
110
/** Template for creating a node.
 
111
 * Stored required parameters to make a new node of a specific type.
 
112
 */
 
113
typedef struct bNodeTemplate {
 
114
        int type;
 
115
        
 
116
        struct Main *main;
 
117
        struct Scene *scene;
 
118
        struct bNodeTree *ngroup;       /* group tree */
 
119
} bNodeTemplate;
 
120
 
 
121
/** Defines a node type.
 
122
 * Initial attributes and constants for a node as well as callback functions
 
123
 * implementing the node behavior.
 
124
 */
73
125
typedef struct bNodeType {
74
126
        void *next,*prev;
 
127
        short needs_free;               /* set for allocated types that need to be freed */
 
128
        
75
129
        int type;
76
 
        char *name;
 
130
        char name[64];  /* MAX_NAME */
77
131
        float width, minwidth, maxwidth;
78
 
        short nclass, flag;
 
132
        float height, minheight, maxheight;
 
133
        short nclass, flag, compatibility;
79
134
        
80
 
        bNodeSocketType *inputs, *outputs;
 
135
        /* templates for static sockets */
 
136
        bNodeSocketTemplate *inputs, *outputs;
81
137
        
82
138
        char storagename[64];                   /* struct name for DNA */
83
139
        
 
140
        /// Main draw function for the node.
 
141
        void (*drawfunc)(const struct bContext *C, struct ARegion *ar, struct SpaceNode *snode, struct bNodeTree *ntree, struct bNode *node);
 
142
        /// Updates the node geometry attributes according to internal state before actual drawing.
 
143
        void (*drawupdatefunc)(const struct bContext *C, struct bNodeTree *ntree, struct bNode *node);
 
144
        /// Draw the option buttons on the node.
 
145
        void (*uifunc)(struct uiLayout *, struct bContext *C, struct PointerRNA *ptr);
 
146
        /// Additional parameters in the side panel.
 
147
        void (*uifuncbut)(struct uiLayout *, struct bContext *C, struct PointerRNA *ptr);
 
148
        /// Optional custom label function for the node header.
 
149
        const char *(*labelfunc)(struct bNode *);
 
150
        /// Optional custom resize handle polling.
 
151
        int (*resize_area_func)(struct bNode *node, int x, int y);
 
152
        
 
153
        /// Called when the node is updated in the editor.
 
154
        void (*updatefunc)(struct bNodeTree *ntree, struct bNode *node);
 
155
        /// Check and update if internal ID data has changed.
 
156
        void (*verifyfunc)(struct bNodeTree *ntree, struct bNode *node, struct ID *id);
 
157
        
 
158
        /// Initialize a new node instance of this type after creation.
 
159
        void (*initfunc)(struct bNodeTree *ntree, struct bNode *node, struct bNodeTemplate *ntemp);
 
160
        /// Free the custom storage data.
 
161
        void (*freestoragefunc)(struct bNode *node);
 
162
        /// Make a copy of the custom storage data.
 
163
        void (*copystoragefunc)(struct bNode *node, struct bNode *target);
 
164
        
 
165
        /// Create a template from an existing node.
 
166
        struct bNodeTemplate (*templatefunc)(struct bNode *);
 
167
        /** If a node can be made from the template in the given node tree.
 
168
         * \note Node groups can not be created inside their own node tree.
 
169
         */
 
170
        int (*validfunc)(struct bNodeTree *ntree, struct bNodeTemplate *ntemp);
 
171
        
 
172
        /// Initialize a node tree associated to this node type.
 
173
        void (*inittreefunc)(struct bNodeTree *ntree);
 
174
        /// Update a node tree associated to this node type.
 
175
        void (*updatetreefunc)(struct bNodeTree *ntree);
 
176
        
 
177
        /* group edit callbacks for operators */
 
178
        /* XXX this is going to be changed as required by the UI */
 
179
        struct bNodeTree *(*group_edit_get)(struct bNode *node);
 
180
        struct bNodeTree *(*group_edit_set)(struct bNode *node, int edit);
 
181
        void (*group_edit_clear)(struct bNode *node);
 
182
        
 
183
        /* Generate a temporary list of internal links (bNodeLink), for muting and disconnect operators.
 
184
         * Result must be freed by caller!
 
185
         */
 
186
        ListBase (*internal_connect)(struct bNodeTree *, struct bNode *node);
 
187
        
 
188
        /* **** execution callbacks **** */
 
189
        void *(*initexecfunc)(struct bNode *node);
 
190
        void (*freeexecfunc)(struct bNode *node, void *nodedata);
84
191
        void (*execfunc)(void *data, struct bNode *, struct bNodeStack **, struct bNodeStack **);
85
 
        
86
 
        /* this line is set on startup of blender */
87
 
        void (*uifunc)(struct uiLayout *, struct bContext *C, struct PointerRNA *ptr);
88
 
 
89
 
        void (*initfunc)(struct bNode *);
90
 
        void (*freestoragefunc)(struct bNode *);
91
 
        void (*copystoragefunc)(struct bNode *, struct bNode *);
92
 
        
93
 
        /* for use with dynamic typedefs */
94
 
        ID *id;
95
 
        void *pynode; /* holds pointer to python script */
96
 
        void *pydict; /* holds pointer to python script dictionary (scope)*/
97
 
 
 
192
        /* XXX this alternative exec function has been added to avoid changing all node types.
 
193
         * when a final generic version of execution code is defined, this will be changed anyway
 
194
         */
 
195
        void (*newexecfunc)(void *data, int thread, struct bNode *, void *nodedata, struct bNodeStack **, struct bNodeStack **);
98
196
        /* gpu */
99
197
        int (*gpufunc)(struct GPUMaterial *mat, struct bNode *node, struct GPUNodeStack *in, struct GPUNodeStack *out);
100
 
 
 
198
        /* extended gpu function */
 
199
        int (*gpuextfunc)(struct GPUMaterial *mat, struct bNode *node, void *nodedata, struct GPUNodeStack *in, struct GPUNodeStack *out);
101
200
} bNodeType;
102
201
 
103
202
/* node->exec, now in use for composites (#define for break is same as ready yes) */
108
207
#define NODE_FREEBUFS   8
109
208
#define NODE_SKIPPED    16
110
209
 
 
210
/* sim_exec return value */
 
211
#define NODE_EXEC_FINISHED      0
 
212
#define NODE_EXEC_SUSPEND       1
 
213
 
111
214
/* nodetype->nclass, for add-menu and themes */
112
 
#define NODE_CLASS_INPUT                0
113
 
#define NODE_CLASS_OUTPUT               1
114
 
#define NODE_CLASS_OP_COLOR             3
115
 
#define NODE_CLASS_OP_VECTOR    4
116
 
#define NODE_CLASS_OP_FILTER    5
117
 
#define NODE_CLASS_GROUP                6
118
 
#define NODE_CLASS_FILE                 7
119
 
#define NODE_CLASS_CONVERTOR    8
120
 
#define NODE_CLASS_MATTE                9
121
 
#define NODE_CLASS_DISTORT              10
122
 
#define NODE_CLASS_OP_DYNAMIC   11
123
 
#define NODE_CLASS_PATTERN 12
124
 
#define NODE_CLASS_TEXTURE 13
 
215
#define NODE_CLASS_INPUT                        0
 
216
#define NODE_CLASS_OUTPUT                       1
 
217
#define NODE_CLASS_OP_COLOR                     3
 
218
#define NODE_CLASS_OP_VECTOR            4
 
219
#define NODE_CLASS_OP_FILTER            5
 
220
#define NODE_CLASS_GROUP                        6
 
221
#define NODE_CLASS_FILE                         7
 
222
#define NODE_CLASS_CONVERTOR            8
 
223
#define NODE_CLASS_MATTE                        9
 
224
#define NODE_CLASS_DISTORT                      10
 
225
#define NODE_CLASS_OP_DYNAMIC           11
 
226
#define NODE_CLASS_PATTERN                      12
 
227
#define NODE_CLASS_TEXTURE                      13
 
228
#define NODE_CLASS_EXECUTION            14
 
229
#define NODE_CLASS_GETDATA                      15
 
230
#define NODE_CLASS_SETDATA                      16
 
231
#define NODE_CLASS_MATH                         17
 
232
#define NODE_CLASS_MATH_VECTOR          18
 
233
#define NODE_CLASS_MATH_ROTATION        19
 
234
#define NODE_CLASS_PARTICLES            25
 
235
#define NODE_CLASS_TRANSFORM            30
 
236
#define NODE_CLASS_COMBINE                      31
 
237
#define NODE_CLASS_SHADER                       40
 
238
#define NODE_CLASS_LAYOUT                       100
 
239
 
 
240
/* nodetype->compatibility */
 
241
#define NODE_OLD_SHADING        1
 
242
#define NODE_NEW_SHADING        2
 
243
 
 
244
/* enum values for input/output */
 
245
#define SOCK_IN         1
 
246
#define SOCK_OUT        2
 
247
 
 
248
struct bNodeTreeExec;
 
249
 
 
250
typedef void (*bNodeTreeCallback)(void *calldata, struct ID *owner_id, struct bNodeTree *ntree);
 
251
typedef void (*bNodeClassCallback)(void *calldata, int nclass, const char *name);
 
252
typedef struct bNodeTreeType
 
253
{
 
254
        int type;                                               /* type identifier */
 
255
        char idname[64];                                /* id name for RNA identification */
 
256
        
 
257
        ListBase node_types;                    /* type definitions */
 
258
        
 
259
        /* callbacks */
 
260
        void (*free_cache)(struct bNodeTree *ntree);
 
261
        void (*free_node_cache)(struct bNodeTree *ntree, struct bNode *node);
 
262
        void (*foreach_nodetree)(struct Main *main, void *calldata, bNodeTreeCallback func);            /* iteration over all node trees */
 
263
        void (*foreach_nodeclass)(struct Scene *scene, void *calldata, bNodeClassCallback func);        /* iteration over all node classes */
 
264
 
 
265
        /* calls allowing threaded composite */
 
266
        void (*localize)(struct bNodeTree *localtree, struct bNodeTree *ntree);
 
267
        void (*local_sync)(struct bNodeTree *localtree, struct bNodeTree *ntree);
 
268
        void (*local_merge)(struct bNodeTree *localtree, struct bNodeTree *ntree);
 
269
 
 
270
        /* Tree update. Overrides nodetype->updatetreefunc! */
 
271
        void (*update)(struct bNodeTree *ntree);
 
272
        /* Node update. Overrides nodetype->updatefunc! */
 
273
        void (*update_node)(struct bNodeTree *ntree, struct bNode *node);
 
274
        
 
275
        int (*validate_link)(struct bNodeTree *ntree, struct bNodeLink *link);
 
276
 
 
277
        /* Default internal linking. */
 
278
        ListBase (*internal_connect)(struct bNodeTree *, struct bNode *node);
 
279
} bNodeTreeType;
125
280
 
126
281
/* ************** GENERIC API, TREES *************** */
127
282
 
128
 
void                    ntreeVerifyTypes(struct bNodeTree *ntree);
 
283
struct bNodeTreeType *ntreeGetType(int type);
 
284
struct bNodeType *ntreeGetNodeType(struct bNodeTree *ntree);
 
285
struct bNodeSocketType *ntreeGetSocketType(int type);
129
286
 
130
 
struct bNodeTree *ntreeAddTree(int type);
 
287
struct bNodeTree *ntreeAddTree(const char *name, int type, int nodetype);
131
288
void                    ntreeInitTypes(struct bNodeTree *ntree);
132
289
 
133
 
void                    ntreeMakeOwnType(struct bNodeTree *ntree);
134
 
void                    ntreeUpdateType(struct bNodeTree *ntree, struct bNodeType *ntype);
135
290
void                    ntreeFreeTree(struct bNodeTree *ntree);
136
 
struct bNodeTree *ntreeCopyTree(struct bNodeTree *ntree, int internal_select);
 
291
struct bNodeTree *ntreeCopyTree(struct bNodeTree *ntree);
 
292
void                    ntreeSwitchID(struct bNodeTree *ntree, struct ID *sce_from, struct ID *sce_to);
137
293
void                    ntreeMakeLocal(struct bNodeTree *ntree);
138
 
 
139
 
void                    ntreeSocketUseFlags(struct bNodeTree *ntree);
140
 
 
141
 
void                    ntreeSolveOrder(struct bNodeTree *ntree);
142
 
 
143
 
void                    ntreeBeginExecTree(struct bNodeTree *ntree);
144
 
void                    ntreeExecTree(struct bNodeTree *ntree, void *callerdata, int thread);
145
 
void                    ntreeCompositExecTree(struct bNodeTree *ntree, struct RenderData *rd, int do_previews);
146
 
void                    ntreeEndExecTree(struct bNodeTree *ntree);
147
 
 
 
294
int                             ntreeHasType(struct bNodeTree *ntree, int type);
 
295
 
 
296
void                    ntreeUpdateTree(struct bNodeTree *ntree);
 
297
/* XXX Currently each tree update call does call to ntreeVerifyNodes too.
 
298
 * Some day this should be replaced by a decent depsgraph automatism!
 
299
 */
 
300
void                    ntreeVerifyNodes(struct Main *main, struct ID *id);
 
301
 
 
302
void                    ntreeGetDependencyList(struct bNodeTree *ntree, struct bNode ***deplist, int *totnodes);
 
303
 
 
304
/* XXX old trees handle output flags automatically based on special output node types and last active selection.
 
305
 * new tree types have a per-output socket flag to indicate the final output to use explicitly.
 
306
 */
 
307
void                    ntreeSetOutput(struct bNodeTree *ntree);
148
308
void                    ntreeInitPreview(struct bNodeTree *, int xsize, int ysize);
149
309
void                    ntreeClearPreview(struct bNodeTree *ntree);
150
310
 
151
311
void                    ntreeFreeCache(struct bNodeTree *ntree);
152
 
                                
153
 
                                /* calls allowing threaded composite */
 
312
 
 
313
int                             ntreeNodeExists(struct bNodeTree *ntree, struct bNode *testnode);
 
314
int                             ntreeOutputExists(struct bNode *node, struct bNodeSocket *testsock);
154
315
struct bNodeTree *ntreeLocalize(struct bNodeTree *ntree);
155
316
void                    ntreeLocalSync(struct bNodeTree *localtree, struct bNodeTree *ntree);
156
317
void                    ntreeLocalMerge(struct bNodeTree *localtree, struct bNodeTree *ntree);
157
318
 
158
319
/* ************** GENERIC API, NODES *************** */
159
320
 
160
 
void                    nodeVerifyType(struct bNodeTree *ntree, struct bNode *node);
161
 
 
162
 
void                    nodeAddToPreview(struct bNode *, float *, int, int);
163
 
 
 
321
struct bNodeSocket *nodeAddSocket(struct bNodeTree *ntree, struct bNode *node, int in_out, const char *name, int type);
 
322
struct bNodeSocket *nodeInsertSocket(struct bNodeTree *ntree, struct bNode *node, int in_out, struct bNodeSocket *next_sock, const char *name, int type);
 
323
void nodeRemoveSocket(struct bNodeTree *ntree, struct bNode *node, struct bNodeSocket *sock);
 
324
void nodeRemoveAllSockets(struct bNodeTree *ntree, struct bNode *node);
 
325
 
 
326
void                    nodeAddToPreview(struct bNode *, float *, int, int, int);
 
327
 
 
328
struct bNode    *nodeAddNode(struct bNodeTree *ntree, struct bNodeTemplate *ntemp);
164
329
void                    nodeUnlinkNode(struct bNodeTree *ntree, struct bNode *node);
165
330
void                    nodeUniqueName(struct bNodeTree *ntree, struct bNode *node);
166
 
void                    nodeAddSockets(struct bNode *node, struct bNodeType *ntype);
167
 
struct bNode    *nodeAddNodeType(struct bNodeTree *ntree, int type, struct bNodeTree *ngroup, struct ID *id);
168
 
void                    nodeRegisterType(struct ListBase *typelist, const struct bNodeType *ntype) ;
169
 
void                    nodeUpdateType(struct bNodeTree *ntree, struct bNode* node, struct bNodeType *ntype);
 
331
 
 
332
void                    nodeRegisterType(struct bNodeTreeType *ttype, struct bNodeType *ntype);
170
333
void                    nodeMakeDynamicType(struct bNode *node);
171
334
int                             nodeDynamicUnlinkText(struct ID *txtid);
 
335
 
172
336
void                    nodeFreeNode(struct bNodeTree *ntree, struct bNode *node);
173
 
struct bNode    *nodeCopyNode(struct bNodeTree *ntree, struct bNode *node, int internal);
 
337
struct bNode    *nodeCopyNode(struct bNodeTree *ntree, struct bNode *node);
174
338
 
175
339
struct bNodeLink *nodeAddLink(struct bNodeTree *ntree, struct bNode *fromnode, struct bNodeSocket *fromsock, struct bNode *tonode, struct bNodeSocket *tosock);
176
340
void                    nodeRemLink(struct bNodeTree *ntree, struct bNodeLink *link);
177
341
void                    nodeRemSocketLinks(struct bNodeTree *ntree, struct bNodeSocket *sock);
 
342
void                    nodeInternalRelink(struct bNodeTree *ntree, struct bNode *node);
 
343
 
 
344
void                    nodeSpaceCoords(struct bNode *node, float *locx, float *locy);
 
345
void                    nodeAttachNode(struct bNode *node, struct bNode *parent);
 
346
void                    nodeDetachNode(struct bNode *node);
178
347
 
179
348
struct bNode    *nodeFindNodebyName(struct bNodeTree *ntree, const char *name);
180
 
int                     nodeFindNode(struct bNodeTree *ntree, struct bNodeSocket *sock, struct bNode **nodep, int *sockindex);
 
349
int                             nodeFindNode(struct bNodeTree *ntree, struct bNodeSocket *sock, struct bNode **nodep, int *sockindex, int *in_out);
181
350
 
182
351
struct bNodeLink *nodeFindLink(struct bNodeTree *ntree, struct bNodeSocket *from, struct bNodeSocket *to);
183
352
int                             nodeCountSocketLinks(struct bNodeTree *ntree, struct bNodeSocket *sock);
187
356
struct bNode    *nodeGetActiveID(struct bNodeTree *ntree, short idtype);
188
357
int                             nodeSetActiveID(struct bNodeTree *ntree, short idtype, struct ID *id);
189
358
void                    nodeClearActiveID(struct bNodeTree *ntree, short idtype);
190
 
 
191
 
void                    NodeTagChanged(struct bNodeTree *ntree, struct bNode *node);
192
 
void                    NodeTagIDChanged(struct bNodeTree *ntree, struct ID *id);
193
 
 
194
 
/* ************** Groups ****************** */
195
 
 
196
 
struct bNode    *nodeMakeGroupFromSelected(struct bNodeTree *ntree);
197
 
int                             nodeGroupUnGroup(struct bNodeTree *ntree, struct bNode *gnode);
198
 
 
199
 
void                    nodeVerifyGroup(struct bNodeTree *ngroup);
200
 
void                    nodeGroupSocketUseFlags(struct bNodeTree *ngroup);
201
 
 
202
 
void                    nodeCopyGroup(struct bNode *gnode);
 
359
struct bNode    *nodeGetActiveTexture(struct bNodeTree *ntree);
 
360
 
 
361
void                    nodeUpdate(struct bNodeTree *ntree, struct bNode *node);
 
362
int                             nodeUpdateID(struct bNodeTree *ntree, struct ID *id);
 
363
 
 
364
void                    nodeFreePreview(struct bNode *node);
 
365
 
 
366
int                             nodeSocketIsHidden(struct bNodeSocket *sock);
 
367
void                    nodeSocketSetType(struct bNodeSocket *sock, int type);
 
368
 
 
369
/* ************** NODE TYPE ACCESS *************** */
 
370
 
 
371
struct bNodeTemplate nodeMakeTemplate(struct bNode *node);
 
372
int                             nodeValid(struct bNodeTree *ntree, struct bNodeTemplate *ntemp);
 
373
const char*             nodeLabel(struct bNode *node);
 
374
struct bNodeTree *nodeGroupEditGet(struct bNode *node);
 
375
struct bNodeTree *nodeGroupEditSet(struct bNode *node, int edit);
 
376
void                    nodeGroupEditClear(struct bNode *node);
 
377
 
 
378
/* Init a new node type struct with default values and callbacks */
 
379
void                    node_type_base(struct bNodeTreeType *ttype, struct bNodeType *ntype, int type,
 
380
                               const char *name, short nclass, short flag);
 
381
void                    node_type_socket_templates(struct bNodeType *ntype, struct bNodeSocketTemplate *inputs, struct bNodeSocketTemplate *outputs);
 
382
void                    node_type_size(struct bNodeType *ntype, int width, int minwidth, int maxwidth);
 
383
void                    node_type_init(struct bNodeType *ntype, void (*initfunc)(struct bNodeTree *ntree, struct bNode *node, struct bNodeTemplate *ntemp));
 
384
void                    node_type_valid(struct bNodeType *ntype, int (*validfunc)(struct bNodeTree *ntree, struct bNodeTemplate *ntemp));
 
385
void                    node_type_storage(struct bNodeType *ntype,
 
386
                                                                  const char *storagename,
 
387
                                                                  void (*freestoragefunc)(struct bNode *),
 
388
                                                                  void (*copystoragefunc)(struct bNode *, struct bNode *));
 
389
void                    node_type_label(struct bNodeType *ntype, const char *(*labelfunc)(struct bNode *));
 
390
void                    node_type_template(struct bNodeType *ntype, struct bNodeTemplate (*templatefunc)(struct bNode *));
 
391
void                    node_type_update(struct bNodeType *ntype,
 
392
                                                                 void (*updatefunc)(struct bNodeTree *ntree, struct bNode *node),
 
393
                                                                 void (*verifyfunc)(struct bNodeTree *ntree, struct bNode *node, struct ID *id));
 
394
void                    node_type_tree(struct bNodeType *ntype,
 
395
                                                           void (*inittreefunc)(struct bNodeTree *),
 
396
                                                           void (*updatetreefunc)(struct bNodeTree *));
 
397
void                    node_type_group_edit(struct bNodeType *ntype,
 
398
                                                                         struct bNodeTree *(*group_edit_get)(struct bNode *node),
 
399
                                                                         struct bNodeTree *(*group_edit_set)(struct bNode *node, int edit),
 
400
                                                                         void (*group_edit_clear)(struct bNode *node));
 
401
 
 
402
void                    node_type_exec(struct bNodeType *ntype, void (*execfunc)(void *data, struct bNode *, struct bNodeStack **,
 
403
                                                                         struct bNodeStack **));
 
404
void                    node_type_exec_new(struct bNodeType *ntype,
 
405
                                                                   void *(*initexecfunc)(struct bNode *node),
 
406
                                                                   void (*freeexecfunc)(struct bNode *node, void *nodedata),
 
407
                                                                   void (*newexecfunc)(void *data, int thread, struct bNode *, void *nodedata,
 
408
                                                                                       struct bNodeStack **, struct bNodeStack **));
 
409
void                    node_type_internal_connect(struct bNodeType *ntype, ListBase (*internal_connect)(struct bNodeTree *, struct bNode *));
 
410
void                    node_type_gpu(struct bNodeType *ntype, int (*gpufunc)(struct GPUMaterial *mat, struct bNode *node,
 
411
                                                                      struct GPUNodeStack *in, struct GPUNodeStack *out));
 
412
void                    node_type_gpu_ext(struct bNodeType *ntype, int (*gpuextfunc)(struct GPUMaterial *mat, struct bNode *node,
 
413
                                                                             void *nodedata, struct GPUNodeStack *in,
 
414
                                                                             struct GPUNodeStack *out));
 
415
void                    node_type_compatibility(struct bNodeType *ntype, short compatibility);
203
416
 
204
417
/* ************** COMMON NODES *************** */
205
418
 
206
419
#define NODE_GROUP              2
207
 
#define NODE_GROUP_MENU         1000
208
 
#define NODE_DYNAMIC_MENU       4000
209
 
 
210
 
extern bNodeType node_group_typeinfo;
211
 
 
 
420
#define NODE_FORLOOP    3
 
421
#define NODE_WHILELOOP  4
 
422
#define NODE_FRAME              5
 
423
#define NODE_GROUP_MENU         10000
 
424
#define NODE_DYNAMIC_MENU       20000
 
425
 
 
426
/* look up a socket on a group node by the internal group socket */
 
427
struct bNodeSocket *node_group_find_input(struct bNode *gnode, struct bNodeSocket *gsock);
 
428
struct bNodeSocket *node_group_find_output(struct bNode *gnode, struct bNodeSocket *gsock);
 
429
 
 
430
struct bNodeSocket *node_group_add_socket(struct bNodeTree *ngroup, const char *name, int type, int in_out);
 
431
struct bNodeSocket *node_group_expose_socket(struct bNodeTree *ngroup, struct bNodeSocket *sock, int in_out);
 
432
void node_group_expose_all_sockets(struct bNodeTree *ngroup);
 
433
void node_group_remove_socket(struct bNodeTree *ngroup, struct bNodeSocket *gsock, int in_out);
 
434
 
 
435
struct bNode    *node_group_make_from_selected(struct bNodeTree *ntree);
 
436
int                             node_group_ungroup(struct bNodeTree *ntree, struct bNode *gnode);
 
437
 
 
438
/* in node_common.c */
 
439
void register_node_type_frame(struct bNodeTreeType *ttype);
212
440
 
213
441
/* ************** SHADER NODES *************** */
214
442
 
244
472
#define SH_NODE_HUE_SAT         122
245
473
#define NODE_DYNAMIC            123
246
474
 
 
475
#define SH_NODE_OUTPUT_MATERIAL                 124
 
476
#define SH_NODE_OUTPUT_WORLD                    125
 
477
#define SH_NODE_OUTPUT_LAMP                             126
 
478
#define SH_NODE_FRESNEL                                 127
 
479
#define SH_NODE_MIX_SHADER                              128
 
480
#define SH_NODE_ATTRIBUTE                               129
 
481
#define SH_NODE_BACKGROUND                              130
 
482
#define SH_NODE_BSDF_ANISOTROPIC                131
 
483
#define SH_NODE_BSDF_DIFFUSE                    132
 
484
#define SH_NODE_BSDF_GLOSSY                             133
 
485
#define SH_NODE_BSDF_GLASS                              134
 
486
#define SH_NODE_BSDF_TRANSLUCENT                137
 
487
#define SH_NODE_BSDF_TRANSPARENT                138
 
488
#define SH_NODE_BSDF_VELVET                             139
 
489
#define SH_NODE_EMISSION                                140
 
490
#define SH_NODE_NEW_GEOMETRY                    141
 
491
#define SH_NODE_LIGHT_PATH                              142
 
492
#define SH_NODE_TEX_IMAGE                               143
 
493
#define SH_NODE_TEX_SKY                                 145
 
494
#define SH_NODE_TEX_GRADIENT                    146
 
495
#define SH_NODE_TEX_VORONOI                             147
 
496
#define SH_NODE_TEX_MAGIC                               148
 
497
#define SH_NODE_TEX_WAVE                                149
 
498
#define SH_NODE_TEX_NOISE                               150
 
499
#define SH_NODE_TEX_MUSGRAVE                    152
 
500
#define SH_NODE_TEX_COORD                               155
 
501
#define SH_NODE_ADD_SHADER                              156
 
502
#define SH_NODE_TEX_ENVIRONMENT                 157
 
503
#define SH_NODE_OUTPUT_TEXTURE                  158
 
504
#define SH_NODE_HOLDOUT                                 159
 
505
#define SH_NODE_LAYER_WEIGHT                    160
 
506
#define SH_NODE_VOLUME_TRANSPARENT              161
 
507
#define SH_NODE_VOLUME_ISOTROPIC                162
 
508
#define SH_NODE_GAMMA                           163
 
509
#define SH_NODE_TEX_CHECKER                     164
 
510
#define SH_NODE_BRIGHTCONTRAST                  165
 
511
 
247
512
/* custom defines options for Material node */
248
513
#define SH_NODE_MAT_DIFF   1
249
514
#define SH_NODE_MAT_SPEC   2
258
523
#define NODE_DYNAMIC_REPARSE    6 /* 64 */
259
524
#define NODE_DYNAMIC_SET        15 /* sign */
260
525
 
261
 
/* the type definitions array */
262
 
extern struct ListBase node_all_shaders;
263
 
 
264
526
/* API */
265
527
 
 
528
struct bNodeTreeExec *ntreeShaderBeginExecTree(struct bNodeTree *ntree, int use_tree_data);
 
529
void                    ntreeShaderEndExecTree(struct bNodeTreeExec *exec, int use_tree_data);
266
530
void                    ntreeShaderExecTree(struct bNodeTree *ntree, struct ShadeInput *shi, struct ShadeResult *shr);
267
531
void                    ntreeShaderGetTexcoMode(struct bNodeTree *ntree, int osa, short *texco, int *mode);
268
532
void                    nodeShaderSynchronizeID(struct bNode *node, int copyto);
277
541
/* ************** COMPOSITE NODES *************** */
278
542
 
279
543
/* output socket defines */
280
 
#define RRES_OUT_IMAGE          0
281
 
#define RRES_OUT_ALPHA          1
282
 
#define RRES_OUT_Z                      2
283
 
#define RRES_OUT_NORMAL         3
284
 
#define RRES_OUT_UV                     4
285
 
#define RRES_OUT_VEC            5
286
 
#define RRES_OUT_RGBA           6
287
 
#define RRES_OUT_DIFF           7
288
 
#define RRES_OUT_SPEC           8
289
 
#define RRES_OUT_SHADOW         9
290
 
#define RRES_OUT_AO                     10
291
 
#define RRES_OUT_REFLECT        11
292
 
#define RRES_OUT_REFRACT        12
293
 
#define RRES_OUT_INDIRECT       13
294
 
#define RRES_OUT_INDEXOB        14
295
 
#define RRES_OUT_MIST           15
296
 
#define RRES_OUT_EMIT           16
297
 
#define RRES_OUT_ENV            17
 
544
#define RRES_OUT_IMAGE                          0
 
545
#define RRES_OUT_ALPHA                          1
 
546
#define RRES_OUT_Z                                      2
 
547
#define RRES_OUT_NORMAL                         3
 
548
#define RRES_OUT_UV                                     4
 
549
#define RRES_OUT_VEC                            5
 
550
#define RRES_OUT_RGBA                           6
 
551
#define RRES_OUT_DIFF                           7
 
552
#define RRES_OUT_SPEC                           8
 
553
#define RRES_OUT_SHADOW                         9
 
554
#define RRES_OUT_AO                                     10
 
555
#define RRES_OUT_REFLECT                        11
 
556
#define RRES_OUT_REFRACT                        12
 
557
#define RRES_OUT_INDIRECT                       13
 
558
#define RRES_OUT_INDEXOB                        14
 
559
#define RRES_OUT_INDEXMA                        15
 
560
#define RRES_OUT_MIST                           16
 
561
#define RRES_OUT_EMIT                           17
 
562
#define RRES_OUT_ENV                            18
 
563
#define RRES_OUT_DIFF_DIRECT            19
 
564
#define RRES_OUT_DIFF_INDIRECT          20
 
565
#define RRES_OUT_DIFF_COLOR                     21
 
566
#define RRES_OUT_GLOSSY_DIRECT          22
 
567
#define RRES_OUT_GLOSSY_INDIRECT        23
 
568
#define RRES_OUT_GLOSSY_COLOR           24
 
569
#define RRES_OUT_TRANSM_DIRECT          25
 
570
#define RRES_OUT_TRANSM_INDIRECT        26
 
571
#define RRES_OUT_TRANSM_COLOR           27
298
572
 
299
573
/* note: types are needed to restore callbacks, don't change values */
300
574
#define CMP_NODE_VIEWER         201
358
632
#define CMP_NODE_COLOR_MATTE 259
359
633
#define CMP_NODE_COLORBALANCE 260
360
634
#define CMP_NODE_HUECORRECT 261
 
635
#define CMP_NODE_MOVIECLIP      262
 
636
#define CMP_NODE_STABILIZE2D    263
 
637
#define CMP_NODE_TRANSFORM      264
 
638
#define CMP_NODE_MOVIEDISTORTION        265
 
639
#define CMP_NODE_DOUBLEEDGEMASK    266
 
640
#define CMP_NODE_OUTPUT_MULTI_FILE__DEPRECATED  267     /* DEPRECATED multi file node has been merged into regular CMP_NODE_OUTPUT_FILE */
361
641
 
362
642
#define CMP_NODE_GLARE          301
363
643
#define CMP_NODE_TONEMAP        302
386
666
#define CMP_SCALE_RENDERPERCENT 3
387
667
 
388
668
 
389
 
/* the type definitions array */
390
 
extern struct ListBase node_all_composit;
391
 
 
392
669
/* API */
393
670
struct CompBuf;
 
671
struct bNodeTreeExec *ntreeCompositBeginExecTree(struct bNodeTree *ntree, int use_tree_data);
 
672
void ntreeCompositEndExecTree(struct bNodeTreeExec *exec, int use_tree_data);
 
673
void ntreeCompositExecTree(struct bNodeTree *ntree, struct RenderData *rd, int do_previews);
394
674
void ntreeCompositTagRender(struct Scene *sce);
395
675
int ntreeCompositTagAnimated(struct bNodeTree *ntree);
396
676
void ntreeCompositTagGenerators(struct bNodeTree *ntree);
397
677
void ntreeCompositForceHidden(struct bNodeTree *ntree, struct Scene *scene);
398
 
 
399
 
void free_compbuf(struct CompBuf *cbuf); /* internal...*/
400
 
 
 
678
void ntreeCompositClearTags(struct bNodeTree *ntree);
 
679
 
 
680
struct bNodeSocket *ntreeCompositOutputFileAddSocket(struct bNodeTree *ntree, struct bNode *node,
 
681
                                                     const char *name, struct ImageFormatData *im_format);
 
682
int ntreeCompositOutputFileRemoveActiveSocket(struct bNodeTree *ntree, struct bNode *node);
401
683
 
402
684
/* ************** TEXTURE NODES *************** */
403
685
 
431
713
#define TEX_NODE_PROC      500
432
714
#define TEX_NODE_PROC_MAX  600
433
715
 
434
 
extern struct ListBase node_all_textures;
435
 
 
436
716
/* API */
437
717
int  ntreeTexTagAnimated(struct bNodeTree *ntree);
438
 
void ntreeTexSetPreviewFlag(int);
 
718
void ntreeTexCheckCyclics(struct bNodeTree *ntree);
 
719
 
 
720
struct bNodeTreeExec *ntreeTexBeginExecTree(struct bNodeTree *ntree, int use_tree_data);
 
721
void ntreeTexEndExecTree(struct bNodeTreeExec *exec, int use_tree_data);
439
722
int ntreeTexExecTree(struct bNodeTree *ntree, struct TexResult *target, float *coord, float *dxt, float *dyt, int osatex, short thread, struct Tex *tex, short which_output, int cfra, int preview, struct ShadeInput *shi, struct MTex *mtex);
440
 
void ntreeTexCheckCyclics(struct bNodeTree *ntree);
441
 
char* ntreeTexOutputMenu(struct bNodeTree *ntree);
442
 
 
443
 
 
444
 
/**/
 
723
 
 
724
 
 
725
/*************************************************/
445
726
 
446
727
void init_nodesystem(void);
447
728
void free_nodesystem(void);
448
729
 
449
 
/**/
450
 
 
451
730
void clear_scene_in_nodes(struct Main *bmain, struct Scene *sce);
452
731
 
453
732
#endif