Blender V2.61 - r43446

node_exec.h

Go to the documentation of this file.
00001 /*
00002  * ***** BEGIN GPL LICENSE BLOCK *****
00003  *
00004  * This program is free software; you can redistribute it and/or
00005  * modify it under the terms of the GNU General Public License
00006  * as published by the Free Software Foundation; either version 2
00007  * of the License, or (at your option) any later version. 
00008  *
00009  * This program is distributed in the hope that it will be useful,
00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  * GNU General Public License for more details.
00013  *
00014  * You should have received a copy of the GNU General Public License
00015  * along with this program; if not, write to the Free Software Foundation,
00016  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00017  *
00018  * The Original Code is Copyright (C) 2007 Blender Foundation.
00019  * All rights reserved.
00020  *
00021  * The Original Code is: all of this file.
00022  *
00023  * Contributor(s): Nathan Letwory.
00024  *
00025  * ***** END GPL LICENSE BLOCK *****
00026  */
00027 
00033 #ifndef NODE_EXEC_H_
00034 #define NODE_EXEC_H_
00035 
00036 #include "DNA_listBase.h"
00037 
00038 #include "BLI_utildefines.h"
00039 
00040 #include "BKE_node.h"
00041 
00042 #include "RNA_types.h"
00043 
00044 struct bNodeTree;
00045 struct bNode;
00046 struct bNodeStack;
00047 
00048 /* Node execution data */
00049 typedef struct bNodeExec {
00050     struct bNode *node;             /* backpointer to node */
00051     void *data;                     /* custom data storage */
00052 } bNodeExec;
00053 
00054 /* Execution Data for each instance of node tree execution */
00055 typedef struct bNodeTreeExec {
00056     struct bNodeTree *nodetree;     /* backpointer to node tree */
00057     
00058     int totnodes;       /* total node count */
00059     struct bNodeExec *nodeexec;     /* per-node execution data */
00060     
00061     int stacksize;
00062     struct bNodeStack *stack;       /* socket data stack */
00063     /* only used by material and texture trees to keep one stack for each thread */
00064     ListBase *threadstack;      /* one instance of the stack for each thread */
00065 } bNodeTreeExec;
00066 
00067 /* stores one stack copy for each thread (material and texture trees) */
00068 typedef struct bNodeThreadStack {
00069     struct bNodeThreadStack *next, *prev;
00070     struct bNodeStack *stack;
00071     int used;
00072 } bNodeThreadStack;
00073 
00074 struct bNodeStack *node_get_socket_stack(struct bNodeStack *stack, struct bNodeSocket *sock);
00075 void node_get_stack(struct bNode *node, struct bNodeStack *stack, struct bNodeStack **in, struct bNodeStack **out);
00076 void node_init_input_index(struct bNodeSocket *sock, int *index);
00077 void node_init_output_index(struct bNodeSocket *sock, int *index);
00078 
00079 struct bNodeTreeExec *ntree_exec_begin(struct bNodeTree *ntree);
00080 void ntree_exec_end(struct bNodeTreeExec *exec);
00081 
00082 void ntreeExecNodes(struct bNodeTreeExec *exec, void *callerdata, int thread);
00083 
00084 struct bNodeThreadStack *ntreeGetThreadStack(struct bNodeTreeExec *exec, int thread);
00085 void ntreeReleaseThreadStack(struct bNodeThreadStack *nts);
00086 void ntreeExecThreadNodes(struct bNodeTreeExec *exec, struct bNodeThreadStack *nts, void *callerdata, int thread);
00087 
00088 #endif