=== Node editor ===
authorNathan Letwory <nathan@letworyinteractive.com>
Wed, 4 Apr 2007 13:58:12 +0000 (13:58 +0000)
committerNathan Letwory <nathan@letworyinteractive.com>
Wed, 4 Apr 2007 13:58:12 +0000 (13:58 +0000)
* refactor copying and freeing of node->storage by handlerizing them.
  - freestoragefunc
  - copystoragefunc
  - node_util.c/h have generic handlers for these.

60 files changed:
source/blender/blenkernel/BKE_node.h
source/blender/blenkernel/intern/node.c
source/blender/nodes/intern/CMP_nodes/CMP_alphaOver.c
source/blender/nodes/intern/CMP_nodes/CMP_blur.c
source/blender/nodes/intern/CMP_nodes/CMP_channelMatte.c
source/blender/nodes/intern/CMP_nodes/CMP_chromaMatte.c
source/blender/nodes/intern/CMP_nodes/CMP_colorSpill.c
source/blender/nodes/intern/CMP_nodes/CMP_composite.c
source/blender/nodes/intern/CMP_nodes/CMP_curves.c
source/blender/nodes/intern/CMP_nodes/CMP_defocus.c
source/blender/nodes/intern/CMP_nodes/CMP_diffMatte.c
source/blender/nodes/intern/CMP_nodes/CMP_dilate.c
source/blender/nodes/intern/CMP_nodes/CMP_displace.c
source/blender/nodes/intern/CMP_nodes/CMP_filter.c
source/blender/nodes/intern/CMP_nodes/CMP_flip.c
source/blender/nodes/intern/CMP_nodes/CMP_hueSatVal.c
source/blender/nodes/intern/CMP_nodes/CMP_idMask.c
source/blender/nodes/intern/CMP_nodes/CMP_image.c
source/blender/nodes/intern/CMP_nodes/CMP_lummaMatte.c
source/blender/nodes/intern/CMP_nodes/CMP_mapUV.c
source/blender/nodes/intern/CMP_nodes/CMP_mapValue.c
source/blender/nodes/intern/CMP_nodes/CMP_math.c
source/blender/nodes/intern/CMP_nodes/CMP_mixrgb.c
source/blender/nodes/intern/CMP_nodes/CMP_normal.c
source/blender/nodes/intern/CMP_nodes/CMP_outputFile.c
source/blender/nodes/intern/CMP_nodes/CMP_rgb.c
source/blender/nodes/intern/CMP_nodes/CMP_rotate.c
source/blender/nodes/intern/CMP_nodes/CMP_scale.c
source/blender/nodes/intern/CMP_nodes/CMP_sepcombHSVA.c
source/blender/nodes/intern/CMP_nodes/CMP_sepcombRGBA.c
source/blender/nodes/intern/CMP_nodes/CMP_sepcombYCCA.c
source/blender/nodes/intern/CMP_nodes/CMP_sepcombYUVA.c
source/blender/nodes/intern/CMP_nodes/CMP_setalpha.c
source/blender/nodes/intern/CMP_nodes/CMP_splitViewer.c
source/blender/nodes/intern/CMP_nodes/CMP_texture.c
source/blender/nodes/intern/CMP_nodes/CMP_translate.c
source/blender/nodes/intern/CMP_nodes/CMP_valToRgb.c
source/blender/nodes/intern/CMP_nodes/CMP_value.c
source/blender/nodes/intern/CMP_nodes/CMP_vecBlur.c
source/blender/nodes/intern/CMP_nodes/CMP_viewer.c
source/blender/nodes/intern/CMP_nodes/CMP_zcombine.c
source/blender/nodes/intern/CMP_util.h
source/blender/nodes/intern/SHD_nodes/SHD_camera.c
source/blender/nodes/intern/SHD_nodes/SHD_curves.c
source/blender/nodes/intern/SHD_nodes/SHD_geom.c
source/blender/nodes/intern/SHD_nodes/SHD_mapping.c
source/blender/nodes/intern/SHD_nodes/SHD_material.c
source/blender/nodes/intern/SHD_nodes/SHD_math.c
source/blender/nodes/intern/SHD_nodes/SHD_mixRgb.c
source/blender/nodes/intern/SHD_nodes/SHD_normal.c
source/blender/nodes/intern/SHD_nodes/SHD_output.c
source/blender/nodes/intern/SHD_nodes/SHD_rgb.c
source/blender/nodes/intern/SHD_nodes/SHD_squeeze.c
source/blender/nodes/intern/SHD_nodes/SHD_texture.c
source/blender/nodes/intern/SHD_nodes/SHD_valToRgb.c
source/blender/nodes/intern/SHD_nodes/SHD_value.c
source/blender/nodes/intern/SHD_nodes/SHD_vectMath.c
source/blender/nodes/intern/SHD_util.h
source/blender/nodes/intern/node_util.c [new file with mode: 0644]
source/blender/nodes/intern/node_util.h [new file with mode: 0644]

index 63bdc08..cde75f2 100644 (file)
@@ -78,10 +78,17 @@ typedef struct bNodeType {
        
        void (*execfunc)(void *data, struct bNode *, struct bNodeStack **, struct bNodeStack **);
        
-       /* after this line is set on startup of blender */
+       /* this line is set on startup of blender */
        int (*butfunc)(struct uiBlock *, struct bNodeTree *, struct bNode *, struct rctf *);
 
-   void (*initfunc)(struct bNode *);
+       void (*initfunc)(struct bNode *);
+       void (*freestoragefunc)(struct bNode *);
+       void (*copystoragefunc)(struct bNode *, struct bNode *);
+       
+       /* for use with dynamic typedefs */
+       ID *id;
+       void *script; /* holds pointer to python script */
+       void *dict; /* holds pointer to python script dictionary (scope)*/
 
 } bNodeType;
 
index 8f954e5..1f4da92 100644 (file)
@@ -239,7 +239,7 @@ void ntreeVerifyTypes(bNodeTree *ntree)
 /* ************** Group stuff ********** */
 
 bNodeType node_group_typeinfo= {
-       /* next,prev   */   NULL, NULL,
+       /* next,prev   */       NULL, NULL,
        /* type code   */       NODE_GROUP,
        /* name        */       "Group",
        /* width+range */       120, 60, 200,
@@ -248,8 +248,11 @@ bNodeType node_group_typeinfo= {
        /* output sock */       NULL,
        /* storage     */       "",
        /* execfunc    */       NULL,
-       /* butfunc         */   NULL,
-       /* initfunc    */   NULL
+       /* butfunc     */       NULL,
+       /* initfunc    */       NULL,
+       /* freestoragefunc    */        NULL,
+       /* copystoragefunc    */        NULL,
+       /* id          */       NULL
 };
 
 /* tag internal sockets */
@@ -349,13 +352,13 @@ void ntreeMakeOwnType(bNodeTree *ngroup)
        }
        
        /* make own type struct */
