diff options
Diffstat (limited to 'source/blender/blenkernel/BKE_node.h')
-rw-r--r-- | source/blender/blenkernel/BKE_node.h | 57 |
1 files changed, 40 insertions, 17 deletions
diff --git a/source/blender/blenkernel/BKE_node.h b/source/blender/blenkernel/BKE_node.h index 4bd4cc3792f..41e41eab78f 100644 --- a/source/blender/blenkernel/BKE_node.h +++ b/source/blender/blenkernel/BKE_node.h @@ -1,4 +1,4 @@ -/** +/* * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** @@ -33,6 +33,10 @@ #ifndef BKE_NODE_H #define BKE_NODE_H +/** \file BKE_node.h + * \ingroup bke + */ + /* not very important, but the stack solver likes to know a maximum */ #define MAX_SOCKET 64 @@ -61,21 +65,18 @@ struct uiLayout; typedef struct bNodeSocketType { int type, limit; - char *name; + const char *name; float val1, val2, val3, val4; /* default alloc value for inputs */ float min, max; /* default range for inputs */ /* after this line is used internal only */ struct bNodeSocket *sock; /* used during verify_types */ - struct bNodeSocket *internsock; /* group nodes, the internal socket counterpart */ - int own_index; /* verify group nodes */ - } bNodeSocketType; typedef struct bNodeType { void *next,*prev; int type; - char *name; + const char *name; /* can be allocated too */ float width, minwidth, maxwidth; short nclass, flag; @@ -87,6 +88,7 @@ typedef struct bNodeType { /* this line is set on startup of blender */ void (*uifunc)(struct uiLayout *, struct bContext *C, struct PointerRNA *ptr); + const char *(*labelfunc)(struct bNode *); void (*initfunc)(struct bNode *); void (*freestoragefunc)(struct bNode *); @@ -125,17 +127,21 @@ typedef struct bNodeType { #define NODE_CLASS_PATTERN 12 #define NODE_CLASS_TEXTURE 13 +/* enum values for input/output */ +#define SOCK_IN 1 +#define SOCK_OUT 2 + /* ************** GENERIC API, TREES *************** */ void ntreeVerifyTypes(struct bNodeTree *ntree); -struct bNodeTree *ntreeAddTree(int type); +struct bNodeTree *ntreeAddTree(const char *name, int type, const short is_group); void ntreeInitTypes(struct bNodeTree *ntree); -void ntreeMakeOwnType(struct bNodeTree *ntree); +//void ntreeMakeGroupSockets(struct bNodeTree *ntree); void ntreeUpdateType(struct bNodeTree *ntree, struct bNodeType *ntype); void ntreeFreeTree(struct bNodeTree *ntree); -struct bNodeTree *ntreeCopyTree(struct bNodeTree *ntree, int internal_select); +struct bNodeTree *ntreeCopyTree(struct bNodeTree *ntree); void ntreeSwitchID(struct bNodeTree *ntree, struct ID *sce_from, struct ID *sce_to); void ntreeMakeLocal(struct bNodeTree *ntree); @@ -173,14 +179,14 @@ void nodeUpdateType(struct bNodeTree *ntree, struct bNode* node, struct bNodeT void nodeMakeDynamicType(struct bNode *node); int nodeDynamicUnlinkText(struct ID *txtid); void nodeFreeNode(struct bNodeTree *ntree, struct bNode *node); -struct bNode *nodeCopyNode(struct bNodeTree *ntree, struct bNode *node, int internal); +struct bNode *nodeCopyNode(struct bNodeTree *ntree, struct bNode *node); struct bNodeLink *nodeAddLink(struct bNodeTree *ntree, struct bNode *fromnode, struct bNodeSocket *fromsock, struct bNode *tonode, struct bNodeSocket *tosock); void nodeRemLink(struct bNodeTree *ntree, struct bNodeLink *link); void nodeRemSocketLinks(struct bNodeTree *ntree, struct bNodeSocket *sock); struct bNode *nodeFindNodebyName(struct bNodeTree *ntree, const char *name); -int nodeFindNode(struct bNodeTree *ntree, struct bNodeSocket *sock, struct bNode **nodep, int *sockindex); +int nodeFindNode(struct bNodeTree *ntree, struct bNodeSocket *sock, struct bNode **nodep, int *sockindex, int *in_out); struct bNodeLink *nodeFindLink(struct bNodeTree *ntree, struct bNodeSocket *from, struct bNodeSocket *to); int nodeCountSocketLinks(struct bNodeTree *ntree, struct bNodeSocket *sock); @@ -192,26 +198,44 @@ int nodeSetActiveID(struct bNodeTree *ntree, short idtype, struct ID *id); void nodeClearActiveID(struct bNodeTree *ntree, short idtype); void NodeTagChanged(struct bNodeTree *ntree, struct bNode *node); -void NodeTagIDChanged(struct bNodeTree *ntree, struct ID *id); +int NodeTagIDChanged(struct bNodeTree *ntree, struct ID *id); +void ntreeClearTags(struct bNodeTree *ntree); /* ************** Groups ****************** */ struct bNode *nodeMakeGroupFromSelected(struct bNodeTree *ntree); int nodeGroupUnGroup(struct bNodeTree *ntree, struct bNode *gnode); -void nodeVerifyGroup(struct bNodeTree *ngroup); +void nodeGroupVerify(struct bNodeTree *ngroup); void nodeGroupSocketUseFlags(struct bNodeTree *ngroup); -void nodeCopyGroup(struct bNode *gnode); +void nodeGroupCopy(struct bNode *gnode); + +struct bNodeSocket *nodeGroupAddSocket(struct bNodeTree *ngroup, const char *name, int type, int in_out); +struct bNodeSocket *nodeGroupExposeSocket(struct bNodeTree *ngroup, struct bNodeSocket *sock, int in_out); +void nodeGroupExposeAllSockets(struct bNodeTree *ngroup); +void nodeGroupRemoveSocket(struct bNodeTree *ngroup, struct bNodeSocket *gsock, int in_out); /* ************** COMMON NODES *************** */ +/* Init a new node type struct with default values and callbacks */ +void node_type_base(struct bNodeType *ntype, int type, const char *name, short nclass, short flag, + struct bNodeSocketType *inputs, struct bNodeSocketType *outputs); +void node_type_size(struct bNodeType *ntype, int width, int minwidth, int maxwidth); +void node_type_init(struct bNodeType *ntype, void (*initfunc)(struct bNode *)); +void node_type_storage(struct bNodeType *ntype, + const char *storagename, + void (*freestoragefunc)(struct bNode *), + void (*copystoragefunc)(struct bNode *, struct bNode *)); +void node_type_exec(struct bNodeType *ntype, void (*execfunc)(void *data, struct bNode *, struct bNodeStack **, struct bNodeStack **)); +void node_type_gpu(struct bNodeType *ntype, int (*gpufunc)(struct GPUMaterial *mat, struct bNode *node, struct GPUNodeStack *in, struct GPUNodeStack *out)); +void node_type_label(struct bNodeType *ntype, const char *(*labelfunc)(struct bNode *)); + #define NODE_GROUP 2 #define NODE_GROUP_MENU 1000 #define NODE_DYNAMIC_MENU 4000 -extern bNodeType node_group_typeinfo; - +void register_node_type_group(ListBase *lb); /* ************** SHADER NODES *************** */ @@ -399,7 +423,6 @@ int ntreeCompositTagAnimated(struct bNodeTree *ntree); void ntreeCompositTagGenerators(struct bNodeTree *ntree); void ntreeCompositForceHidden(struct bNodeTree *ntree, struct Scene *scene); -void free_compbuf(struct CompBuf *cbuf); /* internal...*/ /* ************** TEXTURE NODES *************** */ |