-       ngroup->owntype= MEM_mallocN(sizeof(bNodeType), "group type");
+       ngroup->owntype= MEM_callocN(sizeof(bNodeType), "group type");
        *ngroup->owntype= node_group_typeinfo; /* copy data, for init */
        
        /* input type arrays */
        if(totin) {
                bNodeSocketType *stype;
-               bNodeSocketType *inputs= MEM_mallocN(sizeof(bNodeSocketType)*(totin+1), "bNodeSocketType");
+               bNodeSocketType *inputs= MEM_callocN(sizeof(bNodeSocketType)*(totin+1), "bNodeSocketType");
                a= 0;
                
                for(node= ngroup->nodes.first; node; node= node->next) {
@@ -380,7 +383,7 @@ void ntreeMakeOwnType(bNodeTree *ngroup)
        /* output type arrays */
        if(totout) {
                bNodeSocketType *stype;
-               bNodeSocketType *outputs= MEM_mallocN(sizeof(bNodeSocketType)*(totout+1), "bNodeSocketType");
+               bNodeSocketType *outputs= MEM_callocN(sizeof(bNodeSocketType)*(totout+1), "bNodeSocketType");
                a= 0;
                
                for(node= ngroup->nodes.first; node; node= node->next) {
@@ -817,23 +820,8 @@ bNode *nodeCopyNode(struct bNodeTree *ntree, struct bNode *node)
        if(nnode->id)
                nnode->id->us++;
        
-       if(nnode->storage) {
-               /* another candidate for handlerizing! */
-               if(ntree->type==NTREE_SHADER) {
-                       if(node->type==SH_NODE_CURVE_VEC || node->type==SH_NODE_CURVE_RGB)
-                               nnode->storage= curvemapping_copy(node->storage);
-                       else 
-                               nnode->storage= MEM_dupallocN(nnode->storage);
-               }
-               else if(ntree->type==NTREE_COMPOSIT) {
-                       if(ELEM3(node->type, CMP_NODE_TIME, CMP_NODE_CURVE_VEC, CMP_NODE_CURVE_RGB))
-                               nnode->storage= curvemapping_copy(node->storage);
-                       else 
-                               nnode->storage= MEM_dupallocN(nnode->storage);
-               }
-               else 
-                       nnode->storage= MEM_dupallocN(nnode->storage);
-       }
+       if(node->typeinfo->copystoragefunc)
+               node->typeinfo->copystoragefunc(node, nnode);
        
        node->new_node= nnode;
        nnode->new_node= NULL;
@@ -1012,22 +1000,8 @@ void nodeFreeNode(bNodeTree *ntree, bNode *node)
                        MEM_freeN(node->preview->rect);
                MEM_freeN(node->preview);
        }
-       if(node->storage) {
-               /* could be handlerized at some point, now only 1 exception still */
-               if(ntree->type==NTREE_SHADER) {
-                       if(node->type==SH_NODE_CURVE_VEC || node->type==SH_NODE_CURVE_RGB)
-                               curvemapping_free(node->storage);
-                       else 
-                               MEM_freeN(node->storage);
-               }
-               else if(ntree->type==NTREE_COMPOSIT) {
-                       if(ELEM3(node->type, CMP_NODE_TIME, CMP_NODE_CURVE_VEC, CMP_NODE_CURVE_RGB))
-                               curvemapping_free(node->storage);
-                       else 
-                               MEM_freeN(node->storage);
-               }
-               else 
-                       MEM_freeN(node->storage);
+       if(node->typeinfo && node->typeinfo->freestoragefunc) {
+               node->typeinfo->freestoragefunc(node);
        }
        MEM_freeN(node);
 }
index 16ed447..aedaa03 100644 (file)
@@ -117,8 +117,11 @@ bNodeType cmp_node_alphaover= {
        /* output sock */       cmp_node_alphaover_out,
        /* storage     */       "",
        /* execfunc    */       node_composit_exec_alphaover,
-       /* butfunc     */       NULL,
-       /*initfunc     */   NULL
+       /* butfunc     */       NULL,
+       /* initfunc    */       NULL,
+       /* freestoragefunc    */        NULL,
+       /* copystoragefunc    */        NULL,
+       /* id          */       NULL
        
 };
 
index 4b0a077..4d9f2e3 100644 (file)
@@ -629,16 +629,19 @@ static void node_composit_init_blur(bNode* node)
 
 bNodeType cmp_node_blur= {
        /* *next,*prev */       NULL, NULL,
-   /* type code   */   CMP_NODE_BLUR,
-   /* name        */   "Blur",
-   /* width+range */   120, 80, 200,
-   /* class+opts  */   NODE_CLASS_OP_FILTER, NODE_OPTIONS,
-   /* input sock  */   cmp_node_blur_in,
-   /* output sock */   cmp_node_blur_out,
-   /* storage     */   "NodeBlurData",
-   /* execfunc    */   node_composit_exec_blur,
-   /* butfunc     */   NULL,
-       /*initfunc    */    node_composit_init_blur
+       /* type code   */       CMP_NODE_BLUR,
+       /* name        */       "Blur",
+       /* width+range */       120, 80, 200,
+       /* class+opts  */       NODE_CLASS_OP_FILTER, NODE_OPTIONS,
+       /* input sock  */       cmp_node_blur_in,
+       /* output sock */       cmp_node_blur_out,
+       /* storage     */       "NodeBlurData",
+       /* execfunc    */       node_composit_exec_blur,
+       /* butfunc     */       NULL,
+       /* initfunc    */       node_composit_init_blur,
+       /* freestoragefunc    */        node_free_standard_storage,
+       /* copystoragefunc    */        node_copy_standard_storage,
+       /* id          */       NULL
 };
 
 
index 0a833e5..d0cc4e5 100644 (file)
@@ -191,14 +191,17 @@ static void node_composit_init_channel_matte(bNode *node)
 
 bNodeType cmp_node_channel_matte={
        /* *next,*prev */       NULL, NULL,
-   /* type code   */       CMP_NODE_CHANNEL_MATTE,
-   /* name        */       "Channel Key",
-   /* width+range */       200, 80, 250,
-   /* class+opts  */       NODE_CLASS_MATTE, NODE_PREVIEW|NODE_OPTIONS,
-   /* input sock  */       cmp_node_channel_matte_in,
-   /* output sock */       cmp_node_channel_matte_out,
-   /* storage     */       "NodeChroma",
-   /* execfunc    */       node_composit_exec_channel_matte,
-   /* butfunc     */       NULL,
-                           node_composit_init_channel_matte
+       /* type code   */       CMP_NODE_CHANNEL_MATTE,
+       /* name        */       "Channel Key",
+       /* width+range */       200, 80, 250,
+       /* class+opts  */       NODE_CLASS_MATTE, NODE_PREVIEW|NODE_OPTIONS,
+       /* input sock  */       cmp_node_channel_matte_in,
+       /* output sock */       cmp_node_channel_matte_out,
+       /* storage     */       "NodeChroma",
+       /* execfunc    */       node_composit_exec_channel_matte,
+       /* butfunc     */       NULL,
+       /* initfunc    */       node_composit_init_channel_matte,
+       /* freestoragefunc    */        node_free_standard_storage,
+       /* copystoragefunc    */        node_copy_standard_storage,
+       /* id          */       NULL
 };
index e1eb442..d836a82 100644 (file)
@@ -174,16 +174,19 @@ static void node_composit_init_chroma_matte(bNode *node)
 
 bNodeType cmp_node_chroma={
        /* *next,*prev */       NULL, NULL,
-   /* type code   */       CMP_NODE_CHROMA,
-   /* name        */       "Chroma Key",
-   /* width+range */       200, 80, 300,
-   /* class+opts  */       NODE_CLASS_MATTE, NODE_PREVIEW|NODE_OPTIONS,
-   /* input sock  */       cmp_node_chroma_in,
-   /* output sock */       cmp_node_chroma_out,
-   /* storage     */       "NodeChroma",
-   /* execfunc    */       node_composit_exec_chroma_matte,
-   /* butfunc     */       NULL,
-                           node_composit_init_chroma_matte
+       /* type code   */       CMP_NODE_CHROMA,
+       /* name        */       "Chroma Key",
+       /* width+range */       200, 80, 300,
+       /* class+opts  */       NODE_CLASS_MATTE, NODE_PREVIEW|NODE_OPTIONS,
+       /* input sock  */       cmp_node_chroma_in,
+       /* output sock */       cmp_node_chroma_out,
+       /* storage     */       "NodeChroma",
+       /* execfunc    */       node_composit_exec_chroma_matte,
+       /* butfunc     */       NULL,
+       /* initfunc    */       node_composit_init_chroma_matte,
+       /* freestoragefunc    */        node_free_standard_storage,
+       /* copystoragefunc    */        node_copy_standard_storage,
+       /* id          */       NULL
 };
 
 
index 3c2054e..152180a 100644 (file)
@@ -123,19 +123,22 @@ static void node_composit_init_color_spill(bNode *node)
    c->fsize= 0.0f;
    c->fstrength= 0.0f;
    node->custom1= 2; /* green channel */
-};
+}
 
 bNodeType cmp_node_color_spill={
        /* *next,*prev */       NULL, NULL,
-   /* type code   */       CMP_NODE_COLOR_SPILL,
-   /* name        */       "Color Spill",
-   /* width+range */       140, 80, 200,
-   /* class+opts  */       NODE_CLASS_MATTE, NODE_OPTIONS,
-   /* input sock  */       cmp_node_color_spill_in,
-   /* output sock */       cmp_node_color_spill_out,
-   /* storage     */       "NodeChroma",
-   /* execfunc    */       node_composit_exec_color_spill,
-   /* butfunc     */       NULL,
-                           node_composit_init_color_spill
+       /* type code   */       CMP_NODE_COLOR_SPILL,
+       /* name        */       "Color Spill",
+       /* width+range */       140, 80, 200,
+       /* class+opts  */       NODE_CLASS_MATTE, NODE_OPTIONS,
+       /* input sock  */       cmp_node_color_spill_in,
+       /* output sock */       cmp_node_color_spill_out,
+       /* storage     */       "NodeChroma",
+       /* execfunc    */       node_composit_exec_color_spill,
+       /* butfunc     */       NULL,
+       /* initfunc    */       node_composit_init_color_spill,
+       /* freestoragefunc    */        node_free_standard_storage,
+       /* copystoragefunc    */        node_copy_standard_storage,
+       /* id          */       NULL
 };
 
index 3177152..89bd8e4 100644 (file)
@@ -97,6 +97,9 @@ bNodeType cmp_node_composite= {
        /* output sock */       NULL,
        /* storage     */       "",
        /* execfunc    */       node_composit_exec_composite,
-    /* butfunc     */  NULL,
-       /*initfunc        */    NULL
+       /* butfunc     */       NULL,
+       /* initfunc    */       NULL,
+       /* freestoragefunc    */        NULL,
+       /* copystoragefunc    */        NULL,
+       /* id          */       NULL
 };
index 7f0310d..754d016 100644 (file)
@@ -68,8 +68,11 @@ bNodeType cmp_node_curve_time= {
        /* output sock */       cmp_node_time_out,
        /* storage     */       "CurveMapping",
        /* execfunc    */       node_composit_exec_curves_time,
-       /* butfunc     */       NULL,
-       /* initfunc    */       node_composit_init_curves_time
+       /* butfunc     */       NULL,
+       /* initfunc    */       node_composit_init_curves_time,
+       /* freestoragefunc    */        node_free_curves,
+       /* copystoragefunc    */        node_copy_curves,
+       /* id          */       NULL
 };
 
 
@@ -108,8 +111,11 @@ bNodeType cmp_node_curve_vec= {
        /* output sock */       cmp_node_curve_vec_out,
        /* storage     */       "CurveMapping",
        /* execfunc    */       node_composit_exec_curve_vec,
-       /* butfunc     */       NULL,
-       /* initfunc    */       node_composit_init_curve_vec
+       /* butfunc     */       NULL,
+       /* initfunc    */       node_composit_init_curve_vec,
+       /* freestoragefunc    */        node_free_curves,
+       /* copystoragefunc    */        node_copy_curves,
+       /* id          */       NULL
        
 };
 
@@ -191,7 +197,10 @@ bNodeType cmp_node_curve_rgb= {
        /* output sock */       cmp_node_curve_rgb_out,
        /* storage     */       "CurveMapping",
        /* execfunc    */       node_composit_exec_curve_rgb,
-       /* butfunc     */       NULL,
-       /* initfunc    */       node_composit_init_curve_rgb    
+       /* butfunc     */       NULL,
+       /* initfunc    */       node_composit_init_curve_rgb,
+       /* freestoragefunc    */        node_free_curves,
+       /* copystoragefunc    */        node_copy_curves,
+       /* id          */       NULL
 };
 
index edefd0f..2573639 100644 (file)
@@ -811,7 +811,7 @@ static void node_composit_init_defocus(bNode* node)
    nbd->scale = 1.f;
    nbd->no_zbuf = 1;
    node->storage = nbd;
-};
+}
 
 bNodeType cmp_node_defocus = {
        /* *next,*prev */       NULL, NULL,
@@ -823,8 +823,11 @@ bNodeType cmp_node_defocus = {
        /* output sock */       cmp_node_defocus_out,
        /* storage     */       "NodeDefocus",
        /* execfunc    */       node_composit_exec_defocus,
-       /* butfunc     */       NULL,
-       /* initfunc    */       node_composit_init_defocus
+       /* butfunc     */       NULL,
+       /* initfunc    */       node_composit_init_defocus,
+       /* freestoragefunc    */        node_free_standard_storage,
+       /* copystoragefunc    */        node_copy_standard_storage,
+       /* id          */       NULL
 };
 
 
index 1af5b94..ade2111 100644 (file)
@@ -199,16 +199,19 @@ static void node_composit_init_diff_matte(bNode *node)
 
 bNodeType cmp_node_diff_matte={
        /* *next,*prev */       NULL, NULL,
-       /* type code   */       CMP_NODE_DIFF_MATTE,
-       /* name        */       "Difference Key",
-       /* width+range */       200, 80, 250,
-       /* class+opts  */       NODE_CLASS_MATTE, NODE_PREVIEW|NODE_OPTIONS,
-       /* input sock  */       cmp_node_diff_matte_in,
-       /* output sock */       cmp_node_diff_matte_out,
-       /* storage     */       "NodeChroma",
-       /* execfunc    */       node_composit_exec_diff_matte,
-    /* butfunc     */       NULL,
-    /* initfunc    */       node_composit_init_diff_matte
+       /* type code   */       CMP_NODE_DIFF_MATTE,
+       /* name        */       "Difference Key",
+       /* width+range */       200, 80, 250,
+       /* class+opts  */       NODE_CLASS_MATTE, NODE_PREVIEW|NODE_OPTIONS,
+       /* input sock  */       cmp_node_diff_matte_in,
+       /* output sock */       cmp_node_diff_matte_out,
+       /* storage     */       "NodeChroma",
+       /* execfunc    */       node_composit_exec_diff_matte,
+       /* butfunc     */       NULL,
+       /* initfunc    */       node_composit_init_diff_matte,
+       /* freestoragefunc    */        node_free_standard_storage,
+       /* copystoragefunc    */        node_copy_standard_storage,
+       /* id          */       NULL
 };
 
 
index bb79a4c..8143043 100644 (file)
@@ -153,8 +153,11 @@ bNodeType cmp_node_dilateerode= {
        /* output sock */       cmp_node_dilateerode_out,
        /* storage     */       "",
        /* execfunc    */       node_composit_exec_dilateerode,
-    /* butfunc     */   NULL,
-       /* initfunc        */   NULL
+       /* butfunc     */       NULL,
+       /* initfunc    */       NULL,
+       /* freestoragefunc    */        NULL,
+       /* copystoragefunc    */        NULL,
+       /* id          */       NULL
 };
 
 
index a873948..0ec15d9 100644 (file)
@@ -154,7 +154,10 @@ bNodeType cmp_node_displace= {
        /* output sock */       cmp_node_displace_out,
        /* storage     */       "",
        /* execfunc    */       node_composit_exec_displace, 
-       /* butfunc     */       NULL,
-       /* initfunc    */       NULL
+       /* butfunc     */       NULL,
+       /* initfunc    */       NULL,
+       /* freestoragefunc    */        NULL,
+       /* copystoragefunc    */        NULL,
+       /* id          */       NULL
 };
 
index 7f578c5..46a9d74 100644 (file)
@@ -224,8 +224,11 @@ bNodeType cmp_node_filter= {
        /* output sock */       cmp_node_filter_out,
        /* storage     */       "", 
        /* execfunc    */       node_composit_exec_filter,
-       /* butfunc     */   NULL,
-       /* initfunc        */   NULL
+       /* butfunc     */       NULL,
+       /* initfunc    */       NULL,
+       /* freestoragefunc    */        NULL,
+       /* copystoragefunc    */        NULL,
+       /* id          */       NULL
        
 };
 
index f44b890..cd6fdf7 100644 (file)
@@ -95,8 +95,11 @@ bNodeType cmp_node_flip= {
        /* output sock */       cmp_node_flip_out,
        /* storage     */       "",
        /* execfunc    */       node_composit_exec_flip,
-       /* butfunc     */   NULL,
-       /* initfunc        */   NULL
+       /* butfunc     */       NULL,
+       /* initfunc    */       NULL,
+       /* freestoragefunc    */        NULL,
+       /* copystoragefunc    */        NULL,
+       /* id          */       NULL
 };
 
 
index d4258bd..eeddb4c 100644 (file)
@@ -111,8 +111,11 @@ bNodeType cmp_node_hue_sat= {
        /* output sock */       cmp_node_hue_sat_out,
        /* storage     */       "NodeHueSat", 
        /* execfunc    */       node_composit_exec_hue_sat,
-       /* butfunc     */   NULL,
-       /* initfunc    */   node_composit_init_hue_sat
+       /* butfunc     */       NULL,
+       /* initfunc    */       node_composit_init_hue_sat,
+       /* freestoragefunc    */        node_free_standard_storage,
+       /* copystoragefunc    */        node_copy_standard_storage,
+       /* id          */       NULL
        
 };
 
index d4e6b06..abb9fa9 100644 (file)
@@ -94,8 +94,11 @@ bNodeType cmp_node_idmask= {
        /* output sock */       cmp_node_idmask_out,
        /* storage     */       "",
        /* execfunc    */       node_composit_exec_idmask,
-       /* butfunc     */   NULL,
-       /* initfunc        */   NULL
+       /* butfunc     */       NULL,
+       /* initfunc    */       NULL,
+       /* freestoragefunc    */        NULL,
+       /* copystoragefunc    */        NULL,
+       /* id          */       NULL
 };
 
 
index 29845d8..20308e9 100644 (file)
@@ -212,16 +212,19 @@ static void node_composit_init_image(bNode* node)
 
 bNodeType cmp_node_image= {
        /* *next,*prev */       NULL, NULL,
-   /* type code   */   CMP_NODE_IMAGE,
-   /* name        */   "Image",
-   /* width+range */   120, 80, 300,
-   /* class+opts  */   NODE_CLASS_INPUT, NODE_PREVIEW|NODE_OPTIONS,
-   /* input sock  */   NULL,
-   /* output sock */   cmp_node_rlayers_out,
-   /* storage     */   "ImageUser",
-   /* execfunc    */   node_composit_exec_image,
-   /* butfunc     */    NULL,
-       /* initfunc   */    node_composit_init_image
+       /* type code   */       CMP_NODE_IMAGE,
+       /* name        */       "Image",
+       /* width+range */       120, 80, 300,
+       /* class+opts  */       NODE_CLASS_INPUT, NODE_PREVIEW|NODE_OPTIONS,
+       /* input sock  */       NULL,
+       /* output sock */       cmp_node_rlayers_out,
+       /* storage     */       "ImageUser",
+       /* execfunc    */       node_composit_exec_image,
+       /* butfunc     */       NULL,
+       /* initfunc    */       node_composit_init_image,
+       /* freestoragefunc    */        node_free_standard_storage,
+       /* copystoragefunc    */        node_copy_standard_storage,
+       /* id          */       NULL
 };
 
 /* **************** RENDER RESULT ******************** */
@@ -330,16 +333,19 @@ static void node_composit_exec_rlayers(void *data, bNode *node, bNodeStack **in,
 
 bNodeType cmp_node_rlayers= {
        /* *next,*prev */       NULL, NULL,
-   /* type code   */   CMP_NODE_R_LAYERS,
-   /* name        */   "Render Layers",
-   /* width+range */   150, 100, 300,
-   /* class+opts  */   NODE_CLASS_INPUT, NODE_PREVIEW|NODE_OPTIONS,
-   /* input sock  */   NULL,
-   /* output sock */   cmp_node_rlayers_out,
-   /* storage     */   "",
-   /* execfunc    */   node_composit_exec_rlayers,
-   /* butfunc     */    NULL,
-       /* initfunc   */        NULL
+       /* type code   */       CMP_NODE_R_LAYERS,
+       /* name        */       "Render Layers",
+       /* width+range */       150, 100, 300,
+       /* class+opts  */       NODE_CLASS_INPUT, NODE_PREVIEW|NODE_OPTIONS,
+       /* input sock  */       NULL,
+       /* output sock */       cmp_node_rlayers_out,
+       /* storage     */       "",
+       /* execfunc    */       node_composit_exec_rlayers,
+       /* butfunc     */       NULL,
+       /* initfunc    */       NULL,
+       /* freestoragefunc    */        NULL,
+       /* copystoragefunc    */        NULL,
+       /* id          */       NULL
 
 };
 
index d909e47..973d74d 100644 (file)
@@ -105,15 +105,18 @@ static void node_composit_init_luma_matte(bNode *node)
 
 bNodeType cmp_node_luma_matte={
        /* *next,*prev */       NULL, NULL,
-       /* type code   */       CMP_NODE_LUMA_MATTE,
-       /* name        */       "Luminance Key",
-       /* width+range */       200, 80, 250,
-       /* class+opts  */       NODE_CLASS_MATTE, NODE_PREVIEW|NODE_OPTIONS,
-       /* input sock  */       cmp_node_luma_matte_in,
-       /* output sock */       cmp_node_luma_matte_out,
-       /* storage     */       "NodeChroma",
-       /* execfunc    */       node_composit_exec_luma_matte,
-       /* butfunc     */       NULL,
-       /* initfunc    */               node_composit_init_luma_matte
+       /* type code   */       CMP_NODE_LUMA_MATTE,
+       /* name        */       "Luminance Key",
+       /* width+range */       200, 80, 250,
+       /* class+opts  */       NODE_CLASS_MATTE, NODE_PREVIEW|NODE_OPTIONS,
+       /* input sock  */       cmp_node_luma_matte_in,
+       /* output sock */       cmp_node_luma_matte_out,
+       /* storage     */       "NodeChroma",
+       /* execfunc    */       node_composit_exec_luma_matte,
+       /* butfunc     */       NULL,
+       /* initfunc    */       node_composit_init_luma_matte,
+       /* freestoragefunc    */        node_free_standard_storage,
+       /* copystoragefunc    */        node_copy_standard_storage,
+       /* id          */       NULL
 };
 
index 4c7b440..ae3e587 100644 (file)
@@ -140,7 +140,10 @@ bNodeType cmp_node_mapuv= {
        /* storage     */       "",
        /* execfunc    */       node_composit_exec_mapuv,
        /* butfunc     */       NULL,
-       /* initfunc    */       NULL
+       /* initfunc    */       NULL,
+       /* freestoragefunc    */        NULL,
+       /* copystoragefunc    */        NULL,
+       /* id          */       NULL
 };
 
 
index 97faa94..8f0f962 100644 (file)
@@ -89,8 +89,11 @@ bNodeType cmp_node_map_value= {
        /* output sock */       cmp_node_map_value_out,
        /* storage     */       "TexMapping",
        /* execfunc    */       node_composit_exec_map_value,
-    /* butfunc     */  NULL,
-       /* initfunc        */   node_composit_init_map_value
+       /* butfunc     */       NULL,
+       /* initfunc    */       node_composit_init_map_value,
+       /* freestoragefunc    */        node_free_standard_storage,
+       /* copystoragefunc    */        node_copy_standard_storage,
+       /* id          */       NULL
        
 };
 
index 7515dff..27d7da1 100644 (file)
@@ -168,8 +168,11 @@ bNodeType cmp_node_math= {
        /* output sock */       cmp_node_math_out,
        /* storage     */       "",
        /* execfunc    */       node_composit_exec_math,
-       /* butfunc     */       NULL,
-       /* initfunc        */   NULL
+       /* butfunc     */       NULL,
+       /* initfunc    */       NULL,
+       /* freestoragefunc    */        NULL,
+       /* copystoragefunc    */        NULL,
+       /* id          */       NULL
 };
 
 
index 6a0cd63..790b24a 100644 (file)
@@ -87,7 +87,10 @@ bNodeType cmp_node_mix_rgb= {
        /* output sock */       cmp_node_mix_rgb_out,
        /* storage     */       "", 
        /* execfunc    */       node_composit_exec_mix_rgb,
-       /* butfunc     */       NULL,
-       /* initfunc    */   NULL
+       /* butfunc     */       NULL,
+       /* initfunc    */       NULL,
+       /* freestoragefunc    */        NULL,
+       /* copystoragefunc    */        NULL,
+       /* id          */       NULL
        
 };
index d1b3aa5..5219b22 100644 (file)
@@ -87,8 +87,11 @@ bNodeType cmp_node_normal= {
        /* output sock */       cmp_node_normal_out,
        /* storage     */       "",
        /* execfunc    */       node_composit_exec_normal,
-       /* butfunc     */       NULL,
-       /* initfunc    */       NULL
+       /* butfunc     */       NULL,
+       /* initfunc    */       NULL,
+       /* freestoragefunc    */        NULL,
+       /* copystoragefunc    */        NULL,
+       /* id          */       NULL
        
 };
 
index 94b6772..722b00d 100644 (file)
@@ -102,7 +102,10 @@ bNodeType cmp_node_output_file= {
        /* storage     */       "NodeImageFile",
        /* execfunc    */       node_composit_exec_output_file,
        /* butfunc     */       NULL,
-       /* initfunc    */       node_composit_init_output_file
+       /* initfunc    */       node_composit_init_output_file,
+       /* freestoragefunc    */        node_free_standard_storage,
+       /* copystoragefunc    */        node_copy_standard_storage,
+       /* id          */       NULL
        
 };
 
index 1c690ef..ae2678d 100644 (file)
@@ -54,7 +54,10 @@ bNodeType cmp_node_rgb= {
        /* storage     */       "",
        /* execfunc    */       node_composit_exec_rgb,
        /* butfunc     */       NULL,
-       /* initfunc        */   NULL
+       /* initfunc    */       NULL,
+       /* freestoragefunc    */        NULL,
+       /* copystoragefunc    */        NULL,
+       /* id          */       NULL
        
 };
 
index c09fe56..d32c2cc 100644 (file)
@@ -142,6 +142,9 @@ bNodeType cmp_node_rotate= {
        /* output sock */       cmp_node_rotate_out,
        /* storage     */       "",
        /* execfunc    */       node_composit_exec_rotate,
-       /* butfunc     */       NULL,
-       /* initfunc    */       NULL
+       /* butfunc     */       NULL,
+       /* initfunc    */       NULL,
+       /* freestoragefunc    */        NULL,
+       /* copystoragefunc    */        NULL,
+       /* id          */       NULL
 };
index 244a5d0..a8477f4 100644 (file)
@@ -111,8 +111,11 @@ bNodeType cmp_node_scale= {
        /* output sock */       cmp_node_scale_out,
        /* storage     */       "",
        /* execfunc    */       node_composit_exec_scale,
-       /* butfunc     */       NULL,
-       /* initfunc        */   NULL
+       /* butfunc     */       NULL,
+       /* initfunc    */       NULL,
+       /* freestoragefunc    */        NULL,
+       /* copystoragefunc    */        NULL,
+       /* id          */       NULL
 };
 
 
index 50eedca..e759872 100644 (file)
@@ -106,8 +106,11 @@ bNodeType cmp_node_sephsva= {
        /* output sock */       cmp_node_sephsva_out,
        /* storage     */       "",
        /* execfunc    */       node_composit_exec_sephsva,
-       /* butfunc     */       NULL,
-       /* initfunc    */   NULL
+       /* butfunc     */       NULL,
+       /* initfunc    */       NULL,
+       /* freestoragefunc    */        NULL,
+       /* copystoragefunc    */        NULL,
+       /* id          */       NULL
        
 };
 
@@ -170,16 +173,19 @@ static void node_composit_exec_combhsva(void *data, bNode *node, bNodeStack **in
 
 bNodeType cmp_node_combhsva= {
        /* *next,*prev */       NULL, NULL,
-   /* type code   */   CMP_NODE_COMBHSVA,
-   /* name        */   "Combine HSVA",
-   /* width+range */   80, 40, 140,
-   /* class+opts  */   NODE_CLASS_CONVERTOR, NODE_OPTIONS,
-   /* input sock  */   cmp_node_combhsva_in,
-   /* output sock */   cmp_node_combhsva_out,
-   /* storage     */   "",
-   /* execfunc    */   node_composit_exec_combhsva,
-       /* butfunc     */       NULL,
-       /* initfunc    */   NULL
+       /* type code   */       CMP_NODE_COMBHSVA,
+       /* name        */       "Combine HSVA",
+       /* width+range */       80, 40, 140,
+       /* class+opts  */       NODE_CLASS_CONVERTOR, NODE_OPTIONS,
+       /* input sock  */       cmp_node_combhsva_in,
+       /* output sock */       cmp_node_combhsva_out,
+       /* storage     */       "",
+       /* execfunc    */       node_composit_exec_combhsva,
+       /* butfunc     */       NULL,
+       /* initfunc    */       NULL,
+       /* freestoragefunc    */        NULL,
+       /* copystoragefunc    */        NULL,
+       /* id          */       NULL
 };
 
 
index 50643cd..08546c1 100644 (file)
@@ -84,8 +84,11 @@ bNodeType cmp_node_seprgba= {
        /* output sock */       cmp_node_seprgba_out,
        /* storage     */       "",
        /* execfunc    */       node_composit_exec_seprgba,
-       /* butfunc     */       NULL,
-       /* initfunc    */   NULL
+       /* butfunc     */       NULL,
+       /* initfunc    */       NULL,
+       /* freestoragefunc    */        NULL,
+       /* copystoragefunc    */        NULL,
+       /* id          */       NULL
        
 };
 
@@ -154,8 +157,11 @@ bNodeType cmp_node_combrgba= {
        /* output sock */       cmp_node_combrgba_out,
        /* storage     */       "",
        /* execfunc    */       node_composit_exec_combrgba,
-       /* butfunc     */       NULL,
-       /* initfunc    */   NULL
+       /* butfunc     */       NULL,
+       /* initfunc    */       NULL,
+       /* freestoragefunc    */        NULL,
+       /* copystoragefunc    */        NULL,
+       /* id          */       NULL
        
 };
 
index 342a8e4..6802fab 100644 (file)
@@ -96,17 +96,20 @@ static void node_composit_exec_sepycca(void *data, bNode *node, bNodeStack **in,
 }
 
 bNodeType cmp_node_sepycca= {
-       /* *next,*prev */ NULL, NULL,
-       /* type code   */ CMP_NODE_SEPYCCA,
-       /* name        */ "Separate YCbCrA",
-       /* width+range */ 80, 40, 140,
-       /* class+opts  */ NODE_CLASS_CONVERTOR, 0,
-       /* input sock  */ cmp_node_sepycca_in,
-       /* output sock */ cmp_node_sepycca_out,
-       /* storage     */ "",
-       /* execfunc    */ node_composit_exec_sepycca,
-       /* butfunc     */       NULL,
-       /* initfunc    */   NULL
+       /* *next,*prev */       NULL, NULL,
+       /* type code   */       CMP_NODE_SEPYCCA,
+       /* name        */       "Separate YCbCrA",
+       /* width+range */       80, 40, 140,
+       /* class+opts  */       NODE_CLASS_CONVERTOR, 0,
+       /* input sock  */       cmp_node_sepycca_in,
+       /* output sock */       cmp_node_sepycca_out,
+       /* storage     */       "",
+       /* execfunc    */       node_composit_exec_sepycca,
+       /* butfunc     */       NULL,
+       /* initfunc    */       NULL,
+       /* freestoragefunc    */        NULL,
+       /* copystoragefunc    */        NULL,
+       /* id          */       NULL
 };
 
 
@@ -184,8 +187,11 @@ bNodeType cmp_node_combycca= {
        /* output sock */       cmp_node_combycca_out,
        /* storage     */       "",
        /* execfunc    */       node_composit_exec_combycca,
-       /* butfunc     */       NULL,
-       /* initfunc    */   NULL
+       /* butfunc     */       NULL,
+       /* initfunc    */       NULL,
+       /* freestoragefunc    */        NULL,
+       /* copystoragefunc    */        NULL,
+       /* id          */       NULL
 };
 
 
index ec171b6..08027c5 100644 (file)
@@ -98,16 +98,19 @@ static void node_composit_exec_sepyuva(void *data, bNode *node, bNodeStack **in,
 
 bNodeType cmp_node_sepyuva= {
        /* *next,*prev */       NULL, NULL,
-       /* type code   */ CMP_NODE_SEPYUVA,
-       /* name        */ "Separate YUVA",
-       /* width+range */ 80, 40, 140,
-       /* class+opts  */ NODE_CLASS_CONVERTOR, 0,
-       /* input sock  */ cmp_node_sepyuva_in,
-       /* output sock */ cmp_node_sepyuva_out,
-       /* storage     */ "",
-       /* execfunc    */ node_composit_exec_sepyuva,
-       /* butfunc     */       NULL,
-       /* initfunc    */   NULL
+       /* type code   */       CMP_NODE_SEPYUVA,
+       /* name        */       "Separate YUVA",
+       /* width+range */       80, 40, 140,
+       /* class+opts  */       NODE_CLASS_CONVERTOR, 0,
+       /* input sock  */       cmp_node_sepyuva_in,
+       /* output sock */       cmp_node_sepyuva_out,
+       /* storage     */       "",
+       /* execfunc    */       node_composit_exec_sepyuva,
+       /* butfunc     */       NULL,
+       /* initfunc    */       NULL,
+       /* freestoragefunc    */        NULL,
+       /* copystoragefunc    */        NULL,
+       /* id          */       NULL
 };
 
 
@@ -178,7 +181,10 @@ bNodeType cmp_node_combyuva= {
        /* output sock */       cmp_node_combyuva_out,
        /* storage     */       "",
        /* execfunc    */       node_composit_exec_combyuva,
-       /* butfunc     */       NULL,
-       /* initfunc    */   NULL
+       /* butfunc     */       NULL,
+       /* initfunc    */       NULL,
+       /* freestoragefunc    */        NULL,
+       /* copystoragefunc    */        NULL,
+       /* id          */       NULL
 };
 
index 79619da..d56baec 100644 (file)
@@ -80,7 +80,10 @@ bNodeType cmp_node_setalpha= {
        /* output sock */       cmp_node_setalpha_out,
        /* storage     */       "",
        /* execfunc    */       node_composit_exec_setalpha,
-       /* butfunc     */       NULL,
-       /* initfunc    */   NULL
+       /* butfunc     */       NULL,
+       /* initfunc    */       NULL,
+       /* freestoragefunc    */        NULL,
+       /* copystoragefunc    */        NULL,
+       /* id          */       NULL
        
 };
index 572ed53..8ce5a7c 100644 (file)
@@ -152,8 +152,11 @@ bNodeType cmp_node_splitviewer= {
        /* output sock */       NULL,
        /* storage     */       "ImageUser",
        /* execfunc    */       node_composit_exec_splitviewer,
-       /* butfunc     */       NULL,
-       /* initfunc    */   node_composit_init_splitviewer
+       /* butfunc     */       NULL,
+       /* initfunc    */       node_composit_init_splitviewer,
+       /* freestoragefunc    */        node_free_standard_storage,
+       /* copystoragefunc    */        node_copy_standard_storage,
+       /* id          */       NULL
 };
 
 
index eec7ea3..9bf9777 100644 (file)
@@ -127,8 +127,11 @@ bNodeType cmp_node_texture= {
        /* output sock */       cmp_node_texture_out,
        /* storage     */       "",
        /* execfunc    */       node_composit_exec_texture,
-       /* butfunc     */       NULL,
-       /* initfunc    */   NULL
+       /* butfunc     */       NULL,
+       /* initfunc    */       NULL,
+       /* freestoragefunc    */        NULL,
+       /* copystoragefunc    */        NULL,
+       /* id          */       NULL
        
 };
 
index 56d5c11..0b198a1 100644 (file)
@@ -66,7 +66,10 @@ bNodeType cmp_node_translate= {
        /* output sock */       cmp_node_translate_out,
        /* storage     */       "",
        /* execfunc    */       node_composit_exec_translate,
-       /* butfunc     */       NULL,
-       /* initfunc    */   NULL
+       /* butfunc     */       NULL,
+       /* initfunc    */       NULL,
+       /* freestoragefunc    */        NULL,
+       /* copystoragefunc    */        NULL,
+       /* id          */       NULL
 };
 
index d35c347..0d50cb6 100644 (file)
@@ -90,8 +90,11 @@ bNodeType cmp_node_valtorgb= {
        /* output sock */       cmp_node_valtorgb_out,
        /* storage     */       "ColorBand",
        /* execfunc    */       node_composit_exec_valtorgb,
-       /* butfunc     */       NULL,
-       /* initfunc    */   node_composit_init_valtorgb
+       /* butfunc     */       NULL,
+       /* initfunc    */       node_composit_init_valtorgb,
+       /* freestoragefunc    */        node_free_standard_storage,
+       /* copystoragefunc    */        node_copy_standard_storage,
+       /* id          */       NULL
        
 };
 
@@ -144,8 +147,10 @@ bNodeType cmp_node_rgbtobw= {
        /* output sock */       cmp_node_rgbtobw_out,
        /* storage     */       "",
        /* execfunc    */       node_composit_exec_rgbtobw,
-       /* butfunc     */       NULL,
-       /* initfunc    */   NULL
+       /* butfunc     */       NULL,
+       /* freestoragefunc    */        NULL,
+       /* copystoragefunc    */        NULL,
+       /* id          */       NULL
        
 };
 
index 8681fce..7430a37 100644 (file)
@@ -52,7 +52,10 @@ bNodeType cmp_node_value= {
        /* output sock */       cmp_node_value_out,
        /* storage     */       "", 
        /* execfunc    */       node_composit_exec_value, 
-       /* butfunc     */       NULL,
-       /* initfunc    */   NULL
+       /* butfunc     */       NULL,
+       /* initfunc    */       NULL,
+       /* freestoragefunc    */        NULL,
+       /* copystoragefunc    */        NULL,
+       /* id          */       NULL
 };
 
index b23d0d4..9e6c963 100644 (file)
@@ -90,7 +90,6 @@ static void node_composit_init_vecblur(bNode* node)
    nbd->fac= 1.0f;
 };
 
-
 /* custom1: itterations, custom2: maxspeed (0 = nolimit) */
 bNodeType cmp_node_vecblur= {
        /* next, prev  */       NULL, NULL,
@@ -101,8 +100,11 @@ bNodeType cmp_node_vecblur= {
        /* input sock  */       cmp_node_vecblur_in,
        /* output sock */       cmp_node_vecblur_out,
        /* storage     */       "NodeBlurData",
-   /* execfunc    */   node_composit_exec_vecblur,
-       /* butfunc     */       NULL,
-       /* initfunc    */   node_composit_init_vecblur  
+       /* execfunc    */       node_composit_exec_vecblur,
+       /* butfunc     */       NULL,
+       /* initfunc    */       node_composit_init_vecblur,
+       /* freestoragefunc    */        node_free_standard_storage,
+       /* copystoragefunc    */        node_copy_standard_storage,
+       /* id          */       NULL
 };
 
index aee1663..c9e95e7 100644 (file)
@@ -134,8 +134,11 @@ bNodeType cmp_node_viewer= {
        /* output sock */       NULL,
        /* storage     */       "ImageUser",
        /* execfunc    */       node_composit_exec_viewer,
-       /* butfunc     */       NULL,
-       /* initfunc    */   node_composit_init_viewer
+       /* butfunc     */       NULL,
+       /* initfunc    */       node_composit_init_viewer,
+       /* freestoragefunc    */        node_free_standard_storage,
+       /* copystoragefunc    */        node_copy_standard_storage,
+       /* id          */       NULL
        
 };
 
index bff839c..29cf8f3 100644 (file)
@@ -146,7 +146,10 @@ bNodeType cmp_node_zcombine= {
        /* output sock */       cmp_node_zcombine_out,
        /* storage     */       "",
        /* execfunc    */       node_composit_exec_zcombine,
-       /* butfunc     */       NULL,
-       /* initfunc    */   NULL
+       /* butfunc     */       NULL,
+       /* initfunc    */       NULL,
+       /* freestoragefunc    */        NULL,
+       /* copystoragefunc    */        NULL,
+       /* id          */       NULL
        
 };
index fd132ab..515980b 100644 (file)
@@ -62,7 +62,7 @@
 #include "BKE_library.h"
 
 #include "../CMP_node.h"
-
+#include "node_util.h"
 
 #include "BIF_gl.h"
 #include "BIF_glutil.h"
index 9c7cab4..63260ff 100644 (file)
@@ -59,7 +59,10 @@ bNodeType sh_node_camera= {
        /* output sock */       sh_node_camera_out,
        /* storage     */       "node_camera",
        /* execfunc    */       node_shader_exec_camera,
-       /* butfunc     */       NULL,
-       /* initfunc    */   NULL
+       /* butfunc     */       NULL,
+       /* initfunc    */       NULL,
+       /* freestoragefunc    */        NULL,
+       /* copystoragefunc    */        NULL,
+       /* id          */       NULL
 };
 
index ec2af79..b6f1f8d 100644 (file)
@@ -66,8 +66,11 @@ bNodeType sh_node_curve_vec= {
        /* output sock */       sh_node_curve_vec_out,
        /* storage     */       "CurveMapping",
        /* execfunc    */       node_shader_exec_curve_vec,
-       /* butfunc     */       NULL,
-       /* initfunc    */   node_shader_init_curve_vec
+       /* butfunc     */       NULL,
+       /* initfunc    */       node_shader_init_curve_vec,
+       /* freestoragefunc    */        node_free_curves,
+       /* copystoragefunc    */        node_copy_curves,
+       /* id          */       NULL
        
 };
 
@@ -108,6 +111,9 @@ bNodeType sh_node_curve_rgb= {
        /* storage     */       "CurveMapping",
        /* execfunc    */       node_shader_exec_curve_rgb,
        /* butfunc     */       NULL,
-       /* initfunc    */   node_shader_init_curve_rgb
+       /* initfunc    */   node_shader_init_curve_rgb,
+       /* freestoragefunc    */        node_free_curves,
+       /* copystoragefunc    */        node_copy_curves,
+       /* id          */       NULL
 };
 
index 584ceb0..3875dea 100644 (file)
@@ -124,7 +124,10 @@ bNodeType sh_node_geom= {
        /* output sock */       sh_node_geom_out,
        /* storage     */       "NodeGeometry",
        /* execfunc    */       node_shader_exec_geom,
-       /* butfunc     */       NULL,
-       /* initfunc    */   node_shader_init_geometry
+       /* butfunc     */       NULL,
+       /* initfunc    */       node_shader_init_geometry,
+       /* freestoragefunc    */        node_free_standard_storage,
+       /* copystoragefunc    */        node_copy_standard_storage,
+       /* id          */       NULL
        
 };
index a22159d..589954c 100644 (file)
@@ -79,8 +79,11 @@ bNodeType sh_node_mapping= {
        /* output sock */       sh_node_mapping_out,
        /* storage     */       "TexMapping",
        /* execfunc    */       node_shader_exec_mapping,
-       /* butfunc     */       NULL,
-       /* initfunc    */   node_shader_init_mapping
+       /* butfunc     */       NULL,
+       /* initfunc    */       node_shader_init_mapping,
+       /* freestoragefunc    */        node_free_standard_storage,
+       /* copystoragefunc    */        node_copy_standard_storage,
+       /* id          */       NULL
        
 };
 
index 30452ca..1dc18f9 100644 (file)
@@ -145,8 +145,11 @@ bNodeType sh_node_material= {
        /* output sock */       sh_node_material_out,
        /* storage     */       "",
        /* execfunc    */       node_shader_exec_material,
-       /* butfunc     */       NULL,
-       /* initfunc    */   node_shader_init_material
+       /* butfunc     */       NULL,
+       /* initfunc    */       node_shader_init_material,
+       /* freestoragefunc    */        NULL,
+       /* copystoragefunc    */        NULL,
+       /* id          */       NULL
        
 };
 
index bd2fdb4..95162e5 100644 (file)
@@ -180,15 +180,18 @@ bNodeStack **out)
 
 bNodeType sh_node_math= {
        /* *next,*prev */       NULL, NULL,
-       /* type code   */ SH_NODE_MATH, 
-       /* name        */ "Math", 
-       /* width+range */ 120, 110, 160, 
-       /* class+opts  */ NODE_CLASS_CONVERTOR, NODE_OPTIONS, 
-       /* input sock  */ sh_node_math_in, 
-       /* output sock */ sh_node_math_out, 
-       /* storage     */ "node_math", 
-       /* execfunc    */ node_shader_exec_math,
-       /* butfunc     */       NULL,
-       /* initfunc    */   NULL
+       /* type code   */       SH_NODE_MATH, 
+       /* name        */       "Math", 
+       /* width+range */       120, 110, 160, 
+       /* class+opts  */       NODE_CLASS_CONVERTOR, NODE_OPTIONS, 
+       /* input sock  */       sh_node_math_in, 
+       /* output sock */       sh_node_math_out, 
+       /* storage     */       "node_math", 
+       /* execfunc    */       node_shader_exec_math,
+       /* butfunc     */       NULL,
+       /* initfunc    */       NULL,
+       /* freestoragefunc    */        NULL,
+       /* copystoragefunc    */        NULL,
+       /* id          */       NULL
 };
 
index fb0bf91..dba7025 100644 (file)
@@ -70,7 +70,10 @@ bNodeType sh_node_mix_rgb= {
        /* output sock */       sh_node_mix_rgb_out,
        /* storage     */       "", 
        /* execfunc    */       node_shader_exec_mix_rgb,
-       /* butfunc     */       NULL,
-       /* initfunc    */   NULL
+       /* butfunc     */       NULL,
+       /* initfunc    */       NULL,
+       /* freestoragefunc    */        NULL,
+       /* copystoragefunc    */        NULL,
+       /* id          */       NULL
        
 };
index ac9d170..f1ffd34 100644 (file)
@@ -67,7 +67,10 @@ bNodeType sh_node_normal= {
        /* output sock */       sh_node_normal_out,
        /* storage     */       "",
        /* execfunc    */       node_shader_exec_normal,
-       /* butfunc     */       NULL,
-       /* initfunc    */   NULL
+       /* butfunc     */       NULL,
+       /* initfunc    */       NULL,
+       /* freestoragefunc    */        NULL,
+       /* copystoragefunc    */        NULL,
+       /* id          */       NULL
 };
 
index 4ed507f..0a9a30c 100644 (file)
@@ -72,8 +72,11 @@ bNodeType sh_node_output= {
        /* output sock */       NULL,
        /* storage     */       "",
        /* execfunc    */       node_shader_exec_output,
-       /* butfunc     */       NULL,
-       /* initfunc    */   NULL
+       /* butfunc     */       NULL,
+       /* initfunc    */       NULL,
+       /* freestoragefunc    */        NULL,
+       /* copystoragefunc    */        NULL,
+       /* id          */       NULL
        
 };
 
index d1c874c..4e56e26 100644 (file)
@@ -52,7 +52,10 @@ bNodeType sh_node_rgb= {
        /* output sock */       sh_node_rgb_out,
        /* storage     */       "",
        /* execfunc    */       node_shader_exec_rgb,
-       /* butfunc     */       NULL,
-       /* initfunc    */   NULL
+       /* butfunc     */       NULL,
+       /* initfunc    */       NULL,
+       /* freestoragefunc    */        NULL,
+       /* copystoragefunc    */        NULL,
+       /* id          */       NULL
        
 };
index f003111..30abad6 100644 (file)
@@ -56,15 +56,18 @@ bNodeStack **out)
 
 bNodeType sh_node_squeeze= { 
        /* *next,*prev */       NULL, NULL,
-       /* type code   */ SH_NODE_SQUEEZE, 
-       /* name        */ "Squeeze Value", 
-       /* width+range */ 120, 110, 160, 
-       /* class+opts  */ NODE_CLASS_CONVERTOR, NODE_OPTIONS, 
-       /* input sock  */ sh_node_squeeze_in, 
-       /* output sock */ sh_node_squeeze_out, 
-       /* storage     */ "node_squeeze", 
-       /* execfunc    */ node_shader_exec_squeeze,
-       /* butfunc     */       NULL,
-       /* initfunc    */   NULL
+       /* type code   */       SH_NODE_SQUEEZE, 
+       /* name        */       "Squeeze Value", 
+       /* width+range */       120, 110, 160, 
+       /* class+opts  */       NODE_CLASS_CONVERTOR, NODE_OPTIONS, 
+       /* input sock  */       sh_node_squeeze_in, 
+       /* output sock */       sh_node_squeeze_out, 
+       /* storage     */       "node_squeeze", 
+       /* execfunc    */       node_shader_exec_squeeze,
+       /* butfunc     */       NULL,
+       /* initfunc    */       NULL,
+       /* freestoragefunc    */        NULL,
+       /* copystoragefunc    */        NULL,
+       /* id          */       NULL
 };
 
index 8ba66d5..ace11a2 100644 (file)
@@ -120,8 +120,11 @@ bNodeType sh_node_texture= {
        /* output sock */       sh_node_texture_out,
        /* storage     */       "",
        /* execfunc    */       node_shader_exec_texture,
-       /* butfunc     */       NULL,
-       /* initfunc    */   NULL
+       /* butfunc     */       NULL,
+       /* initfunc    */       NULL,
+       /* freestoragefunc    */        NULL,
+       /* copystoragefunc    */        NULL,
+       /* id          */       NULL
        
 };
 
index 90e8cb2..cf7e33d 100644 (file)
@@ -69,8 +69,11 @@ bNodeType sh_node_valtorgb= {
        /* output sock */       sh_node_valtorgb_out,
        /* storage     */       "ColorBand",
        /* execfunc    */       node_shader_exec_valtorgb,
-       /* butfunc     */       NULL,
-       /* initfunc    */   node_shader_init_valtorgb
+       /* butfunc     */       NULL,
+       /* initfunc    */       node_shader_init_valtorgb,
+       /* freestoragefunc    */        node_free_standard_storage,
+       /* copystoragefunc    */        node_copy_standard_storage,
+       /* id          */       NULL
        
 };
 
@@ -95,16 +98,19 @@ static void node_shader_exec_rgbtobw(void *data, bNode *node, bNodeStack **in, b
 
 bNodeType sh_node_rgbtobw= {
        /* *next,*prev */       NULL, NULL,
-   /* type code   */   SH_NODE_RGBTOBW,
-   /* name        */   "RGB to BW",
-   /* width+range */   80, 40, 120,
-   /* class+opts  */   NODE_CLASS_CONVERTOR, 0,
-   /* input sock  */   sh_node_rgbtobw_in,
-   /* output sock */   sh_node_rgbtobw_out,
-   /* storage     */   "",
-   /* execfunc    */   node_shader_exec_rgbtobw,
-       /* butfunc     */       NULL,
-       /* initfunc    */   NULL
+       /* type code   */       SH_NODE_RGBTOBW,
+       /* name        */       "RGB to BW",
+       /* width+range */       80, 40, 120,
+       /* class+opts  */       NODE_CLASS_CONVERTOR, 0,
+       /* input sock  */       sh_node_rgbtobw_in,
+       /* output sock */       sh_node_rgbtobw_out,
+       /* storage     */       "",
+       /* execfunc    */       node_shader_exec_rgbtobw,
+       /* butfunc     */       NULL,
+       /* initfunc    */       NULL,
+       /* freestoragefunc    */        NULL,
+       /* copystoragefunc    */        NULL,
+       /* id          */       NULL
 
 };
 
index 9d6f6a3..57ef722 100644 (file)
@@ -54,8 +54,11 @@ bNodeType sh_node_value= {
        /* output sock */       sh_node_value_out,
        /* storage     */       "", 
        /* execfunc    */       node_shader_exec_value,
-       /* butfunc     */       NULL,
-       /* initfunc    */   NULL
+       /* butfunc     */       NULL,
+       /* initfunc    */       NULL,
+       /* freestoragefunc    */        NULL,
+       /* copystoragefunc    */        NULL,
+       /* id          */       NULL
        
 };
 
index 22da16b..8d0a4b3 100644 (file)
@@ -109,7 +109,10 @@ bNodeType sh_node_vect_math= {
        /* output sock */ sh_node_vect_math_out, 
        /* storage     */ "node_vect_math", 
        /* execfunc    */ node_shader_exec_vect_math,
-       /* butfunc     */       NULL,
-       /* initfunc    */   NULL
+       /* butfunc     */       NULL,
+       /* initfunc    */       NULL,
+       /* freestoragefunc    */        NULL,
+       /* copystoragefunc    */        NULL,
+       /* id          */       NULL
 };
 
index 5ab7e3a..6b9a26d 100644 (file)
@@ -60,6 +60,7 @@
 #include "BKE_library.h"
 
 #include "../SHD_node.h"
+#include "node_util.h"
 
 #include "BIF_gl.h"
 #include "BIF_glutil.h"
diff --git a/source/blender/nodes/intern/node_util.c b/source/blender/nodes/intern/node_util.c
new file mode 100644 (file)
index 0000000..9c9807f
--- /dev/null
@@ -0,0 +1,52 @@
+/**
+ * $Id$
+ *
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version. 
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+ *
+ * The Original Code is Copyright (C) 2007 Blender Foundation.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): Nathan Letwory.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#include "CMP_util.h"
+#include "SHD_util.h"
+
+void node_free_curves(bNode* node)
+{
+       curvemapping_free(node->storage);
+}
+
+void node_free_standard_storage(bNode *node)
+{
+       MEM_freeN(node->storage);
+}
+
+void node_copy_curves(bNode* orig_node, bNode* new_node)
+{
+       new_node->storage= curvemapping_copy(orig_node->storage);
+}
+
+void node_copy_standard_storage(bNode *orig_node, bNode *new_node)
+{
+       new_node->storage= MEM_dupallocN(orig_node->storage);
+}
+
diff --git a/source/blender/nodes/intern/node_util.h b/source/blender/nodes/intern/node_util.h
new file mode 100644 (file)
index 0000000..660c935
--- /dev/null
@@ -0,0 +1,42 @@
+/**
+ * $Id$
+ *
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version. 
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+ *
+ * The Original Code is Copyright (C) 2007 Blender Foundation.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): Nathan Letwory.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#ifndef NODE_UTIL_H_
+#define NODE_UTIL_H_
+
+#include "MEM_guardedalloc.h"
+
+extern void node_free_curves(struct bNode* node);
+extern void node_free_standard_storage(struct bNode *node);
+
+extern void node_copy_curves(struct bNode* orig_node, struct bNode* new_node);
+extern void node_copy_standard_storage(struct bNode *orig_node, struct bNode *new_node);
+
+#endif
+