UI
authorBrecht Van Lommel <brechtvanlommel@pandora.be>
Wed, 16 Sep 2009 18:59:13 +0000 (18:59 +0000)
committerBrecht Van Lommel <brechtvanlommel@pandora.be>
Wed, 16 Sep 2009 18:59:13 +0000 (18:59 +0000)
* Node buttons can now use the layout engine. a few simple
  ones are converted. We'll keep this code in C for now,
  python wouldn't help much here.
* For node buttons not using the layout engine, manually
  computing the button height is not longer needed.
* Node inputs are still not RNA wrapped, would be good to
  have these available as well for keying, but makesrna does
  not have access to the bNodeTypes.

source/blender/blenkernel/BKE_node.h
source/blender/editors/include/ED_node.h
source/blender/editors/space_node/drawnode.c
source/blender/editors/space_node/node_draw.c
source/blender/makesdna/DNA_node_types.h
source/blender/makesrna/intern/rna_nodetree.c
source/blenderplayer/bad_level_call_stubs/stubs.c

index cbb37918d047933546e1012fb3e012d2cf18c0d5..ea1707c19bfd67af418b642964295acd740760b4 100644 (file)
@@ -42,7 +42,7 @@ struct bNode;
 struct bNodeLink;
 struct bNodeSocket;
 struct bNodeStack;
-struct uiBlock;
+struct uiLayout;
 struct rctf;
 struct ListBase;
 struct RenderData;
@@ -52,6 +52,7 @@ struct Tex;
 struct GPUMaterial;
 struct GPUNode;
 struct GPUNodeStack;
+struct PointerRNA;
 
 /* ************** NODE TYPE DEFINITIONS ***** */
 
@@ -82,7 +83,7 @@ typedef struct bNodeType {
        void (*execfunc)(void *data, struct bNode *, struct bNodeStack **, struct bNodeStack **);
        
        /* this line is set on startup of blender */
-       int (*butfunc)(struct uiBlock *, struct bNodeTree *, struct bNode *, struct rctf *);
+       void (*uifunc)(struct uiLayout *, struct PointerRNA *ptr);
 
        void (*initfunc)(struct bNode *);
        void (*freestoragefunc)(struct bNode *);
index bf4632dc3da20c65e1bd2e698b647caaf4353cb0..305b2a64ffe2a029acf3bc267067bc81caf95f14 100644 (file)
 struct Material;
 struct Scene;
 struct Tex;
+struct bContext;
+struct bNode;
 
 /* drawnode.c */
 void ED_init_node_butfuncs(void);
 
+/* node_draw.c */
+void ED_node_changed_update(struct bContext *C, struct bNode *node);
+
 /* node_edit.c */
 void ED_node_shader_default(struct Material *ma);
 void ED_node_composit_default(struct Scene *sce);
index 05adb5b75ca90bc6e10221d8d956c4ba492437a3..494a68fc9183b1d44b40d008bff2c7e6a4d5baee 100644 (file)
@@ -170,9 +170,13 @@ static void node_group_alone_cb(bContext *C, void *node_v, void *unused_v)
 
 /* ****************** BUTTON CALLBACKS FOR ALL TREES ***************** */
 
-static int node_buts_group(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr)
+static void node_buts_group(uiLayout *layout, PointerRNA *ptr)
 {
-       if(block && node->id) {
+       uiBlock *block= uiLayoutFreeBlock(layout);
+       bNode *node= ptr->data;
+       rctf *butr= &node->butr;
+
+       if(node->id) {
                uiBut *bt;
                short width;
                
@@ -197,112 +201,95 @@ static int node_buts_group(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *
                
                uiBlockEndAlign(block);
        }       
-       return 19;
 }
 #endif
 
-static int node_buts_value(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr)
+static void node_buts_value(uiLayout *layout, PointerRNA *ptr)
 {
-       if(block) {
-               bNodeSocket *sock= node->outputs.first;         /* first socket stores value */
-               
-               uiDefButF(block, NUM, B_NODE_EXEC, "", 
-                                 (short)butr->xmin, (short)butr->ymin, butr->xmax-butr->xmin, 20, 
-                                 sock->ns.vec, sock->ns.min, sock->ns.max, 10, 2, "");
-               
-       }
-       return 20;
+       uiBlock *block= uiLayoutFreeBlock(layout);
+       bNode *node= ptr->data;
+       rctf *butr= &node->butr;
+       bNodeSocket *sock= node->outputs.first;         /* first socket stores value */
+       
+       uiDefButF(block, NUM, B_NODE_EXEC, "", 
+                         (short)butr->xmin, (short)butr->ymin, butr->xmax-butr->xmin, 20, 
+                         sock->ns.vec, sock->ns.min, sock->ns.max, 10, 2, "");
 }
 
-static int node_buts_rgb(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr)
+static void node_buts_rgb(uiLayout *layout, PointerRNA *ptr)
 {
-       if(block) {
-               bNodeSocket *sock= node->outputs.first;         /* first socket stores value */
-               if(sock) {
-                       /* enforce square box drawing */
-                       uiBlockSetEmboss(block, UI_EMBOSSP);
-                       
-                       uiDefButF(block, HSVCUBE, B_NODE_EXEC, "", 
-                                         (short)butr->xmin, (short)butr->ymin, butr->xmax-butr->xmin, 12, 
-                                         sock->ns.vec, 0.0f, 1.0f, 3, 0, "");
-                       uiDefButF(block, HSVCUBE, B_NODE_EXEC, "", 
-                                         (short)butr->xmin, (short)butr->ymin+15, butr->xmax-butr->xmin, butr->ymax-butr->ymin -15 -15, 
-                                         sock->ns.vec, 0.0f, 1.0f, 2, 0, "");
-                       uiDefButF(block, COL, B_NOP, "",                
-                                         (short)butr->xmin, (short)butr->ymax-12, butr->xmax-butr->xmin, 12, 
-                                         sock->ns.vec, 0.0, 0.0, -1, 0, "");
-                       /* the -1 above prevents col button to popup a color picker */
-                       
-                       uiBlockSetEmboss(block, UI_EMBOSS);
-               }
-       }
-       return 30 + (int)(node->width-NODE_DY);
-}
+       uiBlock *block= uiLayoutFreeBlock(layout);
+       bNode *node= ptr->data;
+       rctf *butr= &node->butr;
+       bNodeSocket *sock= node->outputs.first;         /* first socket stores value */
 
-static int node_buts_mix_rgb(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr)
-{
-       if(block) {
-               uiBut *bt;
-               int a_but= (ntree->type==NTREE_COMPOSIT);
+       if(sock) {
+               /* enforce square box drawing */
+               uiBlockSetEmboss(block, UI_EMBOSSP);
                
-               /* blend type */
-               uiBlockBeginAlign(block);
-               bt=uiDefButS(block, MENU, B_NODE_EXEC, "Mix %x0|Add %x1|Subtract %x3|Multiply %x2|Screen %x4|Overlay %x9|Divide %x5|Difference %x6|Darken %x7|Lighten %x8|Dodge %x10|Burn %x11|Color %x15|Value %x14|Saturation %x13|Hue %x12|Soft Light %x16|Linear Light %x17", 
-                                        (short)butr->xmin, (short)butr->ymin, butr->xmax-butr->xmin -(a_but?20:0), 20, 
-                                        &node->custom1, 0, 0, 0, 0, "");
-               uiButSetFunc(bt, node_but_title_cb, node, bt);
-               /* Alpha option, composite */
-               if(a_but)
-                       uiDefIconButS(block, TOG, B_NODE_EXEC, ICON_IMAGE_RGB_ALPHA,
-                                 (short)butr->xmax-20, (short)butr->ymin, 20, 20, 
-                                 &node->custom2, 0, 0, 0, 0, "Include Alpha of 2nd input in this operation");
+               uiDefButF(block, HSVCUBE, B_NODE_EXEC, "", 
+                                 (short)butr->xmin, (short)butr->ymin, butr->xmax-butr->xmin, 12, 
+                                 sock->ns.vec, 0.0f, 1.0f, 3, 0, "");
+               uiDefButF(block, HSVCUBE, B_NODE_EXEC, "", 
+                                 (short)butr->xmin, (short)butr->ymin+15, butr->xmax-butr->xmin, butr->xmax-butr->xmin -15 -15, 
+                                 sock->ns.vec, 0.0f, 1.0f, 2, 0, "");
+               uiDefButF(block, COL, B_NOP, "",                
+                                 (short)butr->xmin, (short)butr->ymax-12, butr->xmax-butr->xmin, 12, 
+                                 sock->ns.vec, 0.0, 0.0, -1, 0, "");
+               /* the -1 above prevents col button to popup a color picker */
+               
+               uiBlockSetEmboss(block, UI_EMBOSS);
        }
-       return 20;
 }
 
-static int node_buts_time(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr)
+static void node_buts_mix_rgb(uiLayout *layout, PointerRNA *ptr)
 {
-       if(block) {
-               CurveMapping *cumap= node->storage;
-               short dx= (short)((butr->xmax-butr->xmin)/2);
-               butr->ymin += 26;
+       bNodeTree *ntree= (bNodeTree*)ptr->id.data;
+       uiLayout *row;
 
-               curvemap_buttons(block, node->storage, 's', B_NODE_EXEC, B_REDR, butr);
-               
-               if(cumap) {
-                       //cumap->flag |= CUMA_DRAW_CFRA;
-                       //if(node->custom1<node->custom2)
-                       //      cumap->sample[0]= (float)(CFRA - node->custom1)/(float)(node->custom2-node->custom1);
-               }
+       row= uiLayoutRow(layout, 1);
 
-               uiBlockBeginAlign(block);
-               uiDefButS(block, NUM, B_NODE_EXEC, "Sta:",
-                                 (short)butr->xmin, (short)butr->ymin-22, dx, 19, 
-                                 &node->custom1, 1.0, 20000.0, 0, 0, "Start frame");
-               uiDefButS(block, NUM, B_NODE_EXEC, "End:",
-                                 (short)butr->xmin+dx, (short)butr->ymin-22, dx, 19, 
-                                 &node->custom2, 1.0, 20000.0, 0, 0, "End frame");
-       }
+       uiItemR(row, "", 0, ptr, "blend_type", 0);
+       if(ntree->type == NTREE_COMPOSIT)
+               uiItemR(row, "", ICON_IMAGE_RGB_ALPHA, ptr, "alpha", 0);
+}
+
+static void node_buts_time(uiLayout *layout, PointerRNA *ptr)
+{
+       uiLayout *row;
+#if 0
+       /* XXX no context access here .. */
+       bNode *node= ptr->data;
+       CurveMapping *cumap= node->storage;
        
-       return node->width-NODE_DY;
+       if(cumap) {
+               cumap->flag |= CUMA_DRAW_CFRA;
+               if(node->custom1<node->custom2)
+                       cumap->sample[0]= (float)(CFRA - node->custom1)/(float)(node->custom2-node->custom1);
+       }
+#endif
+
+       uiTemplateCurveMapping(layout, ptr, "curve", 's', 0);
+
+       row= uiLayoutRow(layout, 1);
+       uiItemR(row, "Sta", 0, ptr, "start", 0);
+       uiItemR(row, "End", 0, ptr, "end", 0);
 }
 
-static int node_buts_valtorgb(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr)
+static void node_buts_valtorgb(uiLayout *layout, PointerRNA *ptr)
 {
-       if(block) {
-               if(node->storage) {
-                       uiBlockColorbandButtons(block, node->storage, butr, B_NODE_EXEC);
-               }
+       uiBlock *block= uiLayoutFreeBlock(layout);
+       bNode *node= ptr->data;
+       rctf *butr= &node->butr;
+
+       if(node->storage) {
+               uiBlockColorbandButtons(block, node->storage, butr, B_NODE_EXEC);
        }
-       return 40;
 }
 
-static int node_buts_curvevec(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr)
+static void node_buts_curvevec(uiLayout *layout, PointerRNA *ptr)
 {
-       if(block) {
-               curvemap_buttons(block, node->storage, 'v', B_NODE_EXEC, B_REDR, butr);
-       }       
-       return (int)(node->width-NODE_DY);
+       uiTemplateCurveMapping(layout, ptr, "mapping", 'v', 0);
 }
 
 static float *_sample_col= NULL;       // bad bad, 2.5 will do better?
@@ -311,33 +298,31 @@ void node_curvemap_sample(float *col)
        _sample_col= col;
 }
 
-static int node_buts_curvecol(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr)
+static void node_buts_curvecol(uiLayout *layout, PointerRNA *ptr)
 {
-       if(block) {
-               CurveMapping *cumap= node->storage;
-               if(_sample_col) {
-                       cumap->flag |= CUMA_DRAW_SAMPLE;
-                       VECCOPY(cumap->sample, _sample_col);
-               }
-               else 
-                       cumap->flag &= ~CUMA_DRAW_SAMPLE;
+       bNode *node= ptr->data;
+       CurveMapping *cumap= node->storage;
 
-               curvemap_buttons(block, node->storage, 'c', B_NODE_EXEC, B_REDR, butr);
-       }       
-       return (int)(node->width-NODE_DY);
+       if(_sample_col) {
+               cumap->flag |= CUMA_DRAW_SAMPLE;
+               VECCOPY(cumap->sample, _sample_col);
+       }
+       else 
+               cumap->flag &= ~CUMA_DRAW_SAMPLE;
+
+       uiTemplateCurveMapping(layout, ptr, "mapping", 'c', 0);
 }
 
-static int node_buts_normal(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr)
+static void node_buts_normal(uiLayout *layout, PointerRNA *ptr)
 {
-       if(block) {
-               bNodeSocket *sock= node->outputs.first;         /* first socket stores normal */
-               
-               uiDefButF(block, BUT_NORMAL, B_NODE_EXEC, "", 
-                                 (short)butr->xmin, (short)butr->ymin, butr->xmax-butr->xmin, butr->ymax-butr->ymin, 
-                                 sock->ns.vec, 0.0f, 1.0f, 0, 0, "");
-               
-       }       
-       return (int)(node->width-NODE_DY);
+       uiBlock *block= uiLayoutFreeBlock(layout);
+       bNode *node= ptr->data;
+       rctf *butr= &node->butr;
+       bNodeSocket *sock= node->outputs.first;         /* first socket stores normal */
+       
+       uiDefButF(block, BUT_NORMAL, B_NODE_EXEC, "", 
+                         (short)butr->xmin, (short)butr->xmin, butr->xmax-butr->xmin, butr->xmax-butr->xmin, 
+                         sock->ns.vec, 0.0f, 1.0f, 0, 0, "");
 }
 
 static void node_browse_tex_cb(bContext *C, void *ntree_v, void *node_v)
@@ -401,8 +386,13 @@ static void node_dynamic_update_cb(bContext *C, void *ntree_v, void *node_v)
        // XXX BIF_preview_changed(ID_MA);
 }
 
-static int node_buts_texture(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr)
+static void node_buts_texture(uiLayout *layout, PointerRNA *ptr)
 {
+       uiBlock *block= uiLayoutFreeBlock(layout);
+       bNode *node= ptr->data;
+       bNodeTree *ntree= ptr->id.data;
+       rctf *butr= &node->butr;
+
        short multi = (
                node->id &&
                ((Tex*)node->id)->use_nodes &&
@@ -410,49 +400,44 @@ static int node_buts_texture(uiBlock *block, bNodeTree *ntree, bNode *node, rctf
                (node->type != TEX_NODE_TEXTURE)
        );
        
-       if(block) {
-               uiBut *bt;
-               char *strp;
-               short width = (short)(butr->xmax - butr->xmin);
-               
-               /* browse button texture */
-               uiBlockBeginAlign(block);
-               IDnames_to_pupstring(&strp, NULL, "", &(G.main->tex), NULL, NULL);
-               node->menunr= 0;
-               bt= uiDefButS(block, MENU, B_NODE_EXEC, strp, 
-                               butr->xmin, butr->ymin+(multi?30:0), 20, 19, 
-                                         &node->menunr, 0, 0, 0, 0, "Browse texture");
-               uiButSetFunc(bt, node_browse_tex_cb, ntree, node);
-               if(strp) MEM_freeN(strp);
-               
-               if(node->id) {
-                       bt= uiDefBut(block, TEX, B_NOP, "TE:",
-                                       butr->xmin+19, butr->ymin+(multi?30:0), butr->xmax-butr->xmin-19, 19, 
-                                                node->id->name+2, 0.0, 19.0, 0, 0, "Texture name");
-                       uiButSetFunc(bt, node_ID_title_cb, node, NULL);
-               }
-               uiBlockEndAlign(block);
-               
-               if(multi) {
-                       char *menustr = ntreeTexOutputMenu(((Tex*)node->id)->nodetree);
-                       uiDefButS(block, MENU, B_MATPRV, menustr, butr->xmin, butr->ymin, width, 19, &node->custom1, 0, 0, 0, 0, "Which output to use, for multi-output textures");
-                       free(menustr);
-                       return 50;
-               }
-               return 20;
-       }       
-       else return multi? 50: 20;
+       uiBut *bt;
+       char *strp;
+       short width = (short)(butr->xmax - butr->xmin);
+       
+       /* browse button texture */
+       uiBlockBeginAlign(block);
+       IDnames_to_pupstring(&strp, NULL, "", &(G.main->tex), NULL, NULL);
+       node->menunr= 0;
+       bt= uiDefButS(block, MENU, B_NODE_EXEC, strp, 
+                       butr->xmin, butr->ymin+(multi?30:0), 20, 19, 
+                                 &node->menunr, 0, 0, 0, 0, "Browse texture");
+       uiButSetFunc(bt, node_browse_tex_cb, ntree, node);
+       if(strp) MEM_freeN(strp);
+       
+       if(node->id) {
+               bt= uiDefBut(block, TEX, B_NOP, "TE:",
+                               butr->xmin+19, butr->ymin+(multi?30:0), butr->xmax-butr->xmin-19, 19, 
+                                        node->id->name+2, 0.0, 19.0, 0, 0, "Texture name");
+               uiButSetFunc(bt, node_ID_title_cb, node, NULL);
+       }
+       uiBlockEndAlign(block);
+       
+       if(multi) {
+               char *menustr = ntreeTexOutputMenu(((Tex*)node->id)->nodetree);
+               uiDefButS(block, MENU, B_MATPRV, menustr, butr->xmin, butr->ymin, width, 19, &node->custom1, 0, 0, 0, 0, "Which output to use, for multi-output textures");
+               free(menustr);
+       }
 }
 
-static int node_buts_math(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr) 
+static void node_buts_math(uiLayout *layout, PointerRNA *ptr)
 { 
-       if(block) { 
-               uiBut *bt; 
+       uiBlock *block= uiLayoutFreeBlock(layout);
+       bNode *node= ptr->data;
+       rctf *butr= &node->butr;
+       uiBut *bt; 
 
-               bt=uiDefButS(block, MENU, B_NODE_EXEC,  "Add %x0|Subtract %x1|Multiply %x2|Divide %x3|Sine %x4|Cosine %x5|Tangent %x6|Arcsine %x7|Arccosine %x8|Arctangent %x9|Power %x10|Logarithm %x11|Minimum %x12|Maximum %x13|Round %x14|Less Than %x15|Greater Than %x16", butr->xmin, butr->ymin, butr->xmax-butr->xmin, 20, &node->custom1, 0, 0, 0, 0, ""); 
-               uiButSetFunc(bt, node_but_title_cb, node, bt); 
-       } 
-       return 20; 
+       bt=uiDefButS(block, MENU, B_NODE_EXEC,  "Add %x0|Subtract %x1|Multiply %x2|Divide %x3|Sine %x4|Cosine %x5|Tangent %x6|Arcsine %x7|Arccosine %x8|Arctangent %x9|Power %x10|Logarithm %x11|Minimum %x12|Maximum %x13|Round %x14|Less Than %x15|Greater Than %x16", butr->xmin, butr->ymin, butr->xmax-butr->xmin, 20, &node->custom1, 0, 0, 0, 0, ""); 
+       uiButSetFunc(bt, node_but_title_cb, node, bt); 
 }
 
 
@@ -556,192 +541,192 @@ static void node_texmap_cb(bContext *C, void *texmap_v, void *unused_v)
        init_mapping(texmap_v);
 }
 
-static int node_shader_buts_material(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr)
+static void node_shader_buts_material(uiLayout *layout, PointerRNA *ptr)
 {
-       if(block) {
-               uiBut *bt;
-               short dx= (short)((butr->xmax-butr->xmin)/3.0f), has_us= (node->id && node->id->us>1);
-               short dy= (short)butr->ymin;
-               char *strp;
-               
-               /* WATCH IT: we use this callback in material buttons, but then only want first row */
-               if(butr->ymax-butr->ymin > 21.0f) dy+= 19;
-               
-               uiBlockBeginAlign(block);
-               /* XXX
-               if(node->id==NULL) uiBlockSetCol(block, TH_REDALERT);
-               else if(has_us) uiBlockSetCol(block, TH_BUT_SETTING1);
-               else uiBlockSetCol(block, TH_BUT_SETTING2);
-               */
-               
-               /* browse button */
-               IDnames_to_pupstring(&strp, NULL, "ADD NEW %x32767", &(G.main->mat), NULL, NULL);
-               node->menunr= 0;
-               bt= uiDefButS(block, MENU, B_NOP, strp, 
-                                 butr->xmin, dy, 19, 19, 
-                                 &node->menunr, 0, 0, 0, 0, "Browses existing choices or adds NEW");
-               uiButSetFunc(bt, node_browse_mat_cb, ntree, node);
-               if(strp) MEM_freeN(strp);
+       uiBlock *block= uiLayoutFreeBlock(layout);
+       bNode *node= ptr->data;
+       bNodeTree *ntree= ptr->id.data;
+       rctf *butr= &node->butr;
+       uiBut *bt;
+       short dx= (short)((butr->xmax-butr->xmin)/3.0f), has_us= (node->id && node->id->us>1);
+       short dy= (short)butr->ymin;
+       char *strp;
+       
+       /* WATCH IT: we use this callback in material buttons, but then only want first row */
+       if(butr->ymax-butr->ymin > 21.0f) dy+= 19;
+       
+       uiBlockBeginAlign(block);
+       /* XXX
+       if(node->id==NULL) uiBlockSetCol(block, TH_REDALERT);
+       else if(has_us) uiBlockSetCol(block, TH_BUT_SETTING1);
+       else uiBlockSetCol(block, TH_BUT_SETTING2);
+       */
+       
+       /* browse button */
+       IDnames_to_pupstring(&strp, NULL, "ADD NEW %x32767", &(G.main->mat), NULL, NULL);
+       node->menunr= 0;
+       bt= uiDefButS(block, MENU, B_NOP, strp, 
+                         butr->xmin, dy, 19, 19, 
+                         &node->menunr, 0, 0, 0, 0, "Browses existing choices or adds NEW");
+       uiButSetFunc(bt, node_browse_mat_cb, ntree, node);
+       if(strp) MEM_freeN(strp);
+       
+       /* Add New button */
+       if(node->id==NULL) {
+               bt= uiDefBut(block, BUT, B_NOP, "Add New",
+                                        butr->xmin+19, dy, (short)(butr->xmax-butr->xmin-19.0f), 19, 
+                                        NULL, 0.0, 0.0, 0, 0, "Add new Material");
+               uiButSetFunc(bt, node_new_mat_cb, ntree, node);
+       }
+       else {
+               /* name button */
+               short width= (short)(butr->xmax-butr->xmin-19.0f - (has_us?19.0f:0.0f));
+               bt= uiDefBut(block, TEX, B_NOP, "MA:",
+                                         butr->xmin+19, dy, width, 19, 
+                                         node->id->name+2, 0.0, 19.0, 0, 0, "Material name");
+               uiButSetFunc(bt, node_ID_title_cb, node, NULL);
                
-               /* Add New button */
-               if(node->id==NULL) {
-                       bt= uiDefBut(block, BUT, B_NOP, "Add New",
-                                                butr->xmin+19, dy, (short)(butr->xmax-butr->xmin-19.0f), 19, 
-                                                NULL, 0.0, 0.0, 0, 0, "Add new Material");
-                       uiButSetFunc(bt, node_new_mat_cb, ntree, node);
+               /* user amount */
+               if(has_us) {
+                       char str1[32];
+                       sprintf(str1, "%d", node->id->us);
+                       bt= uiDefBut(block, BUT, B_NOP, str1, 
+                                                 butr->xmax-19, dy, 19, 19, 
+                                                 NULL, 0, 0, 0, 0, "Displays number of users. Click to make a single-user copy.");
+                       uiButSetFunc(bt, node_mat_alone_cb, node, NULL);
                }
-               else {
-                       /* name button */
-                       short width= (short)(butr->xmax-butr->xmin-19.0f - (has_us?19.0f:0.0f));
-                       bt= uiDefBut(block, TEX, B_NOP, "MA:",
-                                                 butr->xmin+19, dy, width, 19, 
-                                                 node->id->name+2, 0.0, 19.0, 0, 0, "Material name");
-                       uiButSetFunc(bt, node_ID_title_cb, node, NULL);
-                       
-                       /* user amount */
-                       if(has_us) {
-                               char str1[32];
-                               sprintf(str1, "%d", node->id->us);
-                               bt= uiDefBut(block, BUT, B_NOP, str1, 
-                                                         butr->xmax-19, dy, 19, 19, 
-                                                         NULL, 0, 0, 0, 0, "Displays number of users. Click to make a single-user copy.");
-                               uiButSetFunc(bt, node_mat_alone_cb, node, NULL);
-                       }
-                       
-                       /* WATCH IT: we use this callback in material buttons, but then only want first row */
-                       if(butr->ymax-butr->ymin > 21.0f) {
-                               /* node options */
-                               uiDefButBitS(block, TOG, SH_NODE_MAT_DIFF, B_NODE_EXEC, "Diff",
-                                                        butr->xmin, butr->ymin, dx, 19, 
-                                                        &node->custom1, 0, 0, 0, 0, "Material Node outputs Diffuse");
-                               uiDefButBitS(block, TOG, SH_NODE_MAT_SPEC, B_NODE_EXEC, "Spec",
-                                                        butr->xmin+dx, butr->ymin, dx, 19, 
-                                                        &node->custom1, 0, 0, 0, 0, "Material Node outputs Specular");
-                               uiDefButBitS(block, TOG, SH_NODE_MAT_NEG, B_NODE_EXEC, "Neg Normal",
-                                                        butr->xmax-dx, butr->ymin, dx, 19,
-                                                        &node->custom1, 0, 0, 0, 0, "Material Node uses inverted Normal");
-                       }
+               
+               /* WATCH IT: we use this callback in material buttons, but then only want first row */
+               if(butr->ymax-butr->ymin > 21.0f) {
+                       /* node options */
+                       uiDefButBitS(block, TOG, SH_NODE_MAT_DIFF, B_NODE_EXEC, "Diff",
+                                                butr->xmin, butr->ymin, dx, 19, 
+                                                &node->custom1, 0, 0, 0, 0, "Material Node outputs Diffuse");
+                       uiDefButBitS(block, TOG, SH_NODE_MAT_SPEC, B_NODE_EXEC, "Spec",
+                                                butr->xmin+dx, butr->ymin, dx, 19, 
+                                                &node->custom1, 0, 0, 0, 0, "Material Node outputs Specular");
+                       uiDefButBitS(block, TOG, SH_NODE_MAT_NEG, B_NODE_EXEC, "Neg Normal",
+                                                butr->xmax-dx, butr->ymin, dx, 19,
+                                                &node->custom1, 0, 0, 0, 0, "Material Node uses inverted Normal");
                }
-               uiBlockEndAlign(block);
-       }       
-       return 38;
+       }
+       uiBlockEndAlign(block);
 }
 
-static int node_shader_buts_mapping(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr)
+static void node_shader_buts_mapping(uiLayout *layout, PointerRNA *ptr)
 {
-       if(block) {
-               TexMapping *texmap= node->storage;
-               short dx= (short)((butr->xmax-butr->xmin)/7.0f);
-               short dy= (short)(butr->ymax-19);
-               
-               uiBlockSetFunc(block, node_texmap_cb, texmap, NULL);    /* all buttons get this */
-               
-               uiBlockBeginAlign(block);
-               uiDefButF(block, NUM, B_NODE_EXEC, "", butr->xmin+dx, dy, 2*dx, 19, texmap->loc, -1000.0f, 1000.0f, 10, 2, "");
-               uiDefButF(block, NUM, B_NODE_EXEC, "", butr->xmin+3*dx, dy, 2*dx, 19, texmap->loc+1, -1000.0f, 1000.0f, 10, 2, "");
-               uiDefButF(block, NUM, B_NODE_EXEC, "", butr->xmin+5*dx, dy, 2*dx, 19, texmap->loc+2, -1000.0f, 1000.0f, 10, 2, "");
-               dy-= 19;
-               uiDefButF(block, NUM, B_NODE_EXEC, "", butr->xmin+dx, dy, 2*dx, 19, texmap->rot, -1000.0f, 1000.0f, 1000, 1, "");
-               uiDefButF(block, NUM, B_NODE_EXEC, "", butr->xmin+3*dx, dy, 2*dx, 19, texmap->rot+1, -1000.0f, 1000.0f, 1000, 1, "");
-               uiDefButF(block, NUM, B_NODE_EXEC, "", butr->xmin+5*dx, dy, 2*dx, 19, texmap->rot+2, -1000.0f, 1000.0f, 1000, 1, "");
-               dy-= 19;
-               uiDefButF(block, NUM, B_NODE_EXEC, "", butr->xmin+dx, dy, 2*dx, 19, texmap->size, -1000.0f, 1000.0f, 10, 2, "");
-               uiDefButF(block, NUM, B_NODE_EXEC, "", butr->xmin+3*dx, dy, 2*dx, 19, texmap->size+1, -1000.0f, 1000.0f, 10, 2, "");
-               uiDefButF(block, NUM, B_NODE_EXEC, "", butr->xmin+5*dx, dy, 2*dx, 19, texmap->size+2, -1000.0f, 1000.0f, 10, 2, "");
-               dy-= 25;
-               uiBlockBeginAlign(block);
-               uiDefButF(block, NUM, B_NODE_EXEC, "", butr->xmin+dx, dy, 2*dx, 19, texmap->min, -10.0f, 10.0f, 100, 2, "");
-               uiDefButF(block, NUM, B_NODE_EXEC, "", butr->xmin+3*dx, dy, 2*dx, 19, texmap->min+1, -10.0f, 10.0f, 100, 2, "");
-               uiDefButF(block, NUM, B_NODE_EXEC, "", butr->xmin+5*dx, dy, 2*dx, 19, texmap->min+2, -10.0f, 10.0f, 100, 2, "");
-               dy-= 19;
-               uiDefButF(block, NUM, B_NODE_EXEC, "", butr->xmin+dx, dy, 2*dx, 19, texmap->max, -10.0f, 10.0f, 10, 2, "");
-               uiDefButF(block, NUM, B_NODE_EXEC, "", butr->xmin+3*dx, dy, 2*dx, 19, texmap->max+1, -10.0f, 10.0f, 10, 2, "");
-               uiDefButF(block, NUM, B_NODE_EXEC, "", butr->xmin+5*dx, dy, 2*dx, 19, texmap->max+2, -10.0f, 10.0f, 10, 2, "");
-               uiBlockEndAlign(block);
-               
-               /* labels/options */
-               
-               dy= (short)(butr->ymax-19);
-               uiDefBut(block, LABEL, B_NOP, "Loc", butr->xmin, dy, dx, 19, NULL, 0.0f, 0.0f, 0, 0, "");
-               dy-= 19;
-               uiDefBut(block, LABEL, B_NOP, "Rot", butr->xmin, dy, dx, 19, NULL, 0.0f, 0.0f, 0, 0, "");
-               dy-= 19;
-               uiDefBut(block, LABEL, B_NOP, "Size", butr->xmin, dy, dx, 19, NULL, 0.0f, 0.0f, 0, 0, "");
-               dy-= 25;
-               uiDefButBitI(block, TOG, TEXMAP_CLIP_MIN, B_NODE_EXEC, "Min", butr->xmin, dy, dx-4, 19, &texmap->flag, 0.0f, 0.0f, 0, 0, "");
-               dy-= 19;
-               uiDefButBitI(block, TOG, TEXMAP_CLIP_MAX, B_NODE_EXEC, "Max", butr->xmin, dy, dx-4, 19, &texmap->flag, 0.0f, 0.0f, 0, 0, "");
-               
-       }       
-       return 5*19 + 6;
+       uiBlock *block= uiLayoutFreeBlock(layout);
+       bNode *node= ptr->data;
+       rctf *butr= &node->butr;
+       TexMapping *texmap= node->storage;
+       short dx= (short)((butr->xmax-butr->xmin)/7.0f);
+       short dy= (short)(butr->ymax-19);
+       
+       uiBlockSetFunc(block, node_texmap_cb, texmap, NULL);    /* all buttons get this */
+       
+       uiBlockBeginAlign(block);
+       uiDefButF(block, NUM, B_NODE_EXEC, "", butr->xmin+dx, dy, 2*dx, 19, texmap->loc, -1000.0f, 1000.0f, 10, 2, "");
+       uiDefButF(block, NUM, B_NODE_EXEC, "", butr->xmin+3*dx, dy, 2*dx, 19, texmap->loc+1, -1000.0f, 1000.0f, 10, 2, "");
+       uiDefButF(block, NUM, B_NODE_EXEC, "", butr->xmin+5*dx, dy, 2*dx, 19, texmap->loc+2, -1000.0f, 1000.0f, 10, 2, "");
+       dy-= 19;
+       uiDefButF(block, NUM, B_NODE_EXEC, "", butr->xmin+dx, dy, 2*dx, 19, texmap->rot, -1000.0f, 1000.0f, 1000, 1, "");
+       uiDefButF(block, NUM, B_NODE_EXEC, "", butr->xmin+3*dx, dy, 2*dx, 19, texmap->rot+1, -1000.0f, 1000.0f, 1000, 1, "");
+       uiDefButF(block, NUM, B_NODE_EXEC, "", butr->xmin+5*dx, dy, 2*dx, 19, texmap->rot+2, -1000.0f, 1000.0f, 1000, 1, "");
+       dy-= 19;
+       uiDefButF(block, NUM, B_NODE_EXEC, "", butr->xmin+dx, dy, 2*dx, 19, texmap->size, -1000.0f, 1000.0f, 10, 2, "");
+       uiDefButF(block, NUM, B_NODE_EXEC, "", butr->xmin+3*dx, dy, 2*dx, 19, texmap->size+1, -1000.0f, 1000.0f, 10, 2, "");
+       uiDefButF(block, NUM, B_NODE_EXEC, "", butr->xmin+5*dx, dy, 2*dx, 19, texmap->size+2, -1000.0f, 1000.0f, 10, 2, "");
+       dy-= 25;
+       uiBlockBeginAlign(block);
+       uiDefButF(block, NUM, B_NODE_EXEC, "", butr->xmin+dx, dy, 2*dx, 19, texmap->min, -10.0f, 10.0f, 100, 2, "");
+       uiDefButF(block, NUM, B_NODE_EXEC, "", butr->xmin+3*dx, dy, 2*dx, 19, texmap->min+1, -10.0f, 10.0f, 100, 2, "");
+       uiDefButF(block, NUM, B_NODE_EXEC, "", butr->xmin+5*dx, dy, 2*dx, 19, texmap->min+2, -10.0f, 10.0f, 100, 2, "");
+       dy-= 19;
+       uiDefButF(block, NUM, B_NODE_EXEC, "", butr->xmin+dx, dy, 2*dx, 19, texmap->max, -10.0f, 10.0f, 10, 2, "");
+       uiDefButF(block, NUM, B_NODE_EXEC, "", butr->xmin+3*dx, dy, 2*dx, 19, texmap->max+1, -10.0f, 10.0f, 10, 2, "");
+       uiDefButF(block, NUM, B_NODE_EXEC, "", butr->xmin+5*dx, dy, 2*dx, 19, texmap->max+2, -10.0f, 10.0f, 10, 2, "");
+       uiBlockEndAlign(block);
+       
+       /* labels/options */
+       
+       dy= (short)(butr->ymax-19);
+       uiDefBut(block, LABEL, B_NOP, "Loc", butr->xmin, dy, dx, 19, NULL, 0.0f, 0.0f, 0, 0, "");
+       dy-= 19;
+       uiDefBut(block, LABEL, B_NOP, "Rot", butr->xmin, dy, dx, 19, NULL, 0.0f, 0.0f, 0, 0, "");
+       dy-= 19;
+       uiDefBut(block, LABEL, B_NOP, "Size", butr->xmin, dy, dx, 19, NULL, 0.0f, 0.0f, 0, 0, "");
+       dy-= 25;
+       uiDefButBitI(block, TOG, TEXMAP_CLIP_MIN, B_NODE_EXEC, "Min", butr->xmin, dy, dx-4, 19, &texmap->flag, 0.0f, 0.0f, 0, 0, "");
+       dy-= 19;
+       uiDefButBitI(block, TOG, TEXMAP_CLIP_MAX, B_NODE_EXEC, "Max", butr->xmin, dy, dx-4, 19, &texmap->flag, 0.0f, 0.0f, 0, 0, "");
 }
 
-static int node_shader_buts_vect_math(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr) 
+static void node_shader_buts_vect_math(uiLayout *layout, PointerRNA *ptr)
 { 
-       if(block) { 
-               uiBut *bt; 
-       
-               bt=uiDefButS(block, MENU, B_NODE_EXEC,  "Add %x0|Subtract %x1|Average %x2|Dot Product %x3 |Cross Product %x4|Normalize %x5", butr->xmin, butr->ymin, butr->xmax-butr->xmin, 20, &node->custom1, 0, 0, 0, 0, "")
-               uiButSetFunc(bt, node_but_title_cb, node, bt); 
-       } 
-       return 20
+       uiBlock *block= uiLayoutFreeBlock(layout);
+       bNode *node= ptr->data;
+       rctf *butr= &node->butr;
+       uiBut *bt
+
+       bt=uiDefButS(block, MENU, B_NODE_EXEC,  "Add %x0|Subtract %x1|Average %x2|Dot Product %x3 |Cross Product %x4|Normalize %x5", butr->xmin, butr->ymin, butr->xmax-butr->xmin, 20, &node->custom1, 0, 0, 0, 0, ""); 
+       uiButSetFunc(bt, node_but_title_cb, node, bt)
 }
 
-static int node_shader_buts_geometry(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr)
+static void node_shader_buts_geometry(uiLayout *layout, PointerRNA *ptr)
 {
-       if(block) {
-               uiBut *but;
-               NodeGeometry *ngeo= (NodeGeometry*)node->storage;
+       uiBlock *block= uiLayoutFreeBlock(layout);
+       bNode *node= ptr->data;
+       rctf *butr= &node->butr;
+       uiBut *but;
+       NodeGeometry *ngeo= (NodeGeometry*)node->storage;
 
-               // XXX if(!verify_valid_uv_name(ngeo->uvname))
-               // XXX  uiBlockSetCol(block, TH_REDALERT);
-               but= uiDefBut(block, TEX, B_NODE_EXEC, "UV:", butr->xmin, butr->ymin+20, butr->xmax-butr->xmin, 20, ngeo->uvname, 0, 31, 0, 0, "Set name of UV layer to use, default is active UV layer");
-               // XXX uiButSetCompleteFunc(but, autocomplete_uv, NULL);
+       // XXX if(!verify_valid_uv_name(ngeo->uvname))
+       // XXX  uiBlockSetCol(block, TH_REDALERT);
+       but= uiDefBut(block, TEX, B_NODE_EXEC, "UV:", butr->xmin, butr->ymin+20, butr->xmax-butr->xmin, 20, ngeo->uvname, 0, 31, 0, 0, "Set name of UV layer to use, default is active UV layer");
+       // XXX uiButSetCompleteFunc(but, autocomplete_uv, NULL);
 
-               if(!verify_valid_vcol_name(ngeo->colname));
+       if(!verify_valid_vcol_name(ngeo->colname));
 //                     uiBlockSetCol(block, TH_REDALERT);
-               but= uiDefBut(block, TEX, B_NODE_EXEC, "Col:", butr->xmin, butr->ymin, butr->xmax-butr->xmin, 20, ngeo->colname, 0, 31, 0, 0, "Set name of vertex color layer to use, default is active vertex color layer");
-               uiButSetCompleteFunc(but, autocomplete_vcol, NULL);
-       }
-
-       return 40;
+       but= uiDefBut(block, TEX, B_NODE_EXEC, "Col:", butr->xmin, butr->ymin, butr->xmax-butr->xmin, 20, ngeo->colname, 0, 31, 0, 0, "Set name of vertex color layer to use, default is active vertex color layer");
+       uiButSetCompleteFunc(but, autocomplete_vcol, NULL);
 }
 
-static int node_shader_buts_dynamic(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr) 
+static void node_shader_buts_dynamic(uiLayout *layout, PointerRNA *ptr)
 { 
-       if (block) { 
-               uiBut *bt;
-               // XXX SpaceNode *snode= curarea->spacedata.first;
-               short dy= (short)butr->ymin;
-               int xoff=0;
-
-               /* B_NODE_EXEC is handled in butspace.c do_node_buts */
-               if(!node->id) {
-                               char *strp;
-                               IDnames_to_pupstring(&strp, NULL, "", &(G.main->text), NULL, NULL);
-                               node->menunr= 0;
-                               bt= uiDefButS(block, MENU, B_NODE_EXEC/*+node->nr*/, strp, 
-                                                               butr->xmin, dy, 19, 19, 
-                                                               &node->menunr, 0, 0, 0, 0, "Browses existing choices");
-                               uiButSetFunc(bt, node_browse_text_cb, ntree, node);
-                               xoff=19;
-                               if(strp) MEM_freeN(strp);       
-               }
-               else {
-                       bt = uiDefBut(block, BUT, B_NOP, "Update",
-                                       butr->xmin+xoff, butr->ymin+20, 50, 19,
-                                       &node->menunr, 0.0, 19.0, 0, 0, "Refresh this node (and all others that use the same script)");
-                       uiButSetFunc(bt, node_dynamic_update_cb, ntree, node);
-
-                       if (BTST(node->custom1, NODE_DYNAMIC_ERROR)) {
-                               // UI_ThemeColor(TH_REDALERT);
-                               // XXX ui_rasterpos_safe(butr->xmin + xoff, butr->ymin + 5, snode->aspect);
-                               // XXX snode_drawstring(snode, "Error! Check console...", butr->xmax - butr->xmin);
-                               ;
-                       }
+       uiBlock *block= uiLayoutFreeBlock(layout);
+       bNode *node= ptr->data;
+       bNodeTree *ntree= ptr->id.data;
+       rctf *butr= &node->butr;
+       uiBut *bt;
+       // XXX SpaceNode *snode= curarea->spacedata.first;
+       short dy= (short)butr->ymin;
+       int xoff=0;
+
+       /* B_NODE_EXEC is handled in butspace.c do_node_buts */
+       if(!node->id) {
+                       char *strp;
+                       IDnames_to_pupstring(&strp, NULL, "", &(G.main->text), NULL, NULL);
+                       node->menunr= 0;
+                       bt= uiDefButS(block, MENU, B_NODE_EXEC/*+node->nr*/, strp, 
+                                                       butr->xmin, dy, 19, 19, 
+                                                       &node->menunr, 0, 0, 0, 0, "Browses existing choices");
+                       uiButSetFunc(bt, node_browse_text_cb, ntree, node);
+                       xoff=19;
+                       if(strp) MEM_freeN(strp);       
+       }
+       else {
+               bt = uiDefBut(block, BUT, B_NOP, "Update",
+                               butr->xmin+xoff, butr->ymin+20, 50, 19,
+                               &node->menunr, 0.0, 19.0, 0, 0, "Refresh this node (and all others that use the same script)");
+               uiButSetFunc(bt, node_dynamic_update_cb, ntree, node);
+
+               if (BTST(node->custom1, NODE_DYNAMIC_ERROR)) {
+                       // UI_ThemeColor(TH_REDALERT);
+                       // XXX ui_rasterpos_safe(butr->xmin + xoff, butr->ymin + 5, snode->aspect);
+                       // XXX snode_drawstring(snode, "Error! Check console...", butr->xmax - butr->xmin);
+                       ;
                }
        }
-       return 20+19; 
 }
 
 /* only once called */
@@ -752,49 +737,49 @@ static void node_shader_set_butfunc(bNodeType *ntype)
 
                case SH_NODE_MATERIAL:
                case SH_NODE_MATERIAL_EXT:
-                       ntype->butfunc= node_shader_buts_material;
+                       ntype->uifunc= node_shader_buts_material;
                        break;
                case SH_NODE_TEXTURE:
-                       ntype->butfunc= node_buts_texture;
+                       ntype->uifunc= node_buts_texture;
                        break;
                case SH_NODE_NORMAL:
-                       ntype->butfunc= node_buts_normal;
+                       ntype->uifunc= node_buts_normal;
                        break;
                case SH_NODE_CURVE_VEC:
-                       ntype->butfunc= node_buts_curvevec;
+                       ntype->uifunc= node_buts_curvevec;
                        break;
                case SH_NODE_CURVE_RGB:
-                       ntype->butfunc= node_buts_curvecol;
+                       ntype->uifunc= node_buts_curvecol;
                        break;
                case SH_NODE_MAPPING:
-                       ntype->butfunc= node_shader_buts_mapping;
+                       ntype->uifunc= node_shader_buts_mapping;
                        break;
                case SH_NODE_VALUE:
-                       ntype->butfunc= node_buts_value;
+                       ntype->uifunc= node_buts_value;
                        break;
                case SH_NODE_RGB:
-                       ntype->butfunc= node_buts_rgb;
+                       ntype->uifunc= node_buts_rgb;
                        break;
                case SH_NODE_MIX_RGB:
-                       ntype->butfunc= node_buts_mix_rgb;
+                       ntype->uifunc= node_buts_mix_rgb;
                        break;
                case SH_NODE_VALTORGB:
-                       ntype->butfunc= node_buts_valtorgb;
+                       ntype->uifunc= node_buts_valtorgb;
                        break;
                case SH_NODE_MATH: 
-                       ntype->butfunc= node_buts_math;
+                       ntype->uifunc= node_buts_math;
                        break; 
                case SH_NODE_VECT_MATH: 
-                       ntype->butfunc= node_shader_buts_vect_math;
+                       ntype->uifunc= node_shader_buts_vect_math;
                        break; 
                case SH_NODE_GEOMETRY:
-                       ntype->butfunc= node_shader_buts_geometry;
+                       ntype->uifunc= node_shader_buts_geometry;
                        break;
                case NODE_DYNAMIC:
-                       ntype->butfunc= node_shader_buts_dynamic;
+                       ntype->uifunc= node_shader_buts_dynamic;
                        break;
                default:
-                       ntype->butfunc= NULL;
+                       ntype->uifunc= NULL;
        }
 }
 
@@ -879,112 +864,102 @@ static void image_layer_cb(bContext *C, void *ima_v, void *iuser_v)
        // allqueue(REDRAWNODE, 0);
 }
 
-static int node_composit_buts_image(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr)
+static void node_composit_buts_image(uiLayout *layout, PointerRNA *ptr)
 {
+       uiBlock *block= uiLayoutFreeBlock(layout);
+       bNode *node= ptr->data;
+       bNodeTree *ntree= ptr->id.data;
+       rctf *butr= &node->butr;
        ImageUser *iuser= node->storage;
+       uiBut *bt;
+       short dy= (short)butr->ymax-19;
+       char *strp;
        
-       if(block) {
-               uiBut *bt;
-               short dy= (short)butr->ymax-19;
-               char *strp;
+       uiBlockBeginAlign(block);
+       
+       /* browse button */
+       IMAnames_to_pupstring(&strp, NULL, "LOAD NEW %x32767", &(G.main->image), NULL, NULL);
+       node->menunr= 0;
+       bt= uiDefButS(block, MENU, B_NOP, strp, 
+                                 butr->xmin, dy, 19, 19, 
+                                 &node->menunr, 0, 0, 0, 0, "Browses existing choices");
+       uiButSetFunc(bt, node_browse_image_cb, ntree, node);
+       if(strp) MEM_freeN(strp);
+       
+       /* Add New button */
+       if(node->id==NULL) {
+               bt= uiDefBut(block, BUT, B_NODE_LOADIMAGE, "Load New",
+                                        butr->xmin+19, dy, (short)(butr->xmax-butr->xmin-19.0f), 19, 
+                                        NULL, 0.0, 0.0, 0, 0, "Add new Image");
+               uiButSetFunc(bt, node_active_cb, ntree, node);
+       }
+       else {
+               /* name button + type */
+               Image *ima= (Image *)node->id;
+               short xmin= (short)butr->xmin, xmax= (short)butr->xmax;
+               short width= xmax - xmin - 45;
+               short icon= ICON_IMAGE_DATA;
                
-               uiBlockBeginAlign(block);
+               if(ima->source==IMA_SRC_MOVIE) icon= ICON_SEQUENCE;
+               else if(ima->source==IMA_SRC_SEQUENCE) icon= ICON_IMAGE_COL;
+               else if(ima->source==IMA_SRC_GENERATED) icon= ICON_BLANK1;
                
-               /* browse button */
-               IMAnames_to_pupstring(&strp, NULL, "LOAD NEW %x32767", &(G.main->image), NULL, NULL);
-               node->menunr= 0;
-               bt= uiDefButS(block, MENU, B_NOP, strp, 
-                                         butr->xmin, dy, 19, 19, 
-                                         &node->menunr, 0, 0, 0, 0, "Browses existing choices");
-               uiButSetFunc(bt, node_browse_image_cb, ntree, node);
-               if(strp) MEM_freeN(strp);
+               bt= uiDefBut(block, TEX, B_NOP, "IM:",
+                                        xmin+19, dy, width, 19, 
+                                        node->id->name+2, 0.0, 19.0, 0, 0, "Image name");
+               uiButSetFunc(bt, node_ID_title_cb, node, NULL);
                
-               /* Add New button */
-               if(node->id==NULL) {
-                       bt= uiDefBut(block, BUT, B_NODE_LOADIMAGE, "Load New",
-                                                butr->xmin+19, dy, (short)(butr->xmax-butr->xmin-19.0f), 19, 
-                                                NULL, 0.0, 0.0, 0, 0, "Add new Image");
-                       uiButSetFunc(bt, node_active_cb, ntree, node);
-               }
-               else {
-                       /* name button + type */
-                       Image *ima= (Image *)node->id;
-                       short xmin= (short)butr->xmin, xmax= (short)butr->xmax;
-                       short width= xmax - xmin - 45;
-                       short icon= ICON_IMAGE_DATA;
-                       
-                       if(ima->source==IMA_SRC_MOVIE) icon= ICON_SEQUENCE;
-                       else if(ima->source==IMA_SRC_SEQUENCE) icon= ICON_IMAGE_COL;
-                       else if(ima->source==IMA_SRC_GENERATED) icon= ICON_BLANK1;
-                       
-                       bt= uiDefBut(block, TEX, B_NOP, "IM:",
-                                                xmin+19, dy, width, 19, 
-                                                node->id->name+2, 0.0, 19.0, 0, 0, "Image name");
-                       uiButSetFunc(bt, node_ID_title_cb, node, NULL);
-                       
-                       /* buffer type option */
-                       strp= node_image_type_pup();
-                       bt= uiDefIconTextButS(block, MENU, B_NOP, icon, strp,
-                                                xmax-26, dy, 26, 19, 
-                                                &ima->source, 0.0, 19.0, 0, 0, "Image type");
-                       uiButSetFunc(bt, node_image_type_cb, node, ima);
-                       MEM_freeN(strp);
+               /* buffer type option */
+               strp= node_image_type_pup();
+               bt= uiDefIconTextButS(block, MENU, B_NOP, icon, strp,
+                                        xmax-26, dy, 26, 19, 
+                                        &ima->source, 0.0, 19.0, 0, 0, "Image type");
+               uiButSetFunc(bt, node_image_type_cb, node, ima);
+               MEM_freeN(strp);
+               
+               if( ELEM(ima->source, IMA_SRC_MOVIE, IMA_SRC_SEQUENCE) ) {
+                       width= (xmax-xmin)/2;
                        
-                       if( ELEM(ima->source, IMA_SRC_MOVIE, IMA_SRC_SEQUENCE) ) {
-                               width= (xmax-xmin)/2;
-                               
-                               dy-= 19;
-                               uiDefButI(block, NUM, B_NODE_EXEC, "Frs:",
-                                                 xmin, dy, width, 19, 
-                                                 &iuser->frames, 1.0, MAXFRAMEF, 0, 0, "Amount of images used in animation");
-                               uiDefButI(block, NUM, B_NODE_EXEC, "SFra:",
-                                                 xmin+width, dy, width, 19, 
-                                                 &iuser->sfra, 1.0, MAXFRAMEF, 0, 0, "Start frame of animation");
+                       dy-= 19;
+                       uiDefButI(block, NUM, B_NODE_EXEC, "Frs:",
+                                         xmin, dy, width, 19, 
+                                         &iuser->frames, 1.0, MAXFRAMEF, 0, 0, "Amount of images used in animation");
+                       uiDefButI(block, NUM, B_NODE_EXEC, "SFra:",
+                                         xmin+width, dy, width, 19, 
+                                         &iuser->sfra, 1.0, MAXFRAMEF, 0, 0, "Start frame of animation");
+                       dy-= 19;
+                       uiDefButI(block, NUM, B_NODE_EXEC, "Offs:",
+                                         xmin, dy, width, 19, 
+                                         &iuser->offset, -MAXFRAMEF, MAXFRAMEF, 0, 0, "Offsets the number of the frame to use in the animation");
+                       uiDefButS(block, TOG, B_NODE_EXEC, "Cycl",
+                                         xmin+width, dy, width-20, 19, 
+                                         &iuser->cycl, 0.0, 0.0, 0, 0, "Make animation go cyclic");
+                       uiDefIconButBitS(block, TOG, IMA_ANIM_ALWAYS, B_NODE_EXEC, ICON_AUTO,
+                                         xmax-20, dy, 20, 19, 
+                                         &iuser->flag, 0.0, 0.0, 0, 0, "Always refresh Image on frame changes");
+               }
+               if( ima->type==IMA_TYPE_MULTILAYER && ima->rr) {
+                       RenderLayer *rl= BLI_findlink(&ima->rr->layers, iuser->layer);
+                       if(rl) {
+                               width= (xmax-xmin);
                                dy-= 19;
-                               uiDefButI(block, NUM, B_NODE_EXEC, "Offs:",
+                               strp= layer_menu(ima->rr);
+                               bt= uiDefButS(block, MENU, B_NODE_EXEC, strp,
                                                  xmin, dy, width, 19, 
-                                                 &iuser->offset, -MAXFRAMEF, MAXFRAMEF, 0, 0, "Offsets the number of the frame to use in the animation");
-                               uiDefButS(block, TOG, B_NODE_EXEC, "Cycl",
-                                                 xmin+width, dy, width-20, 19, 
-                                                 &iuser->cycl, 0.0, 0.0, 0, 0, "Make animation go cyclic");
-                               uiDefIconButBitS(block, TOG, IMA_ANIM_ALWAYS, B_NODE_EXEC, ICON_AUTO,
-                                                 xmax-20, dy, 20, 19, 
-                                                 &iuser->flag, 0.0, 0.0, 0, 0, "Always refresh Image on frame changes");
-                       }
-                       if( ima->type==IMA_TYPE_MULTILAYER && ima->rr) {
-                               RenderLayer *rl= BLI_findlink(&ima->rr->layers, iuser->layer);
-                               if(rl) {
-                                       width= (xmax-xmin);
-                                       dy-= 19;
-                                       strp= layer_menu(ima->rr);
-                                       bt= uiDefButS(block, MENU, B_NODE_EXEC, strp,
-                                                         xmin, dy, width, 19, 
-                                                         &iuser->layer, 0.0, 10000.0, 0, 0, "Layer");
-                                       uiButSetFunc(bt, image_layer_cb, ima->rr, node->storage);
-                                       MEM_freeN(strp);
-                               }
+                                                 &iuser->layer, 0.0, 10000.0, 0, 0, "Layer");
+                               uiButSetFunc(bt, image_layer_cb, ima->rr, node->storage);
+                               MEM_freeN(strp);
                        }
                }
+       }
                
-       }       
        if(node->id) {
-               Image *ima= (Image *)node->id;
-               int retval= 19;
-               
                /* for each draw we test for anim refresh event */
                if(iuser->flag & IMA_ANIM_REFRESHED) {
                        iuser->flag &= ~IMA_ANIM_REFRESHED;
                        // addqueue(curarea->win, UI_BUT_EVENT, B_NODE_EXEC); XXX
                }
-               
-               if( ELEM(ima->source, IMA_SRC_MOVIE, IMA_SRC_SEQUENCE) )
-                       retval+= 38;
-               if( ima->type==IMA_TYPE_MULTILAYER)
-                       retval+= 19;
-               return retval;
        }
-       else
-               return 19;
 }
 
 /* if we use render layers from other scene, we make a nice title */
@@ -1057,9 +1032,14 @@ static void node_browse_scene_cb(bContext *C, void *ntree_v, void *node_v)
 }
 
 
-static int node_composit_buts_renderlayers(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr)
+static void node_composit_buts_renderlayers(uiLayout *layout, PointerRNA *ptr)
 {
-       if(block && node->id) {
+       uiBlock *block= uiLayoutFreeBlock(layout);
+       bNode *node= ptr->data;
+       bNodeTree *ntree= ptr->id.data;
+       rctf *butr= &node->butr;
+
+       if(node->id) {
                Scene *scene= (Scene *)node->id;
                uiBut *bt;
                char *strp;
@@ -1094,7 +1074,6 @@ static int node_composit_buts_renderlayers(uiBlock *block, bNodeTree *ntree, bNo
                                  &node->custom2, 0, 0, 0, 0, "Re-render this Layer");
                
        }
-       return 19;
 }
 
 static void node_blur_relative_cb(bContext *C, void *node, void *poin2)
@@ -1126,734 +1105,719 @@ static void node_blur_update_sizey_cb(bContext *C, void *node, void *poin2)
 
        nbd->sizey= (int)(nbd->percenty*nbd->image_in_height);
 }
-static int node_composit_buts_blur(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr)
+static void node_composit_buts_blur(uiLayout *layout, PointerRNA *ptr)
 {
-       if(block) {
-               NodeBlurData *nbd= node->storage;
-               uiBut *bt;
-               short dy= butr->ymin+58;
-               short dx= (butr->xmax-butr->xmin)/2;
-               char str[256];
-               
-               uiBlockBeginAlign(block);
-               sprintf(str, "Filter Type%%t|Flat %%x%d|Tent %%x%d|Quad %%x%d|Cubic %%x%d|Gauss %%x%d|Fast Gauss%%x%d|CatRom %%x%d|Mitch %%x%d", R_FILTER_BOX, R_FILTER_TENT, R_FILTER_QUAD, R_FILTER_CUBIC, R_FILTER_GAUSS, R_FILTER_FAST_GAUSS, R_FILTER_CATROM, R_FILTER_MITCH);
-               uiDefButS(block, MENU, B_NODE_EXEC,str,
-                                 butr->xmin, dy, dx*2, 19, 
-                                 &nbd->filtertype, 0, 0, 0, 0, "Set sampling filter for blur");
-               dy-=19;
-               if (nbd->filtertype != R_FILTER_FAST_GAUSS) { 
-                       uiDefButC(block, TOG, B_NODE_EXEC, "Bokeh",
-                                       butr->xmin, dy, dx, 19, 
-                                       &nbd->bokeh, 0, 0, 0, 0, "Uses circular filter, warning it's slow!");
-                       uiDefButC(block, TOG, B_NODE_EXEC, "Gamma",
-                                       butr->xmin+dx, dy, dx, 19, 
-                                       &nbd->gamma, 0, 0, 0, 0, "Applies filter on gamma corrected values");
-               } else {
-                       uiBlockEndAlign(block);
-                       uiBlockBeginAlign(block);
-               }
-               dy-=19;
-               bt= uiDefButS(block, TOG, B_NOP, "Relative",
-                                 butr->xmin, dy, dx*2, 19,
-                                 &nbd->relative, 0, 0, 0, 0, "Use relative (percent) values to define blur radius");
-               uiButSetFunc(bt, node_blur_relative_cb, node, NULL);
-
-               dy-=19;
-               if(nbd->relative) {
-                       bt= uiDefButF(block, NUM, B_NODE_EXEC, "X:",
-                                                butr->xmin, dy, dx, 19, 
-                                                &nbd->percentx, 0.0f, 1.0f, 0, 0, "");
-                       uiButSetFunc(bt, node_blur_update_sizex_cb, node, NULL);
-                       bt= uiDefButF(block, NUM, B_NODE_EXEC, "Y:",
-                                                butr->xmin+dx, dy, dx, 19, 
-                                                &nbd->percenty, 0.0f, 1.0f, 0, 0, "");
-                       uiButSetFunc(bt, node_blur_update_sizey_cb, node, NULL);
-               }
-               else {
-                       uiDefButS(block, NUM, B_NODE_EXEC, "X:",
-                                                butr->xmin, dy, dx, 19, 
-                                                &nbd->sizex, 0, 256, 0, 0, "");
-                       uiDefButS(block, NUM, B_NODE_EXEC, "Y:",
-                                                butr->xmin+dx, dy, dx, 19, 
-                                                &nbd->sizey, 0, 256, 0, 0, "");
-               }
+       uiBlock *block= uiLayoutFreeBlock(layout);
+       bNode *node= ptr->data;
+       rctf *butr= &node->butr;
+       NodeBlurData *nbd= node->storage;
+       uiBut *bt;
+       short dy= butr->ymin+58;
+       short dx= (butr->xmax-butr->xmin)/2;
+       char str[256];
+       
+       uiBlockBeginAlign(block);
+       sprintf(str, "Filter Type%%t|Flat %%x%d|Tent %%x%d|Quad %%x%d|Cubic %%x%d|Gauss %%x%d|Fast Gauss%%x%d|CatRom %%x%d|Mitch %%x%d", R_FILTER_BOX, R_FILTER_TENT, R_FILTER_QUAD, R_FILTER_CUBIC, R_FILTER_GAUSS, R_FILTER_FAST_GAUSS, R_FILTER_CATROM, R_FILTER_MITCH);
+       uiDefButS(block, MENU, B_NODE_EXEC,str,
+                         butr->xmin, dy, dx*2, 19, 
+                         &nbd->filtertype, 0, 0, 0, 0, "Set sampling filter for blur");
+       dy-=19;
+       if (nbd->filtertype != R_FILTER_FAST_GAUSS) { 
+               uiDefButC(block, TOG, B_NODE_EXEC, "Bokeh",
+                               butr->xmin, dy, dx, 19, 
+                               &nbd->bokeh, 0, 0, 0, 0, "Uses circular filter, warning it's slow!");
+               uiDefButC(block, TOG, B_NODE_EXEC, "Gamma",
+                               butr->xmin+dx, dy, dx, 19, 
+                               &nbd->gamma, 0, 0, 0, 0, "Applies filter on gamma corrected values");
+       } else {
                uiBlockEndAlign(block);
+               uiBlockBeginAlign(block);
        }
-       return 77;
+       dy-=19;
+       bt= uiDefButS(block, TOG, B_NOP, "Relative",
+                         butr->xmin, dy, dx*2, 19,
+                         &nbd->relative, 0, 0, 0, 0, "Use relative (percent) values to define blur radius");
+       uiButSetFunc(bt, node_blur_relative_cb, node, NULL);
+
+       dy-=19;
+       if(nbd->relative) {
+               bt= uiDefButF(block, NUM, B_NODE_EXEC, "X:",
+                                        butr->xmin, dy, dx, 19, 
+                                        &nbd->percentx, 0.0f, 1.0f, 0, 0, "");
+               uiButSetFunc(bt, node_blur_update_sizex_cb, node, NULL);
+               bt= uiDefButF(block, NUM, B_NODE_EXEC, "Y:",
+                                        butr->xmin+dx, dy, dx, 19, 
+                                        &nbd->percenty, 0.0f, 1.0f, 0, 0, "");
+               uiButSetFunc(bt, node_blur_update_sizey_cb, node, NULL);
+       }
+       else {
+               uiDefButS(block, NUM, B_NODE_EXEC, "X:",
+                                        butr->xmin, dy, dx, 19, 
+                                        &nbd->sizex, 0, 256, 0, 0, "");
+               uiDefButS(block, NUM, B_NODE_EXEC, "Y:",
+                                        butr->xmin+dx, dy, dx, 19, 
+                                        &nbd->sizey, 0, 256, 0, 0, "");
+       }
+       uiBlockEndAlign(block);
 }
 
-static int node_composit_buts_dblur(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr)
+static void node_composit_buts_dblur(uiLayout *layout, PointerRNA *ptr)
 {
-       if(block) {
-               NodeDBlurData *ndbd = node->storage;
-               short dy = butr->ymin + 171;
-               short dx = butr->xmax - butr->xmin;
-               short halfdx= (short)dx/2;
-
-               uiBlockBeginAlign(block);
-               uiDefButS(block, NUM, B_NODE_EXEC, "Iterations:",
-                               butr->xmin, dy, dx, 19,
-                               &ndbd->iter, 1, 32, 10, 0, "Amount of iterations");
-               uiDefButC(block, TOG, B_NODE_EXEC, "Wrap",
-                               butr->xmin, dy-= 19, dx, 19, 
-                               &ndbd->wrap, 0, 0, 0, 0, "Wrap blur");
-               uiBlockEndAlign(block);
+       uiBlock *block= uiLayoutFreeBlock(layout);
+       bNode *node= ptr->data;
+       rctf *butr= &node->butr;
+       NodeDBlurData *ndbd = node->storage;
+       short dy = butr->ymin + 171;
+       short dx = butr->xmax - butr->xmin;
+       short halfdx= (short)dx/2;
 
-               dy-= 9;
+       uiBlockBeginAlign(block);
+       uiDefButS(block, NUM, B_NODE_EXEC, "Iterations:",
+                       butr->xmin, dy, dx, 19,
+                       &ndbd->iter, 1, 32, 10, 0, "Amount of iterations");
+       uiDefButC(block, TOG, B_NODE_EXEC, "Wrap",
+                       butr->xmin, dy-= 19, dx, 19, 
+                       &ndbd->wrap, 0, 0, 0, 0, "Wrap blur");
+       uiBlockEndAlign(block);
 
-               uiDefBut(block, LABEL, B_NOP, "Center", butr->xmin, dy-= 19, dx, 19, NULL, 0.0f, 0.0f, 0, 0, "");
+       dy-= 9;
 
-               uiBlockBeginAlign(block);
-               uiDefButF(block, NUM, B_NODE_EXEC, "X:",
-                               butr->xmin, dy-= 19, halfdx, 19,
-                               &ndbd->center_x, 0.0f, 1.0f, 10, 0, "X center in percents");
-               uiDefButF(block, NUM, B_NODE_EXEC, "Y:",
-                               butr->xmin+halfdx, dy, halfdx, 19,
-                               &ndbd->center_y, 0.0f, 1.0f, 10, 0, "Y center in percents");
-               uiBlockEndAlign(block);
+       uiDefBut(block, LABEL, B_NOP, "Center", butr->xmin, dy-= 19, dx, 19, NULL, 0.0f, 0.0f, 0, 0, "");
 
-               dy-= 9;
+       uiBlockBeginAlign(block);
+       uiDefButF(block, NUM, B_NODE_EXEC, "X:",
+                       butr->xmin, dy-= 19, halfdx, 19,
+                       &ndbd->center_x, 0.0f, 1.0f, 10, 0, "X center in percents");
+       uiDefButF(block, NUM, B_NODE_EXEC, "Y:",
+                       butr->xmin+halfdx, dy, halfdx, 19,
+                       &ndbd->center_y, 0.0f, 1.0f, 10, 0, "Y center in percents");
+       uiBlockEndAlign(block);
 
-               uiBlockBeginAlign(block);
-               uiDefButF(block, NUM, B_NODE_EXEC, "Distance:",
-                               butr->xmin, dy-= 19, dx, 19,
-                               &ndbd->distance, -1.0f, 1.0f, 10, 0, "Amount of which the image moves");
-               uiDefButF(block, NUM, B_NODE_EXEC, "Angle:",
-                               butr->xmin, dy-= 19, dx, 19,
-                               &ndbd->angle, 0.0f, 360.0f, 1000, 0, "Angle in which the image will be moved");
-               uiBlockEndAlign(block);
+       dy-= 9;
 
-               dy-= 9;
+       uiBlockBeginAlign(block);
+       uiDefButF(block, NUM, B_NODE_EXEC, "Distance:",
+                       butr->xmin, dy-= 19, dx, 19,
+                       &ndbd->distance, -1.0f, 1.0f, 10, 0, "Amount of which the image moves");
+       uiDefButF(block, NUM, B_NODE_EXEC, "Angle:",
+                       butr->xmin, dy-= 19, dx, 19,
+                       &ndbd->angle, 0.0f, 360.0f, 1000, 0, "Angle in which the image will be moved");
+       uiBlockEndAlign(block);
 
-               uiDefButF(block, NUM, B_NODE_EXEC, "Spin:",
-                               butr->xmin, dy-= 19, dx, 19,
-                               &ndbd->spin, -360.0f, 360.0f, 1000, 0, "Angle that is used to spin the image");
+       dy-= 9;
 
-               dy-= 9;
+       uiDefButF(block, NUM, B_NODE_EXEC, "Spin:",
+                       butr->xmin, dy-= 19, dx, 19,
+                       &ndbd->spin, -360.0f, 360.0f, 1000, 0, "Angle that is used to spin the image");
 
-               uiDefButF(block, NUM, B_NODE_EXEC, "Zoom:",
-                               butr->xmin, dy-= 19, dx, 19,
-                               &ndbd->zoom, 0.0f, 100.0f, 100, 0, "Amount of which the image is zoomed");
+       dy-= 9;
 
-       }
-       return 190;
+       uiDefButF(block, NUM, B_NODE_EXEC, "Zoom:",
+                       butr->xmin, dy-= 19, dx, 19,
+                       &ndbd->zoom, 0.0f, 100.0f, 100, 0, "Amount of which the image is zoomed");
 }
 
-static int node_composit_buts_bilateralblur(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr)
+static void node_composit_buts_bilateralblur(uiLayout *layout, PointerRNA *ptr)
 {
-       if(block) {
-               NodeBilateralBlurData *nbbd= node->storage;
-               short dy= butr->ymin+38;
-               short dx= (butr->xmax-butr->xmin);
-               
-               uiBlockBeginAlign(block);
-               uiDefButS(block, NUM, B_NODE_EXEC, "Iterations:",
-                                butr->xmin, dy, dx, 19, 
-                                &nbbd->iter, 1, 128, 0, 0, "Amount of iterations");
-               dy-=19;
-               uiDefButF(block, NUM, B_NODE_EXEC, "Color Sigma:",
-                                 butr->xmin, dy, dx, 19, 
-                                 &nbbd->sigma_color,0.01, 3, 10, 0, "Sigma value used to modify color");
-               dy-=19;
-               uiDefButF(block, NUM, B_NODE_EXEC, "Space Sigma:",
-                                 butr->xmin, dy, dx, 19, 
-                                 &nbbd->sigma_space ,0.01, 30, 10, 0, "Sigma value used to modify space");
-               
-       }
-       return 57;
+       uiBlock *block= uiLayoutFreeBlock(layout);
+       bNode *node= ptr->data;
+       rctf *butr= &node->butr;
+       NodeBilateralBlurData *nbbd= node->storage;
+       short dy= butr->ymin+38;
+       short dx= (butr->xmax-butr->xmin);
+       
+       uiBlockBeginAlign(block);
+       uiDefButS(block, NUM, B_NODE_EXEC, "Iterations:",
+                        butr->xmin, dy, dx, 19, 
+                        &nbbd->iter, 1, 128, 0, 0, "Amount of iterations");
+       dy-=19;
+       uiDefButF(block, NUM, B_NODE_EXEC, "Color Sigma:",
+                         butr->xmin, dy, dx, 19, 
+                         &nbbd->sigma_color,0.01, 3, 10, 0, "Sigma value used to modify color");
+       dy-=19;
+       uiDefButF(block, NUM, B_NODE_EXEC, "Space Sigma:",
+                         butr->xmin, dy, dx, 19, 
+                         &nbbd->sigma_space ,0.01, 30, 10, 0, "Sigma value used to modify space");
 }
 
 /* qdn: defocus node */
-static int node_composit_buts_defocus(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr)
-{
-       if(block) {
-               NodeDefocus *nqd = node->storage;
-               short dy = butr->ymin + 209;
-               short dx = butr->xmax - butr->xmin; 
-               char* mstr1 = "Bokeh Type%t|Octagon %x8|Heptagon %x7|Hexagon %x6|Pentagon %x5|Square %x4|Triangle %x3|Disk %x0";
-
-               uiDefBut(block, LABEL, B_NOP, "Bokeh Type", butr->xmin, dy, dx, 19, NULL, 0, 0, 0, 0, "");
-               uiDefButC(block, MENU, B_NODE_EXEC, mstr1,
-                         butr->xmin, dy-19, dx, 19,
-                         &nqd->bktype, 0, 0, 0, 0, "Bokeh type");
-               if (nqd->bktype) { /* for some reason rotating a disk doesn't seem to work... ;) */
-                       uiDefButC(block, NUM, B_NODE_EXEC, "Rotate:",
-                                 butr->xmin, dy-38, dx, 19,
-                                 &nqd->rotation, 0, 90, 0, 0, "Bokeh shape rotation offset in degrees");
-               }
-               uiDefButC(block, TOG, B_NODE_EXEC, "Gamma Correct",
-                         butr->xmin, dy-57, dx, 19,
-                         &nqd->gamco, 0, 0, 0, 0, "Enable gamma correction before and after main process");
-               if (nqd->no_zbuf==0) {
-                       // only needed for zbuffer input
-                       uiDefButF(block, NUM, B_NODE_EXEC, "fStop:",
-                                 butr->xmin, dy-76, dx, 19,
-                                 &nqd->fstop, 0.5, 128, 10, 0, "Amount of focal blur, 128=infinity=perfect focus, half the value doubles the blur radius");
-               }
-               uiDefButF(block, NUM, B_NODE_EXEC, "Maxblur:",
-                         butr->xmin, dy-95, dx, 19,
-                         &nqd->maxblur, 0, 10000, 1000, 0, "blur limit, maximum CoC radius, 0=no limit");
-               uiDefButF(block, NUM, B_NODE_EXEC, "BThreshold:",
-                         butr->xmin, dy-114, dx, 19,
-                         &nqd->bthresh, 0, 100, 100, 0, "CoC radius threshold, prevents background bleed on in-focus midground, 0=off");
-               uiDefButC(block, TOG, B_NODE_EXEC, "Preview",
-                         butr->xmin, dy-142, dx, 19,
-                         &nqd->preview, 0, 0, 0, 0, "Enable sampling mode, useful for preview when using low samplecounts");
-               if (nqd->preview) {
-                       /* only visible when sampling mode enabled */
-                       uiDefButS(block, NUM, B_NODE_EXEC, "Samples:",
-                                 butr->xmin, dy-161, dx, 19,
-                                 &nqd->samples, 16, 256, 0, 0, "Number of samples (16=grainy, higher=less noise)");
-               }
-               uiDefButS(block, TOG, B_NODE_EXEC, "No zbuffer",
-                         butr->xmin, dy-190, dx, 19,
-                         &nqd->no_zbuf, 0, 0, 0, 0, "Enable when using an image as input instead of actual zbuffer (auto enabled if node not image based, eg. time node)");
-               if (nqd->no_zbuf) {
-                       uiDefButF(block, NUM, B_NODE_EXEC, "Zscale:",
-                           butr->xmin, dy-209, dx, 19,
-                           &nqd->scale, 0, 1000, 100, 0, "Scales the Z input when not using a zbuffer, controls maximum blur designated by the color white or input value 1");
-               }
+static void node_composit_buts_defocus(uiLayout *layout, PointerRNA *ptr)
+{
+       uiBlock *block= uiLayoutFreeBlock(layout);
+       bNode *node= ptr->data;
+       rctf *butr= &node->butr;
+       NodeDefocus *nqd = node->storage;
+       short dy = butr->ymin + 209;
+       short dx = butr->xmax - butr->xmin; 
+       char* mstr1 = "Bokeh Type%t|Octagon %x8|Heptagon %x7|Hexagon %x6|Pentagon %x5|Square %x4|Triangle %x3|Disk %x0";
+
+       uiDefBut(block, LABEL, B_NOP, "Bokeh Type", butr->xmin, dy, dx, 19, NULL, 0, 0, 0, 0, "");
+       uiDefButC(block, MENU, B_NODE_EXEC, mstr1,
+                         butr->xmin, dy-19, dx, 19,
+                         &nqd->bktype, 0, 0, 0, 0, "Bokeh type");
+       if (nqd->bktype) { /* for some reason rotating a disk doesn't seem to work... ;) */
+               uiDefButC(block, NUM, B_NODE_EXEC, "Rotate:",
+                                 butr->xmin, dy-38, dx, 19,
+                                 &nqd->rotation, 0, 90, 0, 0, "Bokeh shape rotation offset in degrees");
+       }
+       uiDefButC(block, TOG, B_NODE_EXEC, "Gamma Correct",
+                         butr->xmin, dy-57, dx, 19,
+                         &nqd->gamco, 0, 0, 0, 0, "Enable gamma correction before and after main process");
+       if (nqd->no_zbuf==0) {
+               // only needed for zbuffer input
+               uiDefButF(block, NUM, B_NODE_EXEC, "fStop:",
+                                 butr->xmin, dy-76, dx, 19,
+                                 &nqd->fstop, 0.5, 128, 10, 0, "Amount of focal blur, 128=infinity=perfect focus, half the value doubles the blur radius");
+       }
+       uiDefButF(block, NUM, B_NODE_EXEC, "Maxblur:",
+                         butr->xmin, dy-95, dx, 19,
+                         &nqd->maxblur, 0, 10000, 1000, 0, "blur limit, maximum CoC radius, 0=no limit");
+       uiDefButF(block, NUM, B_NODE_EXEC, "BThreshold:",
+                         butr->xmin, dy-114, dx, 19,
+                         &nqd->bthresh, 0, 100, 100, 0, "CoC radius threshold, prevents background bleed on in-focus midground, 0=off");
+       uiDefButC(block, TOG, B_NODE_EXEC, "Preview",
+                         butr->xmin, dy-142, dx, 19,
+                         &nqd->preview, 0, 0, 0, 0, "Enable sampling mode, useful for preview when using low samplecounts");
+       if (nqd->preview) {
+               /* only visible when sampling mode enabled */
+               uiDefButS(block, NUM, B_NODE_EXEC, "Samples:",
+                                 butr->xmin, dy-161, dx, 19,
+                                 &nqd->samples, 16, 256, 0, 0, "Number of samples (16=grainy, higher=less noise)");
+       }
+       uiDefButS(block, TOG, B_NODE_EXEC, "No zbuffer",
+                         butr->xmin, dy-190, dx, 19,
+                         &nqd->no_zbuf, 0, 0, 0, 0, "Enable when using an image as input instead of actual zbuffer (auto enabled if node not image based, eg. time node)");
+       if (nqd->no_zbuf) {
+               uiDefButF(block, NUM, B_NODE_EXEC, "Zscale:",
+                               butr->xmin, dy-209, dx, 19,
+                               &nqd->scale, 0, 1000, 100, 0, "Scales the Z input when not using a zbuffer, controls maximum blur designated by the color white or input value 1");
        }
-       return 228;
 }
 
 
 /* qdn: glare node */
-static int node_composit_buts_glare(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr)
-{
-       if(block) {
-               NodeGlare *ndg = node->storage;
-               short dy = butr->ymin + 152, dx = butr->xmax - butr->xmin; 
-               char* mn1 = "Type%t|Ghosts%x3|Streaks%x2|Fog Glow%x1|Simple Star%x0";
-               char* mn2 = "Quality/Speed%t|High/Slow%x0|Medium/Medium%x1|Low/Fast%x2";
-               uiDefButC(block, MENU, B_NODE_EXEC, mn1,
-                         butr->xmin, dy, dx, 19,
-                         &ndg->type, 0, 0, 0, 0, "Glow/Flare/Bloom type");
-               uiDefButC(block, MENU, B_NODE_EXEC, mn2,
-                         butr->xmin, dy-19, dx, 19,
-                         &ndg->quality, 0, 0, 0, 0,
-                         "Quality speed trade off, if not set to high quality, effect will be applied to low-res copy of source image");
-               if (ndg->type != 1) {
-                       uiDefButC(block, NUM, B_NODE_EXEC, "Iterations:",
-                                 butr->xmin, dy-38, dx, 19,
-                                 &ndg->iter, 2, 5, 1, 0,
-                                 "higher values will generate longer/more streaks/ghosts");
-                       if (ndg->type != 0)
-                               uiDefButF(block, NUM, B_NODE_EXEC, "ColMod:",
-                                         butr->xmin, dy-57, dx, 19,
-                                         &ndg->colmod, 0, 1, 10, 0,
-                                         "Amount of Color Modulation, modulates colors of streaks and ghosts for a spectral dispersion effect");
-               }
-               uiDefButF(block, NUM, B_NODE_EXEC, "Mix:",
-                         butr->xmin, dy-76, dx, 19,
-                         &ndg->mix, -1, 1, 10, 0,
-                         "Mix balance, -1 is original image only, 0 is exact 50/50 mix, 1 is processed image only");
-               uiDefButF(block, NUM, B_NODE_EXEC, "Threshold:",
-                         butr->xmin, dy-95, dx, 19,
-                         &ndg->threshold, 0, 1000, 10, 0,
-                         "Brightness threshold, the glarefilter will be applied only to pixels brighter than this value");
-               if ((ndg->type == 2) || (ndg->type == 0))
-               {
-                       if (ndg->type == 2) {
-                               uiDefButC(block, NUM, B_NODE_EXEC, "streaks:",
-                                         butr->xmin, dy-114, dx, 19,
-                                         &ndg->angle, 2, 16, 1000, 0,
-                                         "Total number of streaks");
-                               uiDefButC(block, NUM, B_NODE_EXEC, "AngOfs:",
-                                         butr->xmin, dy-133, dx, 19,
-                                         &ndg->angle_ofs, 0, 180, 1000, 0,
-                                         "Streak angle rotation offset in degrees");
-                       }
-                       uiDefButF(block, NUM, B_NODE_EXEC, "Fade:",
-                                 butr->xmin, dy-152, dx, 19,
-                                 &ndg->fade, 0.75, 1, 5, 0,
-                                 "Streak fade out factor");
+static void node_composit_buts_glare(uiLayout *layout, PointerRNA *ptr)
+{
+       uiBlock *block= uiLayoutFreeBlock(layout);
+       bNode *node= ptr->data;
+       rctf *butr= &node->butr;
+       NodeGlare *ndg = node->storage;
+       short dy = butr->ymin + 152, dx = butr->xmax - butr->xmin; 
+       char* mn1 = "Type%t|Ghosts%x3|Streaks%x2|Fog Glow%x1|Simple Star%x0";
+       char* mn2 = "Quality/Speed%t|High/Slow%x0|Medium/Medium%x1|Low/Fast%x2";
+       uiDefButC(block, MENU, B_NODE_EXEC, mn1,
+                         butr->xmin, dy, dx, 19,
+                         &ndg->type, 0, 0, 0, 0, "Glow/Flare/Bloom type");
+       uiDefButC(block, MENU, B_NODE_EXEC, mn2,
+                         butr->xmin, dy-19, dx, 19,
+                         &ndg->quality, 0, 0, 0, 0,
+                         "Quality speed trade off, if not set to high quality, effect will be applied to low-res copy of source image");
+       if (ndg->type != 1) {
+               uiDefButC(block, NUM, B_NODE_EXEC, "Iterations:",
+                                 butr->xmin, dy-38, dx, 19,
+                                 &ndg->iter, 2, 5, 1, 0,
+                                 "higher values will generate longer/more streaks/ghosts");
+               if (ndg->type != 0)
+                       uiDefButF(block, NUM, B_NODE_EXEC, "ColMod:",
+                                         butr->xmin, dy-57, dx, 19,
+                                         &ndg->colmod, 0, 1, 10, 0,
+                                         "Amount of Color Modulation, modulates colors of streaks and ghosts for a spectral dispersion effect");
+       }
+       uiDefButF(block, NUM, B_NODE_EXEC, "Mix:",
+                         butr->xmin, dy-76, dx, 19,
+                         &ndg->mix, -1, 1, 10, 0,
+                         "Mix balance, -1 is original image only, 0 is exact 50/50 mix, 1 is processed image only");
+       uiDefButF(block, NUM, B_NODE_EXEC, "Threshold:",
+                         butr->xmin, dy-95, dx, 19,
+                         &ndg->threshold, 0, 1000, 10, 0,
+                         "Brightness threshold, the glarefilter will be applied only to pixels brighter than this value");
+       if ((ndg->type == 2) || (ndg->type == 0))
+       {
+               if (ndg->type == 2) {
+                       uiDefButC(block, NUM, B_NODE_EXEC, "streaks:",
+                                         butr->xmin, dy-114, dx, 19,
+                                         &ndg->angle, 2, 16, 1000, 0,
+                                         "Total number of streaks");
+                       uiDefButC(block, NUM, B_NODE_EXEC, "AngOfs:",
+                                         butr->xmin, dy-133, dx, 19,
+                                         &ndg->angle_ofs, 0, 180, 1000, 0,
+                                         "Streak angle rotation offset in degrees");
                }
-               if (ndg->type == 0)
-                       uiDefButC(block, TOG, B_NODE_EXEC, "Rot45",
-                                 butr->xmin, dy-114, dx, 19,
-                                 &ndg->angle, 0, 0, 0, 0,
-                                 "simple star filter, add 45 degree rotation offset");
-               if ((ndg->type == 1) || (ndg->type > 3))        // PBGH and fog glow
-                       uiDefButC(block, NUM, B_NODE_EXEC, "Size:",
-                                 butr->xmin, dy-114, dx, 19,
-                                 &ndg->size, 6, 9, 1000, 0,
-                                 "glow/glare size (not actual size, relative to initial size of bright area of pixels)");
-       }
-       return 171;
+               uiDefButF(block, NUM, B_NODE_EXEC, "Fade:",
+                                 butr->xmin, dy-152, dx, 19,
+                                 &ndg->fade, 0.75, 1, 5, 0,
+                                 "Streak fade out factor");
+       }
+       if (ndg->type == 0)
+               uiDefButC(block, TOG, B_NODE_EXEC, "Rot45",
+                                 butr->xmin, dy-114, dx, 19,
+                                 &ndg->angle, 0, 0, 0, 0,
+                                 "simple star filter, add 45 degree rotation offset");
+       if ((ndg->type == 1) || (ndg->type > 3))        // PBGH and fog glow
+               uiDefButC(block, NUM, B_NODE_EXEC, "Size:",
+                                 butr->xmin, dy-114, dx, 19,
+                                 &ndg->size, 6, 9, 1000, 0,
+                                 "glow/glare size (not actual size, relative to initial size of bright area of pixels)");
 }
 
 /* qdn: tonemap node */
-static int node_composit_buts_tonemap(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr)
+static void node_composit_buts_tonemap(uiLayout *layout, PointerRNA *ptr)
 {
-       if(block) {
-               NodeTonemap *ntm = node->storage;
-               short dy = butr->ymin + 76, dx = butr->xmax - butr->xmin; 
-               char* mn = "Type%t|R/D Photoreceptor%x1|Rh Simple%x0";
-               
-               uiBlockBeginAlign(block);
-               uiDefButI(block, MENU, B_NODE_EXEC, mn,
-                         butr->xmin, dy, dx, 19,
-                         &ntm->type, 0, 0, 0, 0,
-                         "Tone mapping type");
-               if (ntm->type == 0) {
-                       uiDefButF(block, NUM, B_NODE_EXEC, "Key:",
-                                 butr->xmin, dy-19, dx, 19,
-                                 &ntm->key, 0, 1, 5, 0,
-                                 "The value the average luminance is mapped to");
-                       uiDefButF(block, NUM, B_NODE_EXEC, "Offset:",
-                                 butr->xmin, dy-38, dx, 19,
-                                 &ntm->offset, 0.001, 10, 5, 0,
-                                 "Tonemap offset, normally always 1, but can be used as an extra control to alter the brightness curve");
-                       uiDefButF(block, NUM, B_NODE_EXEC, "Gamma:",
-                                 butr->xmin, dy-57, dx, 19,
-                                 &ntm->gamma, 0.001, 3, 5, 0,
-                                 "Gamma factor, if not used, set to 1");
-               }
-               else {
-                       uiDefButF(block, NUM, B_NODE_EXEC, "Intensity:",
-                                 butr->xmin, dy-19, dx, 19,
-                                 &ntm->f, -8, 8, 10, 0, "if less than zero, darkens image, otherwise makes it brighter");
-                       uiDefButF(block, NUM, B_NODE_EXEC, "Contrast:",
-                                 butr->xmin, dy-38, dx, 19,
-                                 &ntm->m, 0, 1, 5, 0, "Set to 0 to use estimate from input image");
-                       uiDefButF(block, NUM, B_NODE_EXEC, "Adaptation:",
-                                 butr->xmin, dy-57, dx, 19,
-                                 &ntm->a, 0, 1, 5, 0, "if 0, global, if 1, based on pixel intensity");
-                       uiDefButF(block, NUM, B_NODE_EXEC, "ColCorrect:",
-                                 butr->xmin, dy-76, dx, 19,
-                                 &ntm->c, 0, 1, 5, 0, "color correction, if 0, same for all channels, if 1, each independent");
-               }
-               uiBlockEndAlign(block);
+       uiBlock *block= uiLayoutFreeBlock(layout);
+       bNode *node= ptr->data;
+       rctf *butr= &node->butr;
+       NodeTonemap *ntm = node->storage;
+       short dy = butr->ymin + 76, dx = butr->xmax - butr->xmin; 
+       char* mn = "Type%t|R/D Photoreceptor%x1|Rh Simple%x0";
+       
+       uiBlockBeginAlign(block);
+       uiDefButI(block, MENU, B_NODE_EXEC, mn,
+                         butr->xmin, dy, dx, 19,
+                         &ntm->type, 0, 0, 0, 0,
+                         "Tone mapping type");
+       if (ntm->type == 0) {
+               uiDefButF(block, NUM, B_NODE_EXEC, "Key:",
+                                 butr->xmin, dy-19, dx, 19,
+                                 &ntm->key, 0, 1, 5, 0,
+                                 "The value the average luminance is mapped to");
+               uiDefButF(block, NUM, B_NODE_EXEC, "Offset:",
+                                 butr->xmin, dy-38, dx, 19,
+                                 &ntm->offset, 0.001, 10, 5, 0,
+                                 "Tonemap offset, normally always 1, but can be used as an extra control to alter the brightness curve");
+               uiDefButF(block, NUM, B_NODE_EXEC, "Gamma:",
+                                 butr->xmin, dy-57, dx, 19,
+                                 &ntm->gamma, 0.001, 3, 5, 0,
+                                 "Gamma factor, if not used, set to 1");
        }
-       return 95;
+       else {
+               uiDefButF(block, NUM, B_NODE_EXEC, "Intensity:",
+                                 butr->xmin, dy-19, dx, 19,
+                                 &ntm->f, -8, 8, 10, 0, "if less than zero, darkens image, otherwise makes it brighter");
+               uiDefButF(block, NUM, B_NODE_EXEC, "Contrast:",
+                                 butr->xmin, dy-38, dx, 19,
+                                 &ntm->m, 0, 1, 5, 0, "Set to 0 to use estimate from input image");
+               uiDefButF(block, NUM, B_NODE_EXEC, "Adaptation:",
+                                 butr->xmin, dy-57, dx, 19,
+                                 &ntm->a, 0, 1, 5, 0, "if 0, global, if 1, based on pixel intensity");
+               uiDefButF(block, NUM, B_NODE_EXEC, "ColCorrect:",
+                                 butr->xmin, dy-76, dx, 19,
+                                 &ntm->c, 0, 1, 5, 0, "color correction, if 0, same for all channels, if 1, each independent");
+       }
+       uiBlockEndAlign(block);
 }
 
 /* qdn: lens distortion node */
-static int node_composit_buts_lensdist(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr)
+static void node_composit_buts_lensdist(uiLayout *layout, PointerRNA *ptr)
 {
-       if(block) {
-               NodeLensDist *nld = node->storage;
-               short dy = butr->ymin + 19, dx = butr->xmax - butr->xmin; 
-               uiBlockBeginAlign(block);
-               uiDefButS(block, TOG, B_NODE_EXEC, "Projector",
-                         butr->xmin, dy, dx, 19,
-                         &nld->proj, 0, 0, 0, 0,
-                         "Enable/disable projector mode, effect is applied in horizontal direction only");
-               if (!nld->proj) {
-                       uiDefButS(block, TOG, B_NODE_EXEC, "Jitter",
-                                 butr->xmin, dy-19, dx/2, 19,
-                                 &nld->jit, 0, 0, 0, 0,
-                                 "Enable/disable jittering, faster, but also noisier");
-                       uiDefButS(block, TOG, B_NODE_EXEC, "Fit",
-                                 butr->xmin+dx/2, dy-19, dx/2, 19,
-                                 &nld->fit, 0, 0, 0, 0,
-                                 "For positive distortion factor only, scale image such that black areas are not visible");
-               }
-               uiBlockEndAlign(block);
+       uiBlock *block= uiLayoutFreeBlock(layout);
+       bNode *node= ptr->data;
+       rctf *butr= &node->butr;
+       NodeLensDist *nld = node->storage;
+       short dy = butr->ymin + 19, dx = butr->xmax - butr->xmin; 
+       uiBlockBeginAlign(block);
+       uiDefButS(block, TOG, B_NODE_EXEC, "Projector",
+                         butr->xmin, dy, dx, 19,
+                         &nld->proj, 0, 0, 0, 0,
+                         "Enable/disable projector mode, effect is applied in horizontal direction only");
+       if (!nld->proj) {
+               uiDefButS(block, TOG, B_NODE_EXEC, "Jitter",
+                                 butr->xmin, dy-19, dx/2, 19,
+                                 &nld->jit, 0, 0, 0, 0,
+                                 "Enable/disable jittering, faster, but also noisier");
+               uiDefButS(block, TOG, B_NODE_EXEC, "Fit",
+                                 butr->xmin+dx/2, dy-19, dx/2, 19,
+                                 &nld->fit, 0, 0, 0, 0,
+                                 "For positive distortion factor only, scale image such that black areas are not visible");
        }
-       return 38;
+       uiBlockEndAlign(block);
 }
 
 
-static int node_composit_buts_vecblur(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr)
+static void node_composit_buts_vecblur(uiLayout *layout, PointerRNA *ptr)
 {
-       if(block) {
-               PointerRNA ptr;
-               short dy= butr->ymin;
-               short dx= (butr->xmax-butr->xmin);
-               
-               RNA_pointer_create((ID *)ntree, &RNA_Node, node, &ptr);
-               
-               uiBlockBeginAlign(block);       
-               uiDefButR(block, NUM, B_NODE_EXEC, NULL, 
-                       butr->xmin, dy+76, dx, 19, 
-                       &ptr, "samples", 0, 1, 256, 0, 0, NULL);
-               uiDefButR(block, NUM, B_NODE_EXEC, NULL, 
-                       butr->xmin, dy+57, dx, 19, 
-                       &ptr, "min_speed", 0, 0, 1024, 0, 0, NULL);
-               uiDefButR(block, NUM, B_NODE_EXEC, NULL, 
-                       butr->xmin, dy+38, dx, 19, 
-                       &ptr, "max_speed", 0, 0, 1024, 0, 0, NULL);
-               uiDefButR(block, NUM, B_NODE_EXEC, "Blur", 
-                       butr->xmin, dy+19, dx, 19, 
-                       &ptr, "factor", 0, 0, 2, 10, 2, NULL);
-               uiDefButR(block, TOG, B_NODE_EXEC, NULL, 
-                       butr->xmin, dy, dx, 19, 
-                       &ptr, "curved", 0, 0, 2, 10, 2, NULL);
-               uiBlockEndAlign(block);
-       }
-       return 95;
+       uiLayout *col;
+       
+       col= uiLayoutColumn(layout, 1);
+       uiItemR(col, NULL, 0, ptr, "samples", 0);
+       uiItemR(col, NULL, 0, ptr, "min_speed", 0);
+       uiItemR(col, NULL, 0, ptr, "max_speed", 0);
+       uiItemR(col, "Blur", 0, ptr, "factor", 0);
+
+       col= uiLayoutColumn(layout, 0);
+       uiItemR(col, NULL, 0, ptr, "curved", 0);
 }
 
-static int node_composit_buts_filter(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr)
+static void node_composit_buts_filter(uiLayout *layout, PointerRNA *ptr)
 {
-       if(block) {
-               uiBut *bt;
-               
-               /* blend type */
-               bt=uiDefButS(block, MENU, B_NODE_EXEC, "Soften %x0|Sharpen %x1|Laplace %x2|Sobel %x3|Prewitt %x4|Kirsch %x5|Shadow %x6",
-                                        butr->xmin, butr->ymin, butr->xmax-butr->xmin, 20, 
-                                        &node->custom1, 0, 0, 0, 0, "");
-               uiButSetFunc(bt, node_but_title_cb, node, bt);
-       }
-       return 20;
+       uiBlock *block= uiLayoutFreeBlock(layout);
+       bNode *node= ptr->data;
+       rctf *butr= &node->butr;
+       uiBut *bt;
+       
+       /* blend type */
+       bt=uiDefButS(block, MENU, B_NODE_EXEC, "Soften %x0|Sharpen %x1|Laplace %x2|Sobel %x3|Prewitt %x4|Kirsch %x5|Shadow %x6",
+                                butr->xmin, butr->ymin, butr->xmax-butr->xmin, 20, 
+                                &node->custom1, 0, 0, 0, 0, "");
+       uiButSetFunc(bt, node_but_title_cb, node, bt);
 }
 
-static int node_composit_buts_flip(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr) 
+static void node_composit_buts_flip(uiLayout *layout, PointerRNA *ptr)
 {
-       if(block) {
-               uiBut *bt;
-               
-               /* flip x\y */
-               bt=uiDefButS(block, MENU, B_NODE_EXEC, "Flip X %x0|Flip Y %x1|Flip X & Y %x2",
-                                        butr->xmin, butr->ymin, butr->xmax-butr->xmin, 20, 
-                                        &node->custom1, 0, 0, 0, 0, "");
-               uiButSetFunc(bt, node_but_title_cb, node, bt);
-       }
-       return 20;      
+       uiBlock *block= uiLayoutFreeBlock(layout);
+       bNode *node= ptr->data;
+       rctf *butr= &node->butr;
+       uiBut *bt;
+       
+       /* flip x\y */
+       bt=uiDefButS(block, MENU, B_NODE_EXEC, "Flip X %x0|Flip Y %x1|Flip X & Y %x2",
+                                butr->xmin, butr->ymin, butr->xmax-butr->xmin, 20, 
+                                &node->custom1, 0, 0, 0, 0, "");
+       uiButSetFunc(bt, node_but_title_cb, node, bt);
 }
 
-static int node_composit_buts_crop(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr)
+static void node_composit_buts_crop(uiLayout *layout, PointerRNA *ptr)
 {
-       if(block) {
-               NodeTwoXYs *ntxy= node->storage;
-               char elementheight = 19;
-               short dx= (butr->xmax-butr->xmin)/2;
-               short dy= butr->ymax - elementheight;
-               short xymin= 0, xymax= 10000;
+       uiBlock *block= uiLayoutFreeBlock(layout);
+       bNode *node= ptr->data;
+       rctf *butr= &node->butr;
+       NodeTwoXYs *ntxy= node->storage;
+       char elementheight = 19;
+       short dx= (butr->xmax-butr->xmin)/2;
+       short dy= butr->ymax - elementheight;
+       short xymin= 0, xymax= 10000;
 
-               uiBlockBeginAlign(block);
+       uiBlockBeginAlign(block);
 
-               /* crop image size toggle */
-               uiDefButS(block, TOG, B_NODE_EXEC, "Crop Image Size",
-                                 butr->xmin, dy, dx*2, elementheight, 
-                                 &node->custom1, 0, 0, 0, 0, "Crop the size of the input image.");
-
-               dy-=elementheight;
-
-               /* x1 */
-               uiDefButS(block, NUM, B_NODE_EXEC, "X1:",
-                                        butr->xmin, dy, dx, elementheight,
-                                        &ntxy->x1, xymin, xymax, 0, 0, "");
-               /* y1 */
-               uiDefButS(block, NUM, B_NODE_EXEC, "Y1:",
-                                        butr->xmin+dx, dy, dx, elementheight,
-                                        &ntxy->y1, xymin, xymax, 0, 0, "");
-
-               dy-=elementheight;
-
-               /* x2 */
-               uiDefButS(block, NUM, B_NODE_EXEC, "X2:",
-                                        butr->xmin, dy, dx, elementheight,
-                                        &ntxy->x2, xymin, xymax, 0, 0, "");
-               /* y2 */
-               uiDefButS(block, NUM, B_NODE_EXEC, "Y2:",
-                                        butr->xmin+dx, dy, dx, elementheight,
-                                        &ntxy->y2, xymin, xymax, 0, 0, "");
+       /* crop image size toggle */
+       uiDefButS(block, TOG, B_NODE_EXEC, "Crop Image Size",
+                         butr->xmin, dy, dx*2, elementheight, 
+                         &node->custom1, 0, 0, 0, 0, "Crop the size of the input image.");
+
+       dy-=elementheight;
+
+       /* x1 */
+       uiDefButS(block, NUM, B_NODE_EXEC, "X1:",
+                                butr->xmin, dy, dx, elementheight,
+                                &ntxy->x1, xymin, xymax, 0, 0, "");
+       /* y1 */
+       uiDefButS(block, NUM, B_NODE_EXEC, "Y1:",
+                                butr->xmin+dx, dy, dx, elementheight,
+                                &ntxy->y1, xymin, xymax, 0, 0, "");
+
+       dy-=elementheight;
+
+       /* x2 */
+       uiDefButS(block, NUM, B_NODE_EXEC, "X2:",
+                                butr->xmin, dy, dx, elementheight,
+                                &ntxy->x2, xymin, xymax, 0, 0, "");
+       /* y2 */
+       uiDefButS(block, NUM, B_NODE_EXEC, "Y2:",
+                                butr->xmin+dx, dy, dx, elementheight,
+                                &ntxy->y2, xymin, xymax, 0, 0, "");
 
-               uiBlockEndAlign(block);
-       }
-       return 60;
+       uiBlockEndAlign(block);
 }
 
-static int node_composit_buts_splitviewer(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr)
+static void node_composit_buts_splitviewer(uiLayout *layout, PointerRNA *ptr)
 {
-       if(block) {     
-               uiBlockBeginAlign(block);
-               
-               uiDefButS(block, ROW, B_NODE_EXEC, "X",
-                                 butr->xmin, butr->ymin+19, (butr->xmax-butr->xmin)/2, 20, 
-                                 &node->custom2, 0.0, 0.0, 0, 0, "");
-               uiDefButS(block, ROW, B_NODE_EXEC, "Y",
-                                 butr->xmin+(butr->xmax-butr->xmin)/2, butr->ymin+19, (butr->xmax-butr->xmin)/2, 20, 
-                                 &node->custom2, 0.0, 1.0, 0, 0, "");
-                                 
-               uiDefButS(block, NUMSLI, B_NODE_EXEC, "Split %: ",
-                               butr->xmin, butr->ymin, butr->xmax-butr->xmin, 20, &node->custom1, 0, 100, 10, 0, "");
-       }
-       return 40;
-}
-
-static int node_composit_buts_map_value(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr)
-{
-       if(block) {
-               TexMapping *texmap= node->storage;
-               short xstart= (short)butr->xmin;
-               short dy= (short)(butr->ymax-19.0f);
-               short dx= (short)(butr->xmax-butr->xmin)/2;
-               
-               uiBlockBeginAlign(block);
-               uiDefButF(block, NUM, B_NODE_EXEC, "Offs:", xstart, dy, 2*dx, 19, texmap->loc, -1000.0f, 1000.0f, 10, 2, "");
-               dy-= 19;
-               uiDefButF(block, NUM, B_NODE_EXEC, "Size:", xstart, dy, 2*dx, 19, texmap->size, -1000.0f, 1000.0f, 10, 3, "");
-               dy-= 23;
-               uiBlockBeginAlign(block);
-               uiDefButBitI(block, TOG, TEXMAP_CLIP_MIN, B_NODE_EXEC, "Min", xstart, dy, dx, 19, &texmap->flag, 0.0f, 0.0f, 0, 0, "");
-               uiDefButF(block, NUM, B_NODE_EXEC, "", xstart+dx, dy, dx, 19, texmap->min, -1000.0f, 1000.0f, 10, 2, "");
-               dy-= 19;
-               uiDefButBitI(block, TOG, TEXMAP_CLIP_MAX, B_NODE_EXEC, "Max", xstart, dy, dx, 19, &texmap->flag, 0.0f, 0.0f, 0, 0, "");
-               uiDefButF(block, NUM, B_NODE_EXEC, "", xstart+dx, dy, dx, 19, texmap->max, -1000.0f, 1000.0f, 10, 2, "");
-       }
-       return 80;
+       uiBlock *block= uiLayoutFreeBlock(layout);
+       bNode *node= ptr->data;
+       rctf *butr= &node->butr;
+
+       uiBlockBeginAlign(block);
+       
+       uiDefButS(block, ROW, B_NODE_EXEC, "X",
+                         butr->xmin, butr->ymin+19, (butr->xmax-butr->xmin)/2, 20, 
+                         &node->custom2, 0.0, 0.0, 0, 0, "");
+       uiDefButS(block, ROW, B_NODE_EXEC, "Y",
+                         butr->xmin+(butr->xmax-butr->xmin)/2, butr->ymin+19, (butr->xmax-butr->xmin)/2, 20, 
+                         &node->custom2, 0.0, 1.0, 0, 0, "");
+                         
+       uiDefButS(block, NUMSLI, B_NODE_EXEC, "Split %: ",
+                       butr->xmin, butr->ymin, butr->xmax-butr->xmin, 20, &node->custom1, 0, 100, 10, 0, "");
 }
 
-static int node_composit_buts_alphaover(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr)
+static void node_composit_buts_map_value(uiLayout *layout, PointerRNA *ptr)
 {
-       if(block) {
-               NodeTwoFloats *ntf= node->storage;
-               
-               /* alpha type */
-               uiDefButS(block, TOG, B_NODE_EXEC, "ConvertPremul",
-                                 butr->xmin, butr->ymin+19, butr->xmax-butr->xmin, 19, 
-                                 &node->custom1, 0, 0, 0, 0, "");
-               /* mix factor */
-               uiDefButF(block, NUM, B_NODE_EXEC, "Premul: ",
-                                 butr->xmin, butr->ymin, butr->xmax-butr->xmin, 19, 
-                                 &ntf->x, 0.0f, 1.0f, 100, 0, "");
-       }
-       return 38;
+       uiBlock *block= uiLayoutFreeBlock(layout);
+       bNode *node= ptr->data;
+       rctf *butr= &node->butr;
+       TexMapping *texmap= node->storage;
+       short xstart= (short)butr->xmin;
+       short dy= (short)(butr->ymax-19.0f);
+       short dx= (short)(butr->xmax-butr->xmin)/2;
+       
+       uiBlockBeginAlign(block);
+       uiDefButF(block, NUM, B_NODE_EXEC, "Offs:", xstart, dy, 2*dx, 19, texmap->loc, -1000.0f, 1000.0f, 10, 2, "");
+       dy-= 19;
+       uiDefButF(block, NUM, B_NODE_EXEC, "Size:", xstart, dy, 2*dx, 19, texmap->size, -1000.0f, 1000.0f, 10, 3, "");
+       dy-= 23;
+       uiBlockBeginAlign(block);
+       uiDefButBitI(block, TOG, TEXMAP_CLIP_MIN, B_NODE_EXEC, "Min", xstart, dy, dx, 19, &texmap->flag, 0.0f, 0.0f, 0, 0, "");
+       uiDefButF(block, NUM, B_NODE_EXEC, "", xstart+dx, dy, dx, 19, texmap->min, -1000.0f, 1000.0f, 10, 2, "");
+       dy-= 19;
+       uiDefButBitI(block, TOG, TEXMAP_CLIP_MAX, B_NODE_EXEC, "Max", xstart, dy, dx, 19, &texmap->flag, 0.0f, 0.0f, 0, 0, "");
+       uiDefButF(block, NUM, B_NODE_EXEC, "", xstart+dx, dy, dx, 19, texmap->max, -1000.0f, 1000.0f, 10, 2, "");
 }
 
-static int node_composit_buts_hue_sat(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr)
+static void node_composit_buts_alphaover(uiLayout *layout, PointerRNA *ptr)
 {
-       if(block) {
-               NodeHueSat *nhs= node->storage;
-               
-               uiBlockBeginAlign(block);
-               uiDefButF(block, NUMSLI, B_NODE_EXEC, "Hue: ",
-                                 butr->xmin, butr->ymin+40.0f, butr->xmax-butr->xmin, 20, 
-                                 &nhs->hue, 0.0f, 1.0f, 100, 0, "");
-               uiDefButF(block, NUMSLI, B_NODE_EXEC, "Sat: ",
-                                 butr->xmin, butr->ymin+20.0f, butr->xmax-butr->xmin, 20, 
-                                 &nhs->sat, 0.0f, 2.0f, 100, 0, "");
-               uiDefButF(block, NUMSLI, B_NODE_EXEC, "Val: ",
-                                 butr->xmin, butr->ymin, butr->xmax-butr->xmin, 20, 
-                                 &nhs->val, 0.0f, 2.0f, 100, 0, "");
-       }
-       return 60;
+       uiBlock *block= uiLayoutFreeBlock(layout);
+       bNode *node= ptr->data;
+       rctf *butr= &node->butr;
+       NodeTwoFloats *ntf= node->storage;
+       
+       /* alpha type */
+       uiDefButS(block, TOG, B_NODE_EXEC, "ConvertPremul",
+                         butr->xmin, butr->ymin+19, butr->xmax-butr->xmin, 19, 
+                         &node->custom1, 0, 0, 0, 0, "");
+       /* mix factor */
+       uiDefButF(block, NUM, B_NODE_EXEC, "Premul: ",
+                         butr->xmin, butr->ymin, butr->xmax-butr->xmin, 19, 
+                         &ntf->x, 0.0f, 1.0f, 100, 0, "");
 }
 
-static int node_composit_buts_dilateerode(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr)
+static void node_composit_buts_hue_sat(uiLayout *layout, PointerRNA *ptr)
 {
-       if(block) {
-               uiDefButS(block, NUM, B_NODE_EXEC, "Distance:",
-                                 butr->xmin, butr->ymin, butr->xmax-butr->xmin, 20, 
-                                 &node->custom2, -100, 100, 0, 0, "Distance to grow/shrink (number of iterations)");
-       }
-       return 20;
+       uiBlock *block= uiLayoutFreeBlock(layout);
+       bNode *node= ptr->data;
+       rctf *butr= &node->butr;
+       NodeHueSat *nhs= node->storage;
+       
+       uiBlockBeginAlign(block);
+       uiDefButF(block, NUMSLI, B_NODE_EXEC, "Hue: ",
+                         butr->xmin, butr->ymin+40.0f, butr->xmax-butr->xmin, 20, 
+                         &nhs->hue, 0.0f, 1.0f, 100, 0, "");
+       uiDefButF(block, NUMSLI, B_NODE_EXEC, "Sat: ",
+                         butr->xmin, butr->ymin+20.0f, butr->xmax-butr->xmin, 20, 
+                         &nhs->sat, 0.0f, 2.0f, 100, 0, "");
+       uiDefButF(block, NUMSLI, B_NODE_EXEC, "Val: ",
+                         butr->xmin, butr->ymin, butr->xmax-butr->xmin, 20, 
+                         &nhs->val, 0.0f, 2.0f, 100, 0, "");
 }
 
-static int node_composit_buts_diff_matte(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr)
+static void node_composit_buts_dilateerode(uiLayout *layout, PointerRNA *ptr)
 {
-       if(block) {
-               NodeChroma *c= node->storage;
-               
-               uiBlockBeginAlign(block);
-               uiDefButF(block, NUMSLI, B_NODE_EXEC+node->nr, "Tolerance: ", 
-                       butr->xmin, butr->ymin+20, butr->xmax-butr->xmin, 20,
-                       &c->t1, 0.0f, 1.0f, 100, 0, "Color differences below this threshold are keyed.");
-               uiDefButF(block, NUMSLI, B_NODE_EXEC+node->nr, "Falloff: ", 
-                       butr->xmin, butr->ymin, butr->xmax-butr->xmin, 20,
-                       &c->t2, 0.0f, 1.0f, 100, 0, "Color differences below this additional threshold are partially keyed.");
-      uiBlockEndAlign(block);
-       }
-       return 40;
+       uiBlock *block= uiLayoutFreeBlock(layout);
+       bNode *node= ptr->data;
+       rctf *butr= &node->butr;
+
+       uiDefButS(block, NUM, B_NODE_EXEC, "Distance:",
+                         butr->xmin, butr->ymin, butr->xmax-butr->xmin, 20, 
+                         &node->custom2, -100, 100, 0, 0, "Distance to grow/shrink (number of iterations)");
 }
 
-static int node_composit_buts_distance_matte(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr)
+static void node_composit_buts_diff_matte(uiLayout *layout, PointerRNA *ptr)
 {
-       if(block) {
-               NodeChroma *c= node->storage;
-               
-               uiBlockBeginAlign(block);
-               uiDefButF(block, NUMSLI, B_NODE_EXEC+node->nr, "Tolerance: ", 
-                       butr->xmin, butr->ymin+20, butr->xmax-butr->xmin, 20,
-                       &c->t1, 0.0f, 1.0f, 100, 0, "Color distances below this threshold are keyed.");
-               uiDefButF(block, NUMSLI, B_NODE_EXEC+node->nr, "Falloff: ", 
-                       butr->xmin, butr->ymin, butr->xmax-butr->xmin, 20,
-                       &c->t2, 0.0f, 1.0f, 100, 0, "Color distances below this additional threshold are partially keyed.");
-       uiBlockEndAlign(block);
-       }
-       return 40;
+       uiBlock *block= uiLayoutFreeBlock(layout);
+       bNode *node= ptr->data;
+       rctf *butr= &node->butr;
+       NodeChroma *c= node->storage;
+       
+       uiBlockBeginAlign(block);
+       uiDefButF(block, NUMSLI, B_NODE_EXEC+node->nr, "Tolerance: ", 
+               butr->xmin, butr->ymin+20, butr->xmax-butr->xmin, 20,
+               &c->t1, 0.0f, 1.0f, 100, 0, "Color differences below this threshold are keyed.");
+       uiDefButF(block, NUMSLI, B_NODE_EXEC+node->nr, "Falloff: ", 
+               butr->xmin, butr->ymin, butr->xmax-butr->xmin, 20,
+               &c->t2, 0.0f, 1.0f, 100, 0, "Color differences below this additional threshold are partially keyed.");
+       uiBlockEndAlign(block);
 }
 
-static int node_composit_buts_color_spill(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr)
+static void node_composit_buts_distance_matte(uiLayout *layout, PointerRNA *ptr)
 {
-       if(block) {
-               short dx= (butr->xmax-butr->xmin)/3;
+       uiBlock *block= uiLayoutFreeBlock(layout);
+       bNode *node= ptr->data;
+       rctf *butr= &node->butr;
+       NodeChroma *c= node->storage;
+       
+       uiBlockBeginAlign(block);
+       uiDefButF(block, NUMSLI, B_NODE_EXEC+node->nr, "Tolerance: ", 
+               butr->xmin, butr->ymin+20, butr->xmax-butr->xmin, 20,
+               &c->t1, 0.0f, 1.0f, 100, 0, "Color distances below this threshold are keyed.");
+       uiDefButF(block, NUMSLI, B_NODE_EXEC+node->nr, "Falloff: ", 
+               butr->xmin, butr->ymin, butr->xmax-butr->xmin, 20,
+               &c->t2, 0.0f, 1.0f, 100, 0, "Color distances below this additional threshold are partially keyed.");
+       uiBlockEndAlign(block);
+}
 
-               NodeChroma *c=node->storage;
-               uiBlockBeginAlign(block);
-               uiDefButF(block, NUM, B_NODE_EXEC, "Enhance: ", 
-                               butr->xmin, butr->ymin+20.0, butr->xmax-butr->xmin, 20,
-                               &c->t1, 0.0f, 0.5f, 100, 2, "Adjusts how much selected channel is affected by color spill algorithm");
-               uiDefButS(block, ROW, B_NODE_EXEC, "R",
-                               butr->xmin,butr->ymin,dx,20,
-                               &node->custom1,1,1, 0, 0, "Red Spill Suppression");
-               uiDefButS(block, ROW, B_NODE_EXEC, "G",
-                               butr->xmin+dx,butr->ymin,dx,20,
-                               &node->custom1,1,2, 0, 0, "Green Spill Suppression");
-               uiDefButS(block, ROW, B_NODE_EXEC, "B",
-                               butr->xmin+2*dx,butr->ymin,dx,20,
-                               &node->custom1, 1, 3, 0, 0, "Blue Spill Suppression");
-               uiBlockEndAlign(block);
-       }
-       return 60;
+static void node_composit_buts_color_spill(uiLayout *layout, PointerRNA *ptr)
+{
+       uiBlock *block= uiLayoutFreeBlock(layout);
+       bNode *node= ptr->data;
+       rctf *butr= &node->butr;
+       short dx= (butr->xmax-butr->xmin)/3;
+
+       NodeChroma *c=node->storage;
+       uiBlockBeginAlign(block);
+       uiDefButF(block, NUM, B_NODE_EXEC, "Enhance: ", 
+                       butr->xmin, butr->ymin+20.0, butr->xmax-butr->xmin, 20,
+                       &c->t1, 0.0f, 0.5f, 100, 2, "Adjusts how much selected channel is affected by color spill algorithm");
+       uiDefButS(block, ROW, B_NODE_EXEC, "R",
+                       butr->xmin,butr->ymin,dx,20,
+                       &node->custom1,1,1, 0, 0, "Red Spill Suppression");
+       uiDefButS(block, ROW, B_NODE_EXEC, "G",
+                       butr->xmin+dx,butr->ymin,dx,20,
+                       &node->custom1,1,2, 0, 0, "Green Spill Suppression");
+       uiDefButS(block, ROW, B_NODE_EXEC, "B",
+                       butr->xmin+2*dx,butr->ymin,dx,20,
+                       &node->custom1, 1, 3, 0, 0, "Blue Spill Suppression");
+       uiBlockEndAlign(block);
 }
 
-static int node_composit_buts_chroma_matte(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr)
+static void node_composit_buts_chroma_matte(uiLayout *layout, PointerRNA *ptr)
 {
-       if(block) {
-               short dx=(butr->xmax-butr->xmin)/2;
-               NodeChroma *c= node->storage;
+       uiBlock *block= uiLayoutFreeBlock(layout);
+       bNode *node= ptr->data;
+       rctf *butr= &node->butr;
+       short dx=(butr->xmax-butr->xmin)/2;
+       NodeChroma *c= node->storage;
 
-               uiBlockBeginAlign(block);
+       uiBlockBeginAlign(block);
 
-               uiDefButF(block, NUMSLI, B_NODE_EXEC, "Acceptance ",
-                       butr->xmin, butr->ymin+60, butr->xmax-butr->xmin, 20,
-                       &c->t1, 1.0f, 80.0f, 100, 0, "Tolerance for colors to be considered a keying color");
-               uiDefButF(block, NUMSLI, B_NODE_EXEC, "Cutoff ",
-                       butr->xmin, butr->ymin+40, butr->xmax-butr->xmin, 20,
-                       &c->t2, 0.0f, 30.0f, 100, 0, "Colors below this will be considered as exact matches for keying color");
-
-               uiDefButF(block, NUMSLI, B_NODE_EXEC, "Lift ",
-                       butr->xmin, butr->ymin+20, dx, 20,
-                       &c->fsize, 0.0f, 1.0f, 100, 0, "Alpha Lift");
-               uiDefButF(block, NUMSLI, B_NODE_EXEC, "Gain ",
-                       butr->xmin+dx, butr->ymin+20, dx, 20,
-                       &c->fstrength, 0.0f, 1.0f, 100, 0, "Alpha Gain");
-
-               uiDefButF(block, NUMSLI, B_NODE_EXEC, "Shadow Adjust ",
-                       butr->xmin, butr->ymin, butr->xmax-butr->xmin, 20,
-                       &c->t3, 0.0f, 1.0f, 100, 0, "Adjusts the brightness of any shadows captured");
-               uiBlockEndAlign(block);
+       uiDefButF(block, NUMSLI, B_NODE_EXEC, "Acceptance ",
+               butr->xmin, butr->ymin+60, butr->xmax-butr->xmin, 20,
+               &c->t1, 1.0f, 80.0f, 100, 0, "Tolerance for colors to be considered a keying color");
+       uiDefButF(block, NUMSLI, B_NODE_EXEC, "Cutoff ",
+               butr->xmin, butr->ymin+40, butr->xmax-butr->xmin, 20,
+               &c->t2, 0.0f, 30.0f, 100, 0, "Colors below this will be considered as exact matches for keying color");
+
+       uiDefButF(block, NUMSLI, B_NODE_EXEC, "Lift ",
+               butr->xmin, butr->ymin+20, dx, 20,
+               &c->fsize, 0.0f, 1.0f, 100, 0, "Alpha Lift");
+       uiDefButF(block, NUMSLI, B_NODE_EXEC, "Gain ",
+               butr->xmin+dx, butr->ymin+20, dx, 20,
+               &c->fstrength, 0.0f, 1.0f, 100, 0, "Alpha Gain");
+
+       uiDefButF(block, NUMSLI, B_NODE_EXEC, "Shadow Adjust ",
+               butr->xmin, butr->ymin, butr->xmax-butr->xmin, 20,
+               &c->t3, 0.0f, 1.0f, 100, 0, "Adjusts the brightness of any shadows captured");
+       uiBlockEndAlign(block);
 
-               if(c->t2 > c->t1)
-                       c->t2=c->t1;
-       }
-       return 80;
+       if(c->t2 > c->t1)
+               c->t2=c->t1;
 }
 
-static int node_composit_buts_color_matte(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr)
+static void node_composit_buts_color_matte(uiLayout *layout, PointerRNA *ptr)
 {
-       if(block) {
-               NodeChroma *c= node->storage;
-               uiBlockBeginAlign(block);
+       uiBlock *block= uiLayoutFreeBlock(layout);
+       bNode *node= ptr->data;
+       rctf *butr= &node->butr;
+       NodeChroma *c= node->storage;
+       uiBlockBeginAlign(block);
 
-               uiDefButF(block, NUMSLI, B_NODE_EXEC+node->nr, "H: ",
-                       butr->xmin, butr->ymin+40, butr->xmax-butr->xmin, 20,
-                       &c->t1, 0.0f, 0.25f, 100, 0, "Hue tolerance for colors to be considered a keying color");
-               uiDefButF(block, NUMSLI, B_NODE_EXEC+node->nr, "S: ",
-                       butr->xmin, butr->ymin+20, butr->xmax-butr->xmin, 20,
-                       &c->t2, 0.0f, 1.0f, 100, 0, "Saturation Tolerance for the color");
-               uiDefButF(block, NUMSLI, B_NODE_EXEC+node->nr, "V: ",
-                       butr->xmin, butr->ymin, butr->xmax-butr->xmin, 20,
-                       &c->t3, 0.0f, 1.0f, 100, 0, "Value Tolerance for the color");
+       uiDefButF(block, NUMSLI, B_NODE_EXEC+node->nr, "H: ",
+               butr->xmin, butr->ymin+40, butr->xmax-butr->xmin, 20,
+               &c->t1, 0.0f, 0.25f, 100, 0, "Hue tolerance for colors to be considered a keying color");
+       uiDefButF(block, NUMSLI, B_NODE_EXEC+node->nr, "S: ",
+               butr->xmin, butr->ymin+20, butr->xmax-butr->xmin, 20,
+               &c->t2, 0.0f, 1.0f, 100, 0, "Saturation Tolerance for the color");
+       uiDefButF(block, NUMSLI, B_NODE_EXEC+node->nr, "V: ",
+               butr->xmin, butr->ymin, butr->xmax-butr->xmin, 20,
+               &c->t3, 0.0f, 1.0f, 100, 0, "Value Tolerance for the color");
 
-               uiBlockEndAlign(block);
-       }
-       return 60;
+       uiBlockEndAlign(block);
 }
 
-
-static int node_composit_buts_channel_matte(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr)
+static void node_composit_buts_channel_matte(uiLayout *layout, PointerRNA *ptr)
 {
-       if(block) {
-               short sx= (butr->xmax-butr->xmin)/4;
-               short cx= (butr->xmax-butr->xmin)/3;
-               NodeChroma *c=node->storage;
-               char *c1, *c2, *c3;
-       
-               /*color space selectors*/
-               uiBlockBeginAlign(block);
-               uiDefButS(block, ROW,B_NODE_EXEC,"RGB",
-                       butr->xmin,butr->ymin+60,sx,20,&node->custom1,1,1, 0, 0, "RGB Color Space");
-               uiDefButS(block, ROW,B_NODE_EXEC,"HSV",
-                       butr->xmin+sx,butr->ymin+60,sx,20,&node->custom1,1,2, 0, 0, "HSV Color Space");
-               uiDefButS(block, ROW,B_NODE_EXEC,"YUV",
-                       butr->xmin+2*sx,butr->ymin+60,sx,20,&node->custom1,1,3, 0, 0, "YUV Color Space");
-               uiDefButS(block, ROW,B_NODE_EXEC,"YCC",
-                       butr->xmin+3*sx,butr->ymin+60,sx,20,&node->custom1,1,4, 0, 0, "YCbCr Color Space");
-       
-               if (node->custom1==1) {
-                       c1="R"; c2="G"; c3="B";
-               }
-               else if(node->custom1==2){
-                       c1="H"; c2="S"; c3="V";
-               }
-               else if(node->custom1==3){
-                       c1="Y"; c2="U"; c3="V";
-               }
-               else { // if(node->custom1==4){
-                       c1="Y"; c2="Cb"; c3="Cr";
-               }
-       
-               /*channel selector */
-               uiDefButS(block, ROW, B_NODE_EXEC, c1,
-                       butr->xmin,butr->ymin+40,cx,20,&node->custom2,1, 1, 0, 0, "Channel 1");
-               uiDefButS(block, ROW, B_NODE_EXEC, c2,
-                       butr->xmin+cx,butr->ymin+40,cx,20,&node->custom2,1, 2, 0, 0, "Channel 2");
-               uiDefButS(block, ROW, B_NODE_EXEC, c3,
-                       butr->xmin+cx+cx,butr->ymin+40,cx,20,&node->custom2, 1, 3, 0, 0, "Channel 3");
-       
-               /*tolerance sliders */
-               uiDefButF(block, NUMSLI, B_NODE_EXEC, "High ", 
-                       butr->xmin, butr->ymin+20.0, butr->xmax-butr->xmin, 20,
-                       &c->t1, 0.0f, 1.0f, 100, 0, "Values higher than this setting are 100% opaque");
-               uiDefButF(block, NUMSLI, B_NODE_EXEC, "Low ", 
-                       butr->xmin, butr->ymin, butr->xmax-butr->xmin, 20,
-                       &c->t2, 0.0f, 1.0f, 100, 0, "Values lower than this setting are 100% keyed");
-               uiBlockEndAlign(block);
-       
-               /*keep t2 (low) less than t1 (high) */
-               if(c->t2 > c->t1) {
-                       c->t2=c->t1;
-               }
+       uiBlock *block= uiLayoutFreeBlock(layout);
+       bNode *node= ptr->data;
+       rctf *butr= &node->butr;
+       short sx= (butr->xmax-butr->xmin)/4;
+       short cx= (butr->xmax-butr->xmin)/3;
+       NodeChroma *c=node->storage;
+       char *c1, *c2, *c3;
+
+       /*color space selectors*/
+       uiBlockBeginAlign(block);
+       uiDefButS(block, ROW,B_NODE_EXEC,"RGB",
+               butr->xmin,butr->ymin+60,sx,20,&node->custom1,1,1, 0, 0, "RGB Color Space");
+       uiDefButS(block, ROW,B_NODE_EXEC,"HSV",
+               butr->xmin+sx,butr->ymin+60,sx,20,&node->custom1,1,2, 0, 0, "HSV Color Space");
+       uiDefButS(block, ROW,B_NODE_EXEC,"YUV",
+               butr->xmin+2*sx,butr->ymin+60,sx,20,&node->custom1,1,3, 0, 0, "YUV Color Space");
+       uiDefButS(block, ROW,B_NODE_EXEC,"YCC",
+               butr->xmin+3*sx,butr->ymin+60,sx,20,&node->custom1,1,4, 0, 0, "YCbCr Color Space");
+
+       if (node->custom1==1) {
+               c1="R"; c2="G"; c3="B";
+       }
+       else if(node->custom1==2){
+               c1="H"; c2="S"; c3="V";
+       }
+       else if(node->custom1==3){
+               c1="Y"; c2="U"; c3="V";
+       }
+       else { // if(node->custom1==4){
+               c1="Y"; c2="Cb"; c3="Cr";
+       }
+
+       /*channel selector */
+       uiDefButS(block, ROW, B_NODE_EXEC, c1,
+               butr->xmin,butr->ymin+40,cx,20,&node->custom2,1, 1, 0, 0, "Channel 1");
+       uiDefButS(block, ROW, B_NODE_EXEC, c2,
+               butr->xmin+cx,butr->ymin+40,cx,20,&node->custom2,1, 2, 0, 0, "Channel 2");
+       uiDefButS(block, ROW, B_NODE_EXEC, c3,
+               butr->xmin+cx+cx,butr->ymin+40,cx,20,&node->custom2, 1, 3, 0, 0, "Channel 3");
+
+       /*tolerance sliders */
+       uiDefButF(block, NUMSLI, B_NODE_EXEC, "High ", 
+               butr->xmin, butr->ymin+20.0, butr->xmax-butr->xmin, 20,
+               &c->t1, 0.0f, 1.0f, 100, 0, "Values higher than this setting are 100% opaque");
+       uiDefButF(block, NUMSLI, B_NODE_EXEC, "Low ", 
+               butr->xmin, butr->ymin, butr->xmax-butr->xmin, 20,
+               &c->t2, 0.0f, 1.0f, 100, 0, "Values lower than this setting are 100% keyed");
+       uiBlockEndAlign(block);
+
+       /*keep t2 (low) less than t1 (high) */
+       if(c->t2 > c->t1) {
+               c->t2=c->t1;
        }
-       return 80;
 }
 
-static int node_composit_buts_luma_matte(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr)
+static void node_composit_buts_luma_matte(uiLayout *layout, PointerRNA *ptr)
 {
-       if(block) {
-               NodeChroma *c=node->storage;
-       
-               /*tolerance sliders */
-               uiDefButF(block, NUMSLI, B_NODE_EXEC, "High ", 
-                       butr->xmin, butr->ymin+20.0, butr->xmax-butr->xmin, 20,
-                       &c->t1, 0.0f, 1.0f, 100, 0, "Values higher than this setting are 100% opaque");
-               uiDefButF(block, NUMSLI, B_NODE_EXEC, "Low ", 
-                       butr->xmin, butr->ymin, butr->xmax-butr->xmin, 20,
-                       &c->t2, 0.0f, 1.0f, 100, 0, "Values lower than this setting are 100% keyed");
-               uiBlockEndAlign(block);
-       
-               /*keep t2 (low) less than t1 (high) */
-               if(c->t2 > c->t1) {
-                       c->t2=c->t1;
-               }
+       uiBlock *block= uiLayoutFreeBlock(layout);
+       bNode *node= ptr->data;
+       rctf *butr= &node->butr;
+       NodeChroma *c=node->storage;
+
+       /*tolerance sliders */
+       uiDefButF(block, NUMSLI, B_NODE_EXEC, "High ", 
+               butr->xmin, butr->ymin+20.0, butr->xmax-butr->xmin, 20,
+               &c->t1, 0.0f, 1.0f, 100, 0, "Values higher than this setting are 100% opaque");
+       uiDefButF(block, NUMSLI, B_NODE_EXEC, "Low ", 
+               butr->xmin, butr->ymin, butr->xmax-butr->xmin, 20,
+               &c->t2, 0.0f, 1.0f, 100, 0, "Values lower than this setting are 100% keyed");
+       uiBlockEndAlign(block);
+
+       /*keep t2 (low) less than t1 (high) */
+       if(c->t2 > c->t1) {
+               c->t2=c->t1;
        }
-       return 40;
 }
 
-static int node_composit_buts_map_uv(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr)
+static void node_composit_buts_map_uv(uiLayout *layout, PointerRNA *ptr)
 {
-       if(block) {
-               uiDefButS(block, NUM, B_NODE_EXEC, "Alpha:",
-                                 butr->xmin, butr->ymin, butr->xmax-butr->xmin, 20, 
-                                 &node->custom1, 0, 100, 0, 0, "Conversion percentage of UV differences to Alpha");
-       }
-       return 20;
+       uiBlock *block= uiLayoutFreeBlock(layout);
+       bNode *node= ptr->data;
+       rctf *butr= &node->butr;
+
+       uiDefButS(block, NUM, B_NODE_EXEC, "Alpha:",
+                         butr->xmin, butr->ymin, butr->xmax-butr->xmin, 20, 
+                         &node->custom1, 0, 100, 0, 0, "Conversion percentage of UV differences to Alpha");
 }
 
-static int node_composit_buts_id_mask(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr)
+static void node_composit_buts_id_mask(uiLayout *layout, PointerRNA *ptr)
 {
-       if(block) {
-               uiDefButS(block, NUM, B_NODE_EXEC, "ID:",
-                                 butr->xmin, butr->ymin, butr->xmax-butr->xmin, 20, 
-                                 &node->custom1, 0, 10000, 0, 0, "Pass Index number to convert to Alpha");
-       }
-       return 20;
+       uiBlock *block= uiLayoutFreeBlock(layout);
+       bNode *node= ptr->data;
+       rctf *butr= &node->butr;
+
+       uiDefButS(block, NUM, B_NODE_EXEC, "ID:",
+                         butr->xmin, butr->ymin, butr->xmax-butr->xmin, 20, 
+                         &node->custom1, 0, 10000, 0, 0, "Pass Index number to convert to Alpha");
 }
 
 /* allocate sufficient! */
@@ -1880,58 +1844,58 @@ static void node_set_image_cb(bContext *C, void *ntree_v, void *node_v)
        nodeSetActive(ntree, node);
 }
 
-static int node_composit_buts_file_output(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr)
+static void node_composit_buts_file_output(uiLayout *layout, PointerRNA *ptr)
 {
-       if(block) {
-               NodeImageFile *nif= node->storage;
-               uiBut *bt;
-               short x= (short)butr->xmin;
-               short y= (short)butr->ymin;
-               short w= (short)butr->xmax-butr->xmin;
-               char str[320];
-               
-               node_imagetype_string(str);
-               
-               uiBlockBeginAlign(block);
-               
-               bt = uiDefIconBut(block, BUT, B_NODE_SETIMAGE, ICON_FILESEL,
-                                 x, y+60, 20, 20,
-                                 0, 0, 0, 0, 0, "Open Fileselect to get Backbuf image");
-               uiButSetFunc(bt, node_set_image_cb, ntree, node);
-               
-               uiDefBut(block, TEX, B_NOP, "",
-                                 20+x, y+60, w-20, 20, 
-                                 nif->name, 0.0f, 240.0f, 0, 0, "");
-               
-               uiDefButS(block, MENU, B_NOP, str,
-                                 x, y+40, w, 20, 
-                                 &nif->imtype, 0.0f, 1.0f, 0, 0, "");
-               
-               if(nif->imtype==R_OPENEXR) {
-                       uiDefButBitS(block, TOG, R_OPENEXR_HALF, B_REDR, "Half",        
-                                               x, y+20, w/2, 20, 
-                                               &nif->subimtype, 0, 0, 0, 0, "");
-
-                       uiDefButS(block, MENU,B_NOP, "Codec %t|None %x0|Pxr24 (lossy) %x1|ZIP (lossless) %x2|PIZ (lossless) %x3|RLE (lossless) %x4",  
-                                               x+w/2, y+20, w/2, 20, 
-                                               &nif->codec, 0, 0, 0, 0, "");
-               }
-               else {
-                       uiDefButS(block, NUM, B_NOP, "Quality: ",
-                                 x, y+20, w, 20, 
-                                 &nif->quality, 10.0f, 100.0f, 10, 0, "");
-               }
-               
-               /* start frame, end frame */
-               uiDefButI(block, NUM, B_NODE_EXEC, "SFra: ", 
-                                 x, y, w/2, 20, 
-                                 &nif->sfra, 1, MAXFRAMEF, 10, 0, "");
-               uiDefButI(block, NUM, B_NODE_EXEC, "EFra: ", 
-                                 x+w/2, y, w/2, 20, 
-                                 &nif->efra, 1, MAXFRAMEF, 10, 0, "");
-               
+       uiBlock *block= uiLayoutFreeBlock(layout);
+       bNode *node= ptr->data;
+       bNodeTree *ntree= ptr->id.data;
+       rctf *butr= &node->butr;
+       NodeImageFile *nif= node->storage;
+       uiBut *bt;
+       short x= (short)butr->xmin;
+       short y= (short)butr->ymin;
+       short w= (short)butr->xmax-butr->xmin;
+       char str[320];
+       
+       node_imagetype_string(str);
+       
+       uiBlockBeginAlign(block);
+       
+       bt = uiDefIconBut(block, BUT, B_NODE_SETIMAGE, ICON_FILESEL,
+                         x, y+60, 20, 20,
+                         0, 0, 0, 0, 0, "Open Fileselect to get Backbuf image");
+       uiButSetFunc(bt, node_set_image_cb, ntree, node);
+       
+       uiDefBut(block, TEX, B_NOP, "",
+                         20+x, y+60, w-20, 20, 
+                         nif->name, 0.0f, 240.0f, 0, 0, "");
+       
+       uiDefButS(block, MENU, B_NOP, str,
+                         x, y+40, w, 20, 
+                         &nif->imtype, 0.0f, 1.0f, 0, 0, "");
+       
+       if(nif->imtype==R_OPENEXR) {
+               uiDefButBitS(block, TOG, R_OPENEXR_HALF, B_REDR, "Half",        
+                                       x, y+20, w/2, 20, 
+                                       &nif->subimtype, 0, 0, 0, 0, "");
+
+               uiDefButS(block, MENU,B_NOP, "Codec %t|None %x0|Pxr24 (lossy) %x1|ZIP (lossless) %x2|PIZ (lossless) %x3|RLE (lossless) %x4",  
+                                       x+w/2, y+20, w/2, 20, 
+                                       &nif->codec, 0, 0, 0, 0, "");
+       }
+       else {
+               uiDefButS(block, NUM, B_NOP, "Quality: ",
+                         x, y+20, w, 20, 
+                         &nif->quality, 10.0f, 100.0f, 10, 0, "");
        }
-       return 80;
+       
+       /* start frame, end frame */
+       uiDefButI(block, NUM, B_NODE_EXEC, "SFra: ", 
+                         x, y, w/2, 20, 
+                         &nif->sfra, 1, MAXFRAMEF, 10, 0, "");
+       uiDefButI(block, NUM, B_NODE_EXEC, "EFra: ", 
+                         x+w/2, y, w/2, 20, 
+                         &nif->efra, 1, MAXFRAMEF, 10, 0, "");
 }
 
 static void node_scale_cb(bContext *C, void *node_v, void *unused_v)
@@ -1952,65 +1916,66 @@ static void node_scale_cb(bContext *C, void *node_v, void *unused_v)
        }       
 }
 
-static int node_composit_buts_scale(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr)
+static void node_composit_buts_scale(uiLayout *layout, PointerRNA *ptr)
 {
-       if(block) {
-               uiBut *bt= uiDefButS(block, MENU, B_NODE_EXEC, "Relative %x0|Absolute %x1|Scene Size % %x2|",
-                                 butr->xmin, butr->ymin, butr->xmax-butr->xmin, 20, 
-                                 &node->custom1, 0, 0, 0, 0, "Scale new image to absolute pixel size, size relative to the incoming image, or using the 'percent' size of the scene");
-               uiButSetFunc(bt, node_scale_cb, node, NULL);
-       }
-       return 20;
+       uiBlock *block= uiLayoutFreeBlock(layout);
+       bNode *node= ptr->data;
+       rctf *butr= &node->butr;
+       uiBut *bt= uiDefButS(block, MENU, B_NODE_EXEC, "Relative %x0|Absolute %x1|Scene Size % %x2|",
+                         butr->xmin, butr->ymin, butr->xmax-butr->xmin, 20, 
+                         &node->custom1, 0, 0, 0, 0, "Scale new image to absolute pixel size, size relative to the incoming image, or using the 'percent' size of the scene");
+       uiButSetFunc(bt, node_scale_cb, node, NULL);
 }
 
-static int node_composit_buts_invert(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr) 
+static void node_composit_buts_invert(uiLayout *layout, PointerRNA *ptr)
 {
-       if(block) {
-               uiBlockBeginAlign(block);
-               uiDefButBitS(block, TOG, CMP_CHAN_RGB, B_NODE_EXEC, "RGB",
-                                        butr->xmin, butr->ymin, (butr->xmax-butr->xmin)/2, 20, 
-                                        &node->custom1, 0, 0, 0, 0, "");
-               uiDefButBitS(block, TOG, CMP_CHAN_A, B_NODE_EXEC, "A",
-                                        butr->xmin+(butr->xmax-butr->xmin)/2, butr->ymin, (butr->xmax-butr->xmin)/2, 20, 
-                                        &node->custom1, 0, 0, 0, 0, "");
-               uiBlockEndAlign(block);
-       }
-       return 20;      
+       uiBlock *block= uiLayoutFreeBlock(layout);
+       bNode *node= ptr->data;
+       rctf *butr= &node->butr;
+
+       uiBlockBeginAlign(block);
+       uiDefButBitS(block, TOG, CMP_CHAN_RGB, B_NODE_EXEC, "RGB",
+                                butr->xmin, butr->ymin, (butr->xmax-butr->xmin)/2, 20, 
+                                &node->custom1, 0, 0, 0, 0, "");
+       uiDefButBitS(block, TOG, CMP_CHAN_A, B_NODE_EXEC, "A",
+                                butr->xmin+(butr->xmax-butr->xmin)/2, butr->ymin, (butr->xmax-butr->xmin)/2, 20, 
+                                &node->custom1, 0, 0, 0, 0, "");
+       uiBlockEndAlign(block);
 }
 
-static int node_composit_buts_premulkey(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr)
+static void node_composit_buts_premulkey(uiLayout *layout, PointerRNA *ptr)
 {
-       if(block) {
-               uiBut *bt;
-               
-               /* blend type */
-               bt=uiDefButS(block, MENU, B_NODE_EXEC, "Key to Premul %x0|Premul to Key %x1",
-                                        butr->xmin, butr->ymin, butr->xmax-butr->xmin, 20, 
-                                        &node->custom1, 0, 0, 0, 0, "Conversion between premultiplied alpha and key alpha");
-       }
-       return 20;
+       uiBlock *block= uiLayoutFreeBlock(layout);
+       bNode *node= ptr->data;
+       rctf *butr= &node->butr;
+       uiBut *bt;
+       
+       /* blend type */
+       bt=uiDefButS(block, MENU, B_NODE_EXEC, "Key to Premul %x0|Premul to Key %x1",
+                                butr->xmin, butr->ymin, butr->xmax-butr->xmin, 20, 
+                                &node->custom1, 0, 0, 0, 0, "Conversion between premultiplied alpha and key alpha");
 }
 
-static int node_composit_buts_view_levels(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr)
+static void node_composit_buts_view_levels(uiLayout *layout, PointerRNA *ptr)
 {
-       if(block) {
-               short sx= (butr->xmax-butr->xmin)/5;
-       
-               /*color space selectors*/
-               uiBlockBeginAlign(block);
-               uiDefButS(block, ROW,B_NODE_EXEC+node->nr,"C",
-                       butr->xmin,butr->ymin,sx,20,&node->custom1,1,1, 0, 0, "Combined RGB");
-               uiDefButS(block, ROW,B_NODE_EXEC+node->nr,"R",
-                       butr->xmin+sx,butr->ymin,sx,20,&node->custom1,1,2, 0, 0, "Red Channel");
-               uiDefButS(block, ROW,B_NODE_EXEC+node->nr,"G",
-                       butr->xmin+2*sx,butr->ymin,sx,20,&node->custom1,1,3, 0, 0, "Green Channel");
-               uiDefButS(block, ROW,B_NODE_EXEC+node->nr,"B",
-                       butr->xmin+3*sx,butr->ymin,sx,20,&node->custom1,1,4, 0, 0, "Blue Channel");
-      uiDefButS(block, ROW,B_NODE_EXEC+node->nr,"L",
-                       butr->xmin+4*sx,butr->ymin,sx,20,&node->custom1,1,5, 0, 0, "Luminenc Channel");
-               uiBlockEndAlign(block);
-       }
-       return 20;
+       uiBlock *block= uiLayoutFreeBlock(layout);
+       bNode *node= ptr->data;
+       rctf *butr= &node->butr;
+       short sx= (butr->xmax-butr->xmin)/5;
+
+       /*color space selectors*/
+       uiBlockBeginAlign(block);
+       uiDefButS(block, ROW,B_NODE_EXEC+node->nr,"C",
+               butr->xmin,butr->ymin,sx,20,&node->custom1,1,1, 0, 0, "Combined RGB");
+       uiDefButS(block, ROW,B_NODE_EXEC+node->nr,"R",
+               butr->xmin+sx,butr->ymin,sx,20,&node->custom1,1,2, 0, 0, "Red Channel");
+       uiDefButS(block, ROW,B_NODE_EXEC+node->nr,"G",
+               butr->xmin+2*sx,butr->ymin,sx,20,&node->custom1,1,3, 0, 0, "Green Channel");
+       uiDefButS(block, ROW,B_NODE_EXEC+node->nr,"B",
+               butr->xmin+3*sx,butr->ymin,sx,20,&node->custom1,1,4, 0, 0, "Blue Channel");
+       uiDefButS(block, ROW,B_NODE_EXEC+node->nr,"L",
+               butr->xmin+4*sx,butr->ymin,sx,20,&node->custom1,1,5, 0, 0, "Luminenc Channel");
+       uiBlockEndAlign(block);
 }
 
 
@@ -2021,181 +1986,181 @@ static void node_composit_set_butfunc(bNodeType *ntype)
                /* case NODE_GROUP:      note, typeinfo for group is generated... see "XXX ugly hack" */
 
                case CMP_NODE_IMAGE:
-                       ntype->butfunc= node_composit_buts_image;
+                       ntype->uifunc= node_composit_buts_image;
                        break;
                case CMP_NODE_R_LAYERS:
-                       ntype->butfunc= node_composit_buts_renderlayers;
+                       ntype->uifunc= node_composit_buts_renderlayers;
                        break;
                case CMP_NODE_NORMAL:
-                       ntype->butfunc= node_buts_normal;
+                       ntype->uifunc= node_buts_normal;
                        break;
                case CMP_NODE_CURVE_VEC:
-                       ntype->butfunc= node_buts_curvevec;
+                       ntype->uifunc= node_buts_curvevec;
                        break;
                case CMP_NODE_CURVE_RGB:
-                       ntype->butfunc= node_buts_curvecol;
+                       ntype->uifunc= node_buts_curvecol;
                        break;
                case CMP_NODE_VALUE:
-                       ntype->butfunc= node_buts_value;
+                       ntype->uifunc= node_buts_value;
                        break;
                case CMP_NODE_RGB:
-                       ntype->butfunc= node_buts_rgb;
+                       ntype->uifunc= node_buts_rgb;
                        break;
                case CMP_NODE_FLIP:
-                       ntype->butfunc= node_composit_buts_flip;
+                       ntype->uifunc= node_composit_buts_flip;
                        break;
                case CMP_NODE_SPLITVIEWER:
-                       ntype->butfunc= node_composit_buts_splitviewer;
+                       ntype->uifunc= node_composit_buts_splitviewer;
                        break;
                case CMP_NODE_MIX_RGB:
-                       ntype->butfunc= node_buts_mix_rgb;
+                       ntype->uifunc= node_buts_mix_rgb;
                        break;
                case CMP_NODE_VALTORGB:
-                       ntype->butfunc= node_buts_valtorgb;
+                       ntype->uifunc= node_buts_valtorgb;
                        break;
                case CMP_NODE_CROP:
-                       ntype->butfunc= node_composit_buts_crop;
+                       ntype->uifunc= node_composit_buts_crop;
                        break;
                case CMP_NODE_BLUR:
-                       ntype->butfunc= node_composit_buts_blur;
+                       ntype->uifunc= node_composit_buts_blur;
                        break;
                case CMP_NODE_DBLUR:
-                       ntype->butfunc= node_composit_buts_dblur;
+                       ntype->uifunc= node_composit_buts_dblur;
                        break;
                case CMP_NODE_BILATERALBLUR:
-                       ntype->butfunc= node_composit_buts_bilateralblur;
+                       ntype->uifunc= node_composit_buts_bilateralblur;
                        break;
                /* qdn: defocus node */
                case CMP_NODE_DEFOCUS:
-                       ntype->butfunc = node_composit_buts_defocus;
+                       ntype->uifunc = node_composit_buts_defocus;
                        break;
                /* qdn: glare node */
                case CMP_NODE_GLARE:
-                       ntype->butfunc = node_composit_buts_glare;
+                       ntype->uifunc = node_composit_buts_glare;
                        break;
                /* qdn: tonemap node */
                case CMP_NODE_TONEMAP:
-                       ntype->butfunc = node_composit_buts_tonemap;
+                       ntype->uifunc = node_composit_buts_tonemap;
                        break;
                /* qdn: lens distortion node */
                case CMP_NODE_LENSDIST:
-                       ntype->butfunc = node_composit_buts_lensdist;
+                       ntype->uifunc = node_composit_buts_lensdist;
                        break;
                case CMP_NODE_VECBLUR:
-                       ntype->butfunc= node_composit_buts_vecblur;
+                       ntype->uifunc= node_composit_buts_vecblur;
                        break;
                case CMP_NODE_FILTER:
-                       ntype->butfunc= node_composit_buts_filter;
+                       ntype->uifunc= node_composit_buts_filter;
                        break;
                case CMP_NODE_MAP_VALUE:
-                       ntype->butfunc= node_composit_buts_map_value;
+                       ntype->uifunc= node_composit_buts_map_value;
                        break;
                case CMP_NODE_TIME:
-                       ntype->butfunc= node_buts_time;
+                       ntype->uifunc= node_buts_time;
                        break;
                case CMP_NODE_ALPHAOVER:
-                       ntype->butfunc= node_composit_buts_alphaover;
+                       ntype->uifunc= node_composit_buts_alphaover;
                        break;
                case CMP_NODE_HUE_SAT:
-                       ntype->butfunc= node_composit_buts_hue_sat;
+                       ntype->uifunc= node_composit_buts_hue_sat;
                        break;
                case CMP_NODE_TEXTURE:
-                       ntype->butfunc= node_buts_texture;
+                       ntype->uifunc= node_buts_texture;
                        break;
                case CMP_NODE_DILATEERODE:
-                       ntype->butfunc= node_composit_buts_dilateerode;
+                       ntype->uifunc= node_composit_buts_dilateerode;
                        break;
                case CMP_NODE_OUTPUT_FILE:
-                       ntype->butfunc= node_composit_buts_file_output;
+                       ntype->uifunc= node_composit_buts_file_output;
                        break;  
                case CMP_NODE_DIFF_MATTE:
-                       ntype->butfunc=node_composit_buts_diff_matte;
+                       ntype->uifunc=node_composit_buts_diff_matte;
                        break;
                case CMP_NODE_DIST_MATTE:
-                       ntype->butfunc=node_composit_buts_distance_matte;
+                       ntype->uifunc=node_composit_buts_distance_matte;
                        break;
                case CMP_NODE_COLOR_SPILL:
-                       ntype->butfunc=node_composit_buts_color_spill;
+                       ntype->uifunc=node_composit_buts_color_spill;
                        break;
                case CMP_NODE_CHROMA_MATTE:
-                       ntype->butfunc=node_composit_buts_chroma_matte;
+                       ntype->uifunc=node_composit_buts_chroma_matte;
                        break;
                case CMP_NODE_COLOR_MATTE:
-                       ntype->butfunc=node_composit_buts_color_matte;
+                       ntype->uifunc=node_composit_buts_color_matte;
                        break;
                case CMP_NODE_SCALE:
-                       ntype->butfunc= node_composit_buts_scale;
+                       ntype->uifunc= node_composit_buts_scale;
                        break;
                case CMP_NODE_CHANNEL_MATTE:
-                       ntype->butfunc= node_composit_buts_channel_matte;
+                       ntype->uifunc= node_composit_buts_channel_matte;
                        break;
                case CMP_NODE_LUMA_MATTE:
-                       ntype->butfunc= node_composit_buts_luma_matte;
+                       ntype->uifunc= node_composit_buts_luma_matte;
                        break;
                case CMP_NODE_MAP_UV:
-                       ntype->butfunc= node_composit_buts_map_uv;
+                       ntype->uifunc= node_composit_buts_map_uv;
                        break;
                case CMP_NODE_ID_MASK:
-                       ntype->butfunc= node_composit_buts_id_mask;
+                       ntype->uifunc= node_composit_buts_id_mask;
                        break;
                case CMP_NODE_MATH:
-                       ntype->butfunc= node_buts_math;
+                       ntype->uifunc= node_buts_math;
                        break;
                case CMP_NODE_INVERT:
-                       ntype->butfunc= node_composit_buts_invert;
+                       ntype->uifunc= node_composit_buts_invert;
                        break;
                case CMP_NODE_PREMULKEY:
-                       ntype->butfunc= node_composit_buts_premulkey;
+                       ntype->uifunc= node_composit_buts_premulkey;
                        break;
       case CMP_NODE_VIEW_LEVELS:
-                       ntype->butfunc=node_composit_buts_view_levels;
+                       ntype->uifunc=node_composit_buts_view_levels;
                        break;
                default:
-                       ntype->butfunc= NULL;
+                       ntype->uifunc= NULL;
        }
 }
 
 /* ****************** BUTTON CALLBACKS FOR TEXTURE NODES ***************** */
 
-static int node_texture_buts_bricks(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr)
+static void node_texture_buts_bricks(uiLayout *layout, PointerRNA *ptr)
 {
-       if(block) {
-               short w = butr->xmax-butr->xmin;
-               short ofw = 32;
-               
-               uiBlockBeginAlign(block);
-               
-               /* Offset */
-               uiDefButF(
-                       block, NUM, B_NODE_EXEC, "Offset",
-                       butr->xmin, butr->ymin+20, w-ofw, 20,
-                       &node->custom3,
-                       0, 1, 0.25, 2,
-                       "Offset amount" );
-               uiDefButS(
-                       block, NUM, B_NODE_EXEC, "",
-                       butr->xmin+w-ofw, butr->ymin+20, ofw, 20,
-                       &node->custom1,
-                       2, 99, 0, 0,
-                       "Offset every N rows" );
-               
-               /* Squash */
-               uiDefButF(
-                       block, NUM, B_NODE_EXEC, "Squash",
-                       butr->xmin, butr->ymin+0, w-ofw, 20,
-                       &node->custom4,
-                       0, 99, 0.25, 2,
-                       "Stretch amount" );
-               uiDefButS(
-                       block, NUM, B_NODE_EXEC, "",
-                       butr->xmin+w-ofw, butr->ymin+0, ofw, 20,
-                       &node->custom2,
-                       2, 99, 0, 0,
-                       "Stretch every N rows" );
-               
-               uiBlockEndAlign(block);
-       }
-       return 40;
+       uiBlock *block= uiLayoutFreeBlock(layout);
+       bNode *node= ptr->data;
+       rctf *butr= &node->butr;
+       short w = butr->xmax-butr->xmin;
+       short ofw = 32;
+       
+       uiBlockBeginAlign(block);
+       
+       /* Offset */
+       uiDefButF(
+               block, NUM, B_NODE_EXEC, "Offset",
+               butr->xmin, butr->ymin+20, w-ofw, 20,
+               &node->custom3,
+               0, 1, 0.25, 2,
+               "Offset amount" );
+       uiDefButS(
+               block, NUM, B_NODE_EXEC, "",
+               butr->xmin+w-ofw, butr->ymin+20, ofw, 20,
+               &node->custom1,
+               2, 99, 0, 0,
+               "Offset every N rows" );
+       
+       /* Squash */
+       uiDefButF(
+               block, NUM, B_NODE_EXEC, "Squash",
+               butr->xmin, butr->ymin+0, w-ofw, 20,
+               &node->custom4,
+               0, 99, 0.25, 2,
+               "Stretch amount" );
+       uiDefButS(
+               block, NUM, B_NODE_EXEC, "",
+               butr->xmin+w-ofw, butr->ymin+0, ofw, 20,
+               &node->custom2,
+               2, 99, 0, 0,
+               "Stretch every N rows" );
+       
+       uiBlockEndAlign(block);
 }
 
 /* Copied from buttons_shading.c -- needs unifying */
@@ -2206,208 +2171,196 @@ static char* noisebasis_menu()
        return nbmenu;
 }
 
-static int node_texture_buts_proc(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr)
+static void node_texture_buts_proc(uiLayout *layout, PointerRNA *ptr)
 {
+       uiBlock *block= uiLayoutFreeBlock(layout);
+       bNode *node= ptr->data;
+       rctf *butr= &node->butr;
        Tex *tex = (Tex *)node->storage;
        short x,y,w,h;
        
-       if( block ) {
-               x = butr->xmin;
-               y = butr->ymin;
-               w = butr->xmax - x;
-               h = butr->ymax - y;
-       }
-       else
-               return 0;
+       x = butr->xmin;
+       y = butr->ymin;
+       w = butr->xmax - x;
+       h = butr->ymax - y;
        
        switch( tex->type ) {
                case TEX_BLEND:
-                       if( block ) {
-                               uiBlockBeginAlign( block );
-                               uiDefButS( block, MENU, B_NODE_EXEC,
-                                       "Linear %x0|Quad %x1|Ease %x2|Diag %x3|Sphere %x4|Halo %x5|Radial %x6",
-                                       x, y+20, w, 20, &tex->stype, 0, 1, 0, 0, "Blend Type" );
-                               uiDefButBitS(block, TOG, TEX_FLIPBLEND, B_NODE_EXEC, "Flip XY", x, y, w, 20,
-                                       &tex->flag, 0, 0, 0, 0, "Flips the direction of the progression 90 degrees");
-                               uiBlockEndAlign( block );
-                       }
-                       return 40;
-                       
+                       uiBlockBeginAlign( block );
+                       uiDefButS( block, MENU, B_NODE_EXEC,
+                               "Linear %x0|Quad %x1|Ease %x2|Diag %x3|Sphere %x4|Halo %x5|Radial %x6",
+                               x, y+20, w, 20, &tex->stype, 0, 1, 0, 0, "Blend Type" );
+                       uiDefButBitS(block, TOG, TEX_FLIPBLEND, B_NODE_EXEC, "Flip XY", x, y, w, 20,
+                               &tex->flag, 0, 0, 0, 0, "Flips the direction of the progression 90 degrees");
+                       uiBlockEndAlign( block );
+                       break;
                        
                case TEX_MARBLE:
-                       if( block ) {
-                               uiBlockBeginAlign(block);
+                       uiBlockBeginAlign(block);
+               
+                       uiDefButS(block, ROW, B_NODE_EXEC, "Soft",       0*w/3+x, 40+y, w/3, 18, &tex->stype, 2.0, (float)TEX_SOFT, 0, 0, "Uses soft marble"); 
+                       uiDefButS(block, ROW, B_NODE_EXEC, "Sharp",      1*w/3+x, 40+y, w/3, 18, &tex->stype, 2.0, (float)TEX_SHARP, 0, 0, "Uses more clearly defined marble"); 
+                       uiDefButS(block, ROW, B_NODE_EXEC, "Sharper",    2*w/3+x, 40+y, w/3, 18, &tex->stype, 2.0, (float)TEX_SHARPER, 0, 0, "Uses very clearly defined marble"); 
                        
-                               uiDefButS(block, ROW, B_NODE_EXEC, "Soft",       0*w/3+x, 40+y, w/3, 18, &tex->stype, 2.0, (float)TEX_SOFT, 0, 0, "Uses soft marble"); 
-                               uiDefButS(block, ROW, B_NODE_EXEC, "Sharp",      1*w/3+x, 40+y, w/3, 18, &tex->stype, 2.0, (float)TEX_SHARP, 0, 0, "Uses more clearly defined marble"); 
-                               uiDefButS(block, ROW, B_NODE_EXEC, "Sharper",    2*w/3+x, 40+y, w/3, 18, &tex->stype, 2.0, (float)TEX_SHARPER, 0, 0, "Uses very clearly defined marble"); 
-                               
-                               uiDefButS(block, ROW, B_NODE_EXEC, "Soft noise", 0*w/2+x, 20+y, w/2, 19, &tex->noisetype, 12.0, (float)TEX_NOISESOFT, 0, 0, "Generates soft noise");
-                               uiDefButS(block, ROW, B_NODE_EXEC, "Hard noise", 1*w/2+x, 20+y, w/2, 19, &tex->noisetype, 12.0, (float)TEX_NOISEPERL, 0, 0, "Generates hard noise");
-                               
-                               uiDefButS(block, ROW, B_NODE_EXEC, "Sin",        0*w/3+x,  0+y, w/3, 18, &tex->noisebasis2, 8.0, 0.0, 0, 0, "Uses a sine wave to produce bands."); 
-                               uiDefButS(block, ROW, B_NODE_EXEC, "Saw",        1*w/3+x,  0+y, w/3, 18, &tex->noisebasis2, 8.0, 1.0, 0, 0, "Uses a saw wave to produce bands"); 
-                               uiDefButS(block, ROW, B_NODE_EXEC, "Tri",        2*w/3+x,  0+y, w/3, 18, &tex->noisebasis2, 8.0, 2.0, 0, 0, "Uses a triangle wave to produce bands"); 
-            
-                               uiBlockEndAlign(block);
-                       }
-                       return 60;
+                       uiDefButS(block, ROW, B_NODE_EXEC, "Soft noise", 0*w/2+x, 20+y, w/2, 19, &tex->noisetype, 12.0, (float)TEX_NOISESOFT, 0, 0, "Generates soft noise");
+                       uiDefButS(block, ROW, B_NODE_EXEC, "Hard noise", 1*w/2+x, 20+y, w/2, 19, &tex->noisetype, 12.0, (float)TEX_NOISEPERL, 0, 0, "Generates hard noise");
+                       
+                       uiDefButS(block, ROW, B_NODE_EXEC, "Sin",        0*w/3+x,  0+y, w/3, 18, &tex->noisebasis2, 8.0, 0.0, 0, 0, "Uses a sine wave to produce bands."); 
+                       uiDefButS(block, ROW, B_NODE_EXEC, "Saw",        1*w/3+x,  0+y, w/3, 18, &tex->noisebasis2, 8.0, 1.0, 0, 0, "Uses a saw wave to produce bands"); 
+                       uiDefButS(block, ROW, B_NODE_EXEC, "Tri",        2*w/3+x,  0+y, w/3, 18, &tex->noisebasis2, 8.0, 2.0, 0, 0, "Uses a triangle wave to produce bands"); 
+               
+                       uiBlockEndAlign(block);
+                       break;
                        
                case TEX_WOOD:
-                       if( block ) {
-                               uiDefButS(block, MENU, B_TEXPRV, noisebasis_menu(), x, y+64, w, 18, &tex->noisebasis, 0,0,0,0, "Sets the noise basis used for turbulence");
-                               
-                               uiBlockBeginAlign(block);
-                               uiDefButS(block, ROW, B_TEXPRV,             "Bands",     x,  40+y, w/2, 18, &tex->stype, 2.0, (float)TEX_BANDNOISE, 0, 0, "Uses standard noise"); 
-                               uiDefButS(block, ROW, B_TEXPRV,             "Rings", w/2+x,  40+y, w/2, 18, &tex->stype, 2.0, (float)TEX_RINGNOISE, 0, 0, "Lets Noise return RGB value"); 
-                               
-                               uiDefButS(block, ROW, B_NODE_EXEC, "Sin", 0*w/3+x,  20+y, w/3, 18, &tex->noisebasis2, 8.0, (float)TEX_SIN, 0, 0, "Uses a sine wave to produce bands."); 
-                               uiDefButS(block, ROW, B_NODE_EXEC, "Saw", 1*w/3+x,  20+y, w/3, 18, &tex->noisebasis2, 8.0, (float)TEX_SAW, 0, 0, "Uses a saw wave to produce bands"); 
-                               uiDefButS(block, ROW, B_NODE_EXEC, "Tri", 2*w/3+x,  20+y, w/3, 18, &tex->noisebasis2, 8.0, (float)TEX_TRI, 0, 0, "Uses a triangle wave to produce bands");
-                               
-                               uiDefButS(block, ROW, B_NODE_EXEC, "Soft noise", 0*w/2+x, 0+y, w/2, 19, &tex->noisetype, 12.0, (float)TEX_NOISESOFT, 0, 0, "Generates soft noise");
-                               uiDefButS(block, ROW, B_NODE_EXEC, "Hard noise", 1*w/2+x, 0+y, w/2, 19, &tex->noisetype, 12.0, (float)TEX_NOISEPERL, 0, 0, "Generates hard noise");
-                               uiBlockEndAlign(block);
-                       }
-                       return 80; 
+                       uiDefButS(block, MENU, B_TEXPRV, noisebasis_menu(), x, y+64, w, 18, &tex->noisebasis, 0,0,0,0, "Sets the noise basis used for turbulence");
+                       
+                       uiBlockBeginAlign(block);
+                       uiDefButS(block, ROW, B_TEXPRV,             "Bands",     x,  40+y, w/2, 18, &tex->stype, 2.0, (float)TEX_BANDNOISE, 0, 0, "Uses standard noise"); 
+                       uiDefButS(block, ROW, B_TEXPRV,             "Rings", w/2+x,  40+y, w/2, 18, &tex->stype, 2.0, (float)TEX_RINGNOISE, 0, 0, "Lets Noise return RGB value"); 
+                       
+                       uiDefButS(block, ROW, B_NODE_EXEC, "Sin", 0*w/3+x,  20+y, w/3, 18, &tex->noisebasis2, 8.0, (float)TEX_SIN, 0, 0, "Uses a sine wave to produce bands."); 
+                       uiDefButS(block, ROW, B_NODE_EXEC, "Saw", 1*w/3+x,  20+y, w/3, 18, &tex->noisebasis2, 8.0, (float)TEX_SAW, 0, 0, "Uses a saw wave to produce bands"); 
+                       uiDefButS(block, ROW, B_NODE_EXEC, "Tri", 2*w/3+x,  20+y, w/3, 18, &tex->noisebasis2, 8.0, (float)TEX_TRI, 0, 0, "Uses a triangle wave to produce bands");
+                       
+                       uiDefButS(block, ROW, B_NODE_EXEC, "Soft noise", 0*w/2+x, 0+y, w/2, 19, &tex->noisetype, 12.0, (float)TEX_NOISESOFT, 0, 0, "Generates soft noise");
+                       uiDefButS(block, ROW, B_NODE_EXEC, "Hard noise", 1*w/2+x, 0+y, w/2, 19, &tex->noisetype, 12.0, (float)TEX_NOISEPERL, 0, 0, "Generates hard noise");
+                       uiBlockEndAlign(block);
+                       break;
                        
                case TEX_CLOUDS:
-                       if( block ) {
-                               uiDefButS(block, MENU, B_TEXPRV, noisebasis_menu(), x, y+60, w, 18, &tex->noisebasis, 0,0,0,0, "Sets the noise basis used for turbulence");
-                               
-                               uiBlockBeginAlign(block);
-                               uiDefButS(block, ROW, B_TEXPRV, "B/W",       x, y+38, w/2, 18, &tex->stype, 2.0, (float)TEX_DEFAULT, 0, 0, "Uses standard noise"); 
-                               uiDefButS(block, ROW, B_TEXPRV, "Color", w/2+x, y+38, w/2, 18, &tex->stype, 2.0, (float)TEX_COLOR, 0, 0, "Lets Noise return RGB value"); 
-                               uiDefButS(block, ROW, B_TEXPRV, "Soft",      x, y+20, w/2, 18, &tex->noisetype, 12.0, (float)TEX_NOISESOFT, 0, 0, "Generates soft noise");
-                               uiDefButS(block, ROW, B_TEXPRV, "Hard",  w/2+x, y+20, w/2, 18, &tex->noisetype, 12.0, (float)TEX_NOISEPERL, 0, 0, "Generates hard noise");
-                               uiBlockEndAlign(block);
-                               
-                               uiDefButS(block, NUM, B_TEXPRV, "Depth:", x, y, w, 18, &tex->noisedepth, 0.0, 6.0, 0, 0, "Sets the depth of the cloud calculation");
-                       }
-                       return 80;
+                       uiDefButS(block, MENU, B_TEXPRV, noisebasis_menu(), x, y+60, w, 18, &tex->noisebasis, 0,0,0,0, "Sets the noise basis used for turbulence");
+                       
+                       uiBlockBeginAlign(block);
+                       uiDefButS(block, ROW, B_TEXPRV, "B/W",       x, y+38, w/2, 18, &tex->stype, 2.0, (float)TEX_DEFAULT, 0, 0, "Uses standard noise"); 
+                       uiDefButS(block, ROW, B_TEXPRV, "Color", w/2+x, y+38, w/2, 18, &tex->stype, 2.0, (float)TEX_COLOR, 0, 0, "Lets Noise return RGB value"); 
+                       uiDefButS(block, ROW, B_TEXPRV, "Soft",      x, y+20, w/2, 18, &tex->noisetype, 12.0, (float)TEX_NOISESOFT, 0, 0, "Generates soft noise");
+                       uiDefButS(block, ROW, B_TEXPRV, "Hard",  w/2+x, y+20, w/2, 18, &tex->noisetype, 12.0, (float)TEX_NOISEPERL, 0, 0, "Generates hard noise");
+                       uiBlockEndAlign(block);
+                       
+                       uiDefButS(block, NUM, B_TEXPRV, "Depth:", x, y, w, 18, &tex->noisedepth, 0.0, 6.0, 0, 0, "Sets the depth of the cloud calculation");
+                       break;
                        
                case TEX_DISTNOISE:
-                       if( block ) {
-                               uiBlockBeginAlign(block);
-                               uiDefButS(block, MENU, B_TEXPRV, noisebasis_menu(), x, y+18, w, 18, &tex->noisebasis2, 0,0,0,0, "Sets the noise basis to distort");
-                               uiDefButS(block, MENU, B_TEXPRV, noisebasis_menu(), x, y,    w, 18, &tex->noisebasis,  0,0,0,0, "Sets the noise basis which does the distortion");
-                               uiBlockEndAlign(block);
-                       }
-                       return 36;
+                       uiBlockBeginAlign(block);
+                       uiDefButS(block, MENU, B_TEXPRV, noisebasis_menu(), x, y+18, w, 18, &tex->noisebasis2, 0,0,0,0, "Sets the noise basis to distort");
+                       uiDefButS(block, MENU, B_TEXPRV, noisebasis_menu(), x, y,    w, 18, &tex->noisebasis,  0,0,0,0, "Sets the noise basis which does the distortion");
+                       uiBlockEndAlign(block);
+                       break;
        }
-       return 0;
 }
 
-static int node_texture_buts_image(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr)
+static void node_texture_buts_image(uiLayout *layout, PointerRNA *ptr)
 {
+       uiBlock *block= uiLayoutFreeBlock(layout);
+       bNode *node= ptr->data;
+       bNodeTree *ntree= ptr->id.data;
+       rctf *butr= &node->butr;
        char *strp;
        uiBut *bt;
+
+       uiBlockBeginAlign(block);
        
-       if( block ) {
-               uiBlockBeginAlign(block);
-               
-               /* browse button */
-               IMAnames_to_pupstring(&strp, NULL, "LOAD NEW %x32767", &(G.main->image), NULL, NULL);
-               node->menunr= 0;
-               bt= uiDefButS(block, MENU, B_NOP, strp, 
-                                         butr->xmin, butr->ymin, 19, 19, 
-                                         &node->menunr, 0, 0, 0, 0, "Browses existing choices");
-               uiButSetFunc(bt, node_browse_image_cb, ntree, node);
-               if(strp) MEM_freeN(strp);
+       /* browse button */
+       IMAnames_to_pupstring(&strp, NULL, "LOAD NEW %x32767", &(G.main->image), NULL, NULL);
+       node->menunr= 0;
+       bt= uiDefButS(block, MENU, B_NOP, strp, 
+                                 butr->xmin, butr->ymin, 19, 19, 
+                                 &node->menunr, 0, 0, 0, 0, "Browses existing choices");
+       uiButSetFunc(bt, node_browse_image_cb, ntree, node);
+       if(strp) MEM_freeN(strp);
+       
+       /* Add New button */
+       if(node->id==NULL) {
+               bt= uiDefBut(block, BUT, B_NODE_LOADIMAGE, "Load New",
+                                        butr->xmin+19, butr->ymin, (short)(butr->xmax-butr->xmin-19.0f), 19, 
+                                        NULL, 0.0, 0.0, 0, 0, "Add new Image");
+               uiButSetFunc(bt, node_active_cb, ntree, node);
+       }
+       else {
+               /* name button */
+               short xmin= (short)butr->xmin, xmax= (short)butr->xmax;
+               short width= xmax - xmin - 19;
                
-               /* Add New button */
-               if(node->id==NULL) {
-                       bt= uiDefBut(block, BUT, B_NODE_LOADIMAGE, "Load New",
-                                                butr->xmin+19, butr->ymin, (short)(butr->xmax-butr->xmin-19.0f), 19, 
-                                                NULL, 0.0, 0.0, 0, 0, "Add new Image");
-                       uiButSetFunc(bt, node_active_cb, ntree, node);
-               }
-               else {
-                       /* name button */
-                       short xmin= (short)butr->xmin, xmax= (short)butr->xmax;
-                       short width= xmax - xmin - 19;
-                       
-                       bt= uiDefBut(block, TEX, B_NOP, "IM:",
-                                                xmin+19, butr->ymin, width, 19, 
-                                                node->id->name+2, 0.0, 19.0, 0, 0, "Image name");
-                       uiButSetFunc(bt, node_ID_title_cb, node, NULL);
-               }
+               bt= uiDefBut(block, TEX, B_NOP, "IM:",
+                                        xmin+19, butr->ymin, width, 19, 
+                                        node->id->name+2, 0.0, 19.0, 0, 0, "Image name");
+               uiButSetFunc(bt, node_ID_title_cb, node, NULL);
        }
-       return 20;
 }
 
-static int node_texture_buts_output(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr)
+static void node_texture_buts_output(uiLayout *layout, PointerRNA *ptr)
 {
-       if( block ) {
-               uiBut *bt;
-               short width;
-               char *name = ((TexNodeOutput*)node->storage)->name;
-               
-               uiBlockBeginAlign(block);
-               
-               width = (short)(butr->xmax - butr->xmin);
-               
-               bt = uiDefBut(
-                       block, TEX, B_NOP,
-                       "Name:",
-                       butr->xmin, butr->ymin,
-                       width, 19, 
-                       name, 0, 31,
-                       0, 0
-                       "Name this output"
-               );
-               
-               uiBlockEndAlign(block);
-       }
-       return 19;
+       uiBlock *block= uiLayoutFreeBlock(layout);
+       bNode *node= ptr->data;
+       rctf *butr= &node->butr;
+       uiBut *bt;
+       short width;
+       char *name = ((TexNodeOutput*)node->storage)->name;
+       
+       uiBlockBeginAlign(block);
+       
+       width = (short)(butr->xmax - butr->xmin);
+       
+       bt = uiDefBut(
+               block, TEX, B_NOP,
+               "Name:",
+               butr->xmin, butr->ymin,
+               width, 19
+               name, 0, 31,
+               0, 0, 
+               "Name this output"
+       );
+       
+       uiBlockEndAlign(block);
 }
 
 /* only once called */
 static void node_texture_set_butfunc(bNodeType *ntype)
 {
        if( ntype->type >= TEX_NODE_PROC && ntype->type < TEX_NODE_PROC_MAX ) {
-               ntype->butfunc = node_texture_buts_proc;
+               ntype->uifunc = node_texture_buts_proc;
        }
        else switch(ntype->type) {
                
                case TEX_NODE_MATH:
-                       ntype->butfunc = node_buts_math;
+                       ntype->uifunc = node_buts_math;
                        break;
                
                case TEX_NODE_MIX_RGB:
-                       ntype->butfunc = node_buts_mix_rgb;
+                       ntype->uifunc = node_buts_mix_rgb;
                        break;
                        
                case TEX_NODE_VALTORGB:
-                       ntype->butfunc = node_buts_valtorgb;
+                       ntype->uifunc = node_buts_valtorgb;
                        break;
                        
                case TEX_NODE_CURVE_RGB:
-                       ntype->butfunc= node_buts_curvecol;
+                       ntype->uifunc= node_buts_curvecol;
                        break;
                        
                case TEX_NODE_CURVE_TIME:
-                       ntype->butfunc = node_buts_time;
+                       ntype->uifunc = node_buts_time;
                        break;
                        
                case TEX_NODE_TEXTURE:
-                       ntype->butfunc = node_buts_texture;
+                       ntype->uifunc = node_buts_texture;
                        break;
                        
                case TEX_NODE_BRICKS:
-                       ntype->butfunc = node_texture_buts_bricks;
+                       ntype->uifunc = node_texture_buts_bricks;
                        break;
                        
                case TEX_NODE_IMAGE:
-                       ntype->butfunc = node_texture_buts_image;
+                       ntype->uifunc = node_texture_buts_image;
                        break;
                        
                case TEX_NODE_OUTPUT:
-                       ntype->butfunc = node_texture_buts_output;
+                       ntype->uifunc = node_texture_buts_output;
                        break;
                        
                default:
-                       ntype->butfunc= NULL;
+                       ntype->uifunc= NULL;
        }
 }
 
index a872413b4e113ae84fa74c78752f2a69e29be4d0..a87a141972b3fffe5be72cb6ade668a073cbed17 100644 (file)
@@ -81,6 +81,8 @@
 #include "UI_resources.h"
 #include "UI_view2d.h"
 
+#include "RNA_access.h"
+
 #include "CMP_node.h"
 #include "SHD_node.h"
 
@@ -91,6 +93,50 @@ extern void ui_dropshadow(rctf *rct, float radius, float aspect, int select);
 extern void gl_round_box(int mode, float minx, float miny, float maxx, float maxy, float rad);
 extern void ui_draw_tria_icon(float x, float y, float aspect, char dir);
 
+void ED_node_changed_update(bContext *C, bNode *node)
+{
+       SpaceNode *snode= CTX_wm_space_node(C);
+
+       if(!snode)
+               return;
+
+       if(snode->treetype==NTREE_SHADER) {
+               WM_event_add_notifier(C, NC_MATERIAL|ND_SHADING, snode->id);
+       }
+       else if(snode->treetype==NTREE_COMPOSIT) {
+               NodeTagChanged(snode->edittree, node);
+               /* don't use NodeTagIDChanged, it gives far too many recomposites for image, scene layers, ... */
+                       
+               /* not the best implementation of the world... but we need it to work now :) */
+               if(node->type==CMP_NODE_R_LAYERS && node->custom2) {
+                       /* add event for this window (after render curarea can be changed) */
+                       //addqueue(curarea->win, UI_BUT_EVENT, B_NODE_TREE_EXEC);
+                       
+                       //composite_node_render(snode, node);
+                       //snode_handle_recalc(snode);
+                       
+                       /* add another event, a render can go fullscreen and open new window */
+                       //addqueue(curarea->win, UI_BUT_EVENT, B_NODE_TREE_EXEC);
+               }
+               else {
+                       node= node_tree_get_editgroup(snode->nodetree);
+                       if(node)
+                               NodeTagIDChanged(snode->nodetree, node->id);
+               }
+               WM_event_add_notifier(C, NC_SCENE|ND_NODES, CTX_data_scene(C));
+       }                       
+       else if(snode->treetype==NTREE_TEXTURE) {
+               WM_event_add_notifier(C, NC_TEXTURE|ND_NODES, snode->id);
+       }
+
+}
+
+static void do_node_internal_buttons(bContext *C, void *node_v, int event)
+{
+       if(event==B_NODE_EXEC)
+               ED_node_changed_update(C, node_v);
+}
+
 
 static void node_scaling_widget(int color_id, float aspect, float xmin, float ymin, float xmax, float ymax)
 {
@@ -110,10 +156,14 @@ static void node_scaling_widget(int color_id, float aspect, float xmin, float ym
 }
 
 /* based on settings in node, sets drawing rect info. each redraw! */
-static void node_update(bNode *node)
+static void node_update(const bContext *C, bNodeTree *ntree, bNode *node)
 {
+       uiLayout *layout;
+       PointerRNA ptr;
        bNodeSocket *nsock;
        float dy= node->locy;
+       int buty;
+       char str[32];
        
        /* header */
        dy-= NODE_DY;
@@ -121,7 +171,7 @@ static void node_update(bNode *node)
        /* little bit space in top */
        if(node->outputs.first)
                dy-= NODE_DYS/2;
-       
+
        /* output sockets */
        for(nsock= node->outputs.first; nsock; nsock= nsock->next) {
                if(!(nsock->flag & (SOCK_HIDDEN|SOCK_UNAVAIL))) {
@@ -130,9 +180,9 @@ static void node_update(bNode *node)
                        dy-= NODE_DY;
                }
        }
-       
-       node->prvr.xmin= node->butr.xmin= node->locx + NODE_DYS;
-       node->prvr.xmax= node->butr.xmax= node->locx + node->width- NODE_DYS;
+
+       node->prvr.xmin= node->locx + NODE_DYS;
+       node->prvr.xmax= node->locx + node->width- NODE_DYS;
        
        /* preview rect? */
        if(node->flag & NODE_PREVIEW) {
@@ -176,16 +226,35 @@ static void node_update(bNode *node)
 
        /* XXX ugly hack, typeinfo for group is generated */
        if(node->type == NODE_GROUP)
-               ; // XXX node->typeinfo->butfunc= node_buts_group;
+               ; // XXX node->typeinfo->uifunc= node_buts_group;
+
+       /* ui block */
+       sprintf(str, "node buttons %p", node);
+       node->block= uiBeginBlock(C, CTX_wm_region(C), str, UI_EMBOSS);
+       uiBlockSetHandleFunc(node->block, do_node_internal_buttons, node);
        
        /* buttons rect? */
-       if((node->flag & NODE_OPTIONS) && node->typeinfo->butfunc) {
+       if((node->flag & NODE_OPTIONS) && node->typeinfo->uifunc) {
                dy-= NODE_DYS/2;
-               node->butr.ymax= dy;
-               node->butr.ymin= dy - (float)node->typeinfo->butfunc(NULL, NULL, node, NULL);
-               dy= node->butr.ymin - NODE_DYS/2;
+
+               /* set this for uifunc() that don't use layout engine yet */
+               node->butr.xmin= 0;
+               node->butr.xmax= node->width - 2*NODE_DYS;
+               node->butr.ymin= 0;
+               node->butr.ymax= 0;
+
+               RNA_pointer_create(&ntree->id, &RNA_Node, node, &ptr);
+
+               layout= uiBlockLayout(node->block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL,
+                       node->locx+NODE_DYS, dy, node->butr.xmax, 20, U.uistyles.first);
+
+               node->typeinfo->uifunc(layout, &ptr);
+               uiBlockEndAlign(node->block);
+               uiBlockLayoutResolve(node->block, NULL, &buty);
+
+               dy= buty - NODE_DYS/2;
        }
-       
+
        /* input sockets */
        for(nsock= node->inputs.first; nsock; nsock= nsock->next) {
                if(!(nsock->flag & (SOCK_HIDDEN|SOCK_UNAVAIL))) {
@@ -198,7 +267,7 @@ static void node_update(bNode *node)
        /* little bit space in end */
        if(node->inputs.first || (node->flag & (NODE_OPTIONS|NODE_PREVIEW))==0 )
                dy-= NODE_DYS/2;
-       
+
        node->totr.xmin= node->locx;
        node->totr.xmax= node->locx + node->width;
        node->totr.ymax= node->locy;
@@ -206,11 +275,12 @@ static void node_update(bNode *node)
 }
 
 /* based on settings in node, sets drawing rect info. each redraw! */
-static void node_update_hidden(bNode *node)
+static void node_update_hidden(const bContext *C, bNode *node)
 {
        bNodeSocket *nsock;
        float rad, drad, hiddenrad= HIDDEN_RAD;
        int totin=0, totout=0, tot;
+       char str[32];
        
        /* calculate minimal radius */
        for(nsock= node->inputs.first; nsock; nsock= nsock->next)
@@ -251,6 +321,11 @@ static void node_update_hidden(bNode *node)
                        rad+= drad;
                }
        }
+
+       /* ui block */
+       sprintf(str, "node buttons %p", node);
+       node->block= uiBeginBlock(C, CTX_wm_region(C), str, UI_EMBOSS);
+       uiBlockSetHandleFunc(node->block, do_node_internal_buttons, node);
 }
 
 static int node_get_colorid(bNode *node)
@@ -275,7 +350,7 @@ static int node_get_colorid(bNode *node)
 /* based on settings in node, sets drawing rect info. each redraw! */
 /* note: this assumes only 1 group at a time is drawn (linked data) */
 /* in node->totr the entire boundbox for the group is stored */
-static void node_update_group(bNode *gnode)
+static void node_update_group(const bContext *C, bNodeTree *ntree, bNode *gnode)
 {
        bNodeTree *ngroup= (bNodeTree *)gnode->id;
        bNode *node;
@@ -288,9 +363,9 @@ static void node_update_group(bNode *gnode)
                node->locx+= gnode->locx;
                node->locy+= gnode->locy;
                if(node->flag & NODE_HIDDEN)
-                       node_update_hidden(node);
+                       node_update_hidden(C, node);
                else
-                       node_update(node);
+                       node_update(C, ntree, node);
                node->locx-= gnode->locx;
                node->locy-= gnode->locy;
        }
@@ -575,61 +650,15 @@ static void node_draw_preview(bNodePreview *preview, rctf *prv)
        
 }
 
-static void do_node_internal_buttons(bContext *C, void *node_v, int event)
-{
-       SpaceNode *snode= CTX_wm_space_node(C);
-       
-       if(event==B_NODE_EXEC) {
-               if(snode->treetype==NTREE_SHADER) {
-                       WM_event_add_notifier(C, NC_MATERIAL|ND_SHADING, snode->id);
-               }
-               else if(snode->treetype==NTREE_COMPOSIT) {
-                       bNode *node= node_v;
-                       
-                       NodeTagChanged(snode->edittree, node);
-                       /* don't use NodeTagIDChanged, it gives far too many recomposites for image, scene layers, ... */
-                               
-                       /* not the best implementation of the world... but we need it to work now :) */
-                       if(node->type==CMP_NODE_R_LAYERS && node->custom2) {
-                               /* add event for this window (after render curarea can be changed) */
-                               //addqueue(curarea->win, UI_BUT_EVENT, B_NODE_TREE_EXEC);
-                               
-                               //composite_node_render(snode, node);
-                               //snode_handle_recalc(snode);
-                               
-                               /* add another event, a render can go fullscreen and open new window */
-                               //addqueue(curarea->win, UI_BUT_EVENT, B_NODE_TREE_EXEC);
-                       }
-                       else {
-                               node= node_tree_get_editgroup(snode->nodetree);
-                               if(node)
-                                       NodeTagIDChanged(snode->nodetree, node->id);
-                       }
-                       WM_event_add_notifier(C, NC_SCENE|ND_NODES, CTX_data_scene(C));
-               }                       
-               else if(snode->treetype==NTREE_TEXTURE) {
-                       WM_event_add_notifier(C, NC_TEXTURE|ND_NODES, snode->id);
-               }
-       }
-       
-}
-
 static void node_draw_basis(const bContext *C, ARegion *ar, SpaceNode *snode, bNode *node)
 {
        bNodeSocket *sock;
-       uiBlock *block;
        uiBut *bt;
        rctf *rct= &node->totr;
        float /*slen,*/ iconofs;
        int /*ofs,*/ color_id= node_get_colorid(node);
        char showname[128]; /* 128 used below */
        View2D *v2d = &ar->v2d;
-       char str[32];
-       
-       /* make unique block name, also used for handling blocks in editnode.c */
-       sprintf(str, "node buttons %p", node);
-       block= uiBeginBlock(C, ar, str, UI_EMBOSS);
-       uiBlockSetHandleFunc(block, do_node_internal_buttons, node);
        
        uiSetRoundBox(15-4);
        ui_dropshadow(rct, BASIS_RAD, snode->aspect, node->flag & SELECT);
@@ -715,7 +744,7 @@ static void node_draw_basis(const bContext *C, ARegion *ar, SpaceNode *snode, bN
        else
                BLI_strncpy(showname, node->name, 128);
        
-       uiDefBut(block, LABEL, 0, showname, (short)(rct->xmin+15), (short)(rct->ymax-NODE_DY), 
+       uiDefBut(node->block, LABEL, 0, showname, (short)(rct->xmin+15), (short)(rct->ymax-NODE_DY), 
                         (int)(iconofs - rct->xmin-18.0f), NODE_DY,  NULL, 0, 0, 0, 0, "");
 
        /* body */
@@ -743,7 +772,7 @@ static void node_draw_basis(const bContext *C, ARegion *ar, SpaceNode *snode, bN
 
        
        /* hurmf... another candidate for callback, have to see how this works first */
-       if(node->id && block && snode->treetype==NTREE_SHADER)
+       if(node->id && node->block && snode->treetype==NTREE_SHADER)
                nodeShaderSynchronizeID(node, 0);
        
        /* socket inputs, buttons */
@@ -751,38 +780,38 @@ static void node_draw_basis(const bContext *C, ARegion *ar, SpaceNode *snode, bN
                if(!(sock->flag & (SOCK_HIDDEN|SOCK_UNAVAIL))) {
                        socket_circle_draw(sock, NODE_SOCKSIZE);
                        
-                       if(block && sock->link==NULL) {
+                       if(node->block && sock->link==NULL) {
                                float *butpoin= sock->ns.vec;
                                
                                if(sock->type==SOCK_VALUE) {
-                                       bt= uiDefButF(block, NUM, B_NODE_EXEC, sock->name, 
+                                       bt= uiDefButF(node->block, NUM, B_NODE_EXEC, sock->name, 
                                                  (short)sock->locx+NODE_DYS, (short)(sock->locy)-9, (short)node->width-NODE_DY, 17, 
                                                  butpoin, sock->ns.min, sock->ns.max, 10, 2, "");
                                        uiButSetFunc(bt, node_sync_cb, snode, node);
                                }
                                else if(sock->type==SOCK_VECTOR) {
-                                       uiDefBlockBut(block, socket_vector_menu, sock, sock->name, 
+                                       uiDefBlockBut(node->block, socket_vector_menu, sock, sock->name, 
                                                  (short)sock->locx+NODE_DYS, (short)sock->locy-9, (short)node->width-NODE_DY, 17, 
                                                  "");
                                }
-                               else if(block && sock->type==SOCK_RGBA) {
+                               else if(node->block && sock->type==SOCK_RGBA) {
                                        short labelw= (short)node->width-NODE_DY-40, width;
                                        
                                        if(labelw>0) width= 40; else width= (short)node->width-NODE_DY;
                                        
-                                       bt= uiDefButF(block, COL, B_NODE_EXEC, "", 
+                                       bt= uiDefButF(node->block, COL, B_NODE_EXEC, "", 
                                                (short)(sock->locx+NODE_DYS), (short)sock->locy-8, width, 15, 
                                                   butpoin, 0, 0, 0, 0, "");
                                        uiButSetFunc(bt, node_sync_cb, snode, node);
                                        
-                                       if(labelw>0) uiDefBut(block, LABEL, 0, sock->name, 
+                                       if(labelw>0) uiDefBut(node->block, LABEL, 0, sock->name, 
                                                                                   (short)(sock->locx+NODE_DYS) + 40, (short)sock->locy-8, labelw, 15, 
                                                                                   NULL, 0, 0, 0, 0, "");
                                }
                        }
                        else {
                                
-                               uiDefBut(block, LABEL, 0, sock->name, (short)(sock->locx+3.0f), (short)(sock->locy-9.0f), 
+                               uiDefBut(node->block, LABEL, 0, sock->name, (short)(sock->locx+3.0f), (short)(sock->locy-9.0f), 
                                                 (short)(node->width-NODE_DY), NODE_DY,  NULL, 0, 0, 0, 0, "");
                        }
                }
@@ -803,7 +832,7 @@ static void node_draw_basis(const bContext *C, ARegion *ar, SpaceNode *snode, bN
                                slen= snode->aspect*UI_GetStringWidth(sock->name+ofs);
                        }
                        
-                       uiDefBut(block, LABEL, 0, sock->name+ofs, (short)(sock->locx-15.0f-slen), (short)(sock->locy-9.0f), 
+                       uiDefBut(node->block, LABEL, 0, sock->name+ofs, (short)(sock->locx-15.0f-slen), (short)(sock->locy-9.0f), 
                                         (short)(node->width-NODE_DY), NODE_DY,  NULL, 0, 0, 0, 0, "");
                }
        }
@@ -813,33 +842,19 @@ static void node_draw_basis(const bContext *C, ARegion *ar, SpaceNode *snode, bN
                if(node->preview && node->preview->rect)
                        node_draw_preview(node->preview, &node->prvr);
                
-       /* buttons */
-       if(node->flag & NODE_OPTIONS) {
-               if(block) {
-                       if(node->typeinfo->butfunc) {
-                               node->typeinfo->butfunc(block, snode->nodetree, node, &node->butr);
-                       }
-               }
-       }
-       
-       uiEndBlock(C, block);
-       uiDrawBlock(C, block);
+       uiEndBlock(C, node->block);
+       uiDrawBlock(C, node->block);
+       node->block= NULL;
 }
 
 static void node_draw_hidden(const bContext *C, ARegion *ar, SpaceNode *snode, bNode *node)
 {
-       uiBlock *block;
        bNodeSocket *sock;
        rctf *rct= &node->totr;
        float dx, centy= 0.5f*(rct->ymax+rct->ymin);
        float hiddenrad= 0.5f*(rct->ymax-rct->ymin);
        int color_id= node_get_colorid(node);
-       char str[32], showname[128];    /* 128 is used below */
-       
-       /* make unique block name, also used for handling blocks in editnode.c */
-       sprintf(str, "node buttons %p", node);
-       block= uiBeginBlock(C, ar, str, UI_EMBOSS);
-       uiBlockSetHandleFunc(block, do_node_internal_buttons, node);
+       char showname[128];     /* 128 is used below */
        
        /* shadow */
        uiSetRoundBox(15);
@@ -884,7 +899,7 @@ static void node_draw_hidden(const bContext *C, ARegion *ar, SpaceNode *snode, b
                else
                        BLI_strncpy(showname, node->name, 128);
 
-               uiDefBut(block, LABEL, 0, showname, (short)(rct->xmin+15), (short)(centy-10), 
+               uiDefBut(node->block, LABEL, 0, showname, (short)(rct->xmin+15), (short)(centy-10), 
                                 (int)(rct->xmax - rct->xmin-18.0f -12.0f), NODE_DY,  NULL, 0, 0, 0, 0, "");
        }       
 
@@ -910,9 +925,9 @@ static void node_draw_hidden(const bContext *C, ARegion *ar, SpaceNode *snode, b
                        socket_circle_draw(sock, NODE_SOCKSIZE);
        }
        
-       uiEndBlock(C, block);
-       uiDrawBlock(C, block);
-
+       uiEndBlock(C, node->block);
+       uiDrawBlock(C, node->block);
+       node->block= NULL;
 }
 
 static void node_draw_nodetree(const bContext *C, ARegion *ar, SpaceNode *snode, bNodeTree *ntree)
@@ -1081,11 +1096,11 @@ void drawnodespace(const bContext *C, ARegion *ar, View2D *v2d)
                /* for now, we set drawing coordinates on each redraw */
                for(node= snode->nodetree->nodes.first; node; node= node->next) {
                        if(node->flag & NODE_GROUP_EDIT)
-                               node_update_group(node);
+                               node_update_group(C, snode->nodetree, node);
                        else if(node->flag & NODE_HIDDEN)
-                               node_update_hidden(node);
+                               node_update_hidden(C, node);
                        else
-                               node_update(node);
+                               node_update(C, snode->nodetree, node);
                }
 
                node_draw_nodetree(C, ar, snode, snode->nodetree);
index b10de02dbb49caa95c41079d0f0328eda76fa0bd..e70221df9aba204bbec3adc0c9dc51bbfced60e5 100644 (file)
@@ -40,6 +40,7 @@ struct bNodeLink;
 struct bNodeType;
 struct bNodeGroup;
 struct AnimData;
+struct uiBlock;
 
 #define NODE_MAXSTR 32
 
@@ -131,6 +132,7 @@ typedef struct bNode {
        rctf butr;                              /* optional buttons area */
        rctf prvr;                              /* optional preview area */
        bNodePreview *preview;  /* optional preview image */
+       struct uiBlock *block;  /* runtime during drawing */
        
        struct bNodeType *typeinfo;     /* lookup of callbacks and defaults */
        
index 99f61c7a7245b08f33f634ddd8e9b3944183594e..25fc8e966dcf7cce7664ae76dd5c74f039107fca 100644 (file)
@@ -25,6 +25,7 @@
 #include <stdlib.h>
 #include <string.h>
 
+#include "RNA_access.h"
 #include "RNA_define.h"
 #include "RNA_types.h"
 
 #include "BKE_node.h"
 #include "BKE_image.h"
 
+static EnumPropertyItem node_blend_type_items[] = {
+       { 0, "MIX",          0, "Mix",         ""},
+       { 1, "ADD",          0, "Add",         ""},
+       { 3, "SUBTRACT",     0, "Subtract",    ""},
+       { 2, "MULTIPLY",     0, "Multiply",    ""},
+       { 4, "SCREEN",       0, "Screen",      ""},
+       { 9, "OVERLAY",      0, "Overlay",     ""},
+       { 5, "DIVIDE",       0, "Divide",      ""},
+       { 6, "DIFFERENCE",   0, "Difference",  ""},
+       { 7, "DARKEN",       0, "Darken",      ""},
+       { 8, "LIGHTEN",      0, "Lighten",     ""},
+       {10, "DODGE",        0, "Dodge",       ""},
+       {11, "BURN",         0, "Burn",        ""},
+       {15, "COLOR",        0, "Color",       ""},
+       {14, "VALUE",        0, "Value",       ""},
+       {13, "SATURATION",   0, "Saturation",  ""},
+       {12, "HUE",          0, "Hue",         ""},
+       {16, "SOFT_LIGHT",   0, "Soft Light",  ""},
+       {17, "LINEAR_LIGHT", 0, "Linear Light",""},
+       {0, NULL, 0, NULL, NULL}
+};
+
+static EnumPropertyItem node_flip_items[] = {
+       {0, "X",  0, "Flip X",     ""},
+       {1, "Y",  0, "Flip Y",     ""},
+       {2, "XY", 0, "Flip X & Y", ""},
+       {0, NULL, 0, NULL, NULL}
+};
+
+static EnumPropertyItem node_math_items[] = {
+       { 0, "ADD",          0, "Add",          ""},
+       { 1, "SUBTRACT",     0, "Subtract",     ""},
+       { 2, "MULTIPLY",     0, "Multiply",     ""},
+       { 3, "DIVIDE",       0, "Divide",       ""},
+       { 4, "SINE",         0, "Sine",         ""},
+       { 5, "COSINE",       0, "Cosine",       ""},
+       { 6, "TANGENT",      0, "Tangent",      ""},
+       { 7, "ARCSINE",      0, "Arcsine",      ""},
+       { 8, "ARCCOSINE",    0, "Arccosine",    ""},
+       { 9, "ARCTANGENT",   0, "Arctangent",   ""},
+       {10, "POWER",        0, "Power",        ""},
+       {11, "LOGARITHM",    0, "Logarithm",    ""},
+       {12, "MINIMUM",      0, "Minimum",      ""},
+       {13, "MAXIMUM",      0, "Maximum",      ""},
+       {14, "ROUND",        0, "Round",        ""},
+       {15, "LESS_THAN",    0, "Less Than",    ""},
+       {16, "GREATER_THAN", 0, "Greater Than", ""},
+       {0, NULL, 0, NULL, NULL}
+};
+
+static EnumPropertyItem node_vec_math_items[] = {
+       {0, "ADD",           0, "Add",           ""},
+       {1, "SUBTRACT",      0, "Subtract",      ""},
+       {2, "AVERAGE",       0, "Average",       ""},
+       {3, "DOT_PRODUCT",   0, "Dot Product",   ""},
+       {4, "CROSS_PRODUCT", 0, "Cross Product", ""},
+       {5, "NORMALIZE",     0, "Normalize",     ""},
+       {0, NULL, 0, NULL, NULL}
+};
+
+static EnumPropertyItem node_filter_items[] = {
+       {0, "SOFTEN",  0, "Soften",  ""},
+       {1, "SHARPEN", 0, "Sharpen", ""},
+       {2, "LAPLACE", 0, "Laplace", ""},
+       {3, "SOBEL",   0, "Sobel",   ""},
+       {4, "PREWITT", 0, "Prewitt", ""},
+       {5, "KIRSCH",  0, "Kirsch",  ""},
+       {6, "SHADOW",  0, "Shadow",  ""},
+       {0, NULL, 0, NULL, NULL}
+};
+
 #ifdef RNA_RUNTIME
 
+#include "ED_node.h"
+
 static StructRNA *rna_Node_refine(struct PointerRNA *ptr)
 {
        bNode *node = (bNode*)ptr->data;
@@ -66,6 +140,53 @@ static char *rna_Node_path(PointerRNA *ptr)
        return BLI_sprintfN("nodes[%d]", index);
 }
 
+static void rna_Node_update(bContext *C, PointerRNA *ptr)
+{
+       bNode *node= (bNode*)ptr->data;
+
+       ED_node_changed_update(C, node);
+}
+
+static void rna_Node_update_name(bContext *C, PointerRNA *ptr)
+{
+       bNode *node= (bNode*)ptr->data;
+       const char *name;
+
+       if(node->id) {
+               BLI_strncpy(node->name, node->id->name+2, NODE_MAXSTR);
+       }
+       else {
+               switch(node->typeinfo->type) {
+                       case SH_NODE_MIX_RGB:
+                       case CMP_NODE_MIX_RGB:
+                       case TEX_NODE_MIX_RGB:
+                               if(RNA_enum_name(node_blend_type_items, node->custom1, &name))
+                                       BLI_strncpy(node->name, name, NODE_MAXSTR);
+                               break;
+                       case CMP_NODE_FILTER:
+                               if(RNA_enum_name(node_filter_items, node->custom1, &name))
+                                       BLI_strncpy(node->name, name, NODE_MAXSTR);
+                               break;
+                       case CMP_NODE_FLIP:
+                               if(RNA_enum_name(node_flip_items, node->custom1, &name))
+                                       BLI_strncpy(node->name, name, NODE_MAXSTR);
+                               break;
+                       case SH_NODE_MATH:
+                       case CMP_NODE_MATH:
+                       case TEX_NODE_MATH:
+                               if(RNA_enum_name(node_math_items, node->custom1, &name))
+                                       BLI_strncpy(node->name, name, NODE_MAXSTR);
+                               break;
+                       case SH_NODE_VECT_MATH:
+                               if(RNA_enum_name(node_vec_math_items, node->custom1, &name))
+                                       BLI_strncpy(node->name, name, NODE_MAXSTR);
+                               break;
+               }
+       }
+
+       rna_Node_update(C, ptr);
+}
+
 #else
 
 #define MaxNodes 1000
@@ -183,53 +304,22 @@ static void def_math(StructRNA *srna)
 {
        PropertyRNA *prop;
        
-       static EnumPropertyItem items[] = {
-               { 0, "ADD",          0, "Add",          ""},
-               { 1, "SUBTRACT",     0, "Subtract",     ""},
-               { 2, "MULTIPLY",     0, "Multiply",     ""},
-               { 3, "DIVIDE",       0, "Divide",       ""},
-               { 4, "SINE",         0, "Sine",         ""},
-               { 5, "COSINE",       0, "Cosine",       ""},
-               { 6, "TANGENT",      0, "Tangent",      ""},
-               { 7, "ARCSINE",      0, "Arcsine",      ""},
-               { 8, "ARCCOSINE",    0, "Arccosine",    ""},
-               { 9, "ARCTANGENT",   0, "Arctangent",   ""},
-               {10, "POWER",        0, "Power",        ""},
-               {11, "LOGARITHM",    0, "Logarithm",    ""},
-               {12, "MINIMUM",      0, "Minimum",      ""},
-               {13, "MAXIMUM",      0, "Maximum",      ""},
-               {14, "ROUND",        0, "Round",        ""},
-               {15, "LESS_THAN",    0, "Less Than",    ""},
-               {16, "GREATER_THAN", 0, "Greater Than", ""},
-               
-               {0, NULL, 0, NULL, NULL}
-       };
-       
        prop = RNA_def_property(srna, "operation", PROP_ENUM, PROP_NONE);
        RNA_def_property_enum_sdna(prop, NULL, "custom1");
-       RNA_def_property_enum_items(prop, items);
+       RNA_def_property_enum_items(prop, node_math_items);
        RNA_def_property_ui_text(prop, "Operation", "");
+       RNA_def_property_update(prop, 0, "rna_Node_update_name");
 }
 
 static void def_vector_math(StructRNA *srna)
 {
        PropertyRNA *prop;
        
-       static EnumPropertyItem items[] = {
-               {0, "ADD",           0, "Add",           ""},
-               {1, "SUBTRACT",      0, "Subtract",      ""},
-               {2, "AVERAGE",       0, "Average",       ""},
-               {3, "DOT_PRODUCT",   0, "Dot Product",   ""},
-               {4, "CROSS_PRODUCT", 0, "Cross Product", ""},
-               {5, "NORMALIZE",     0, "Normalize",     ""},
-               
-               {0, NULL, 0, NULL, NULL}
-       };
-       
        prop = RNA_def_property(srna, "operation", PROP_ENUM, PROP_NONE);
        RNA_def_property_enum_sdna(prop, NULL, "custom1");
-       RNA_def_property_enum_items(prop, items);
+       RNA_def_property_enum_items(prop, node_vec_math_items);
        RNA_def_property_ui_text(prop, "Operation", "");
+       RNA_def_property_update(prop, 0, "rna_Node_update_name");
 }
 
 static void def_rgb_curve(StructRNA *srna)
@@ -240,6 +330,7 @@ static void def_rgb_curve(StructRNA *srna)
        RNA_def_property_pointer_sdna(prop, NULL, "storage");
        RNA_def_property_struct_type(prop, "CurveMapping");
        RNA_def_property_ui_text(prop, "Mapping", "");
+       RNA_def_property_update(prop, 0, "rna_Node_update");
 }
 
 static void def_vector_curve(StructRNA *srna)
@@ -250,6 +341,7 @@ static void def_vector_curve(StructRNA *srna)
        RNA_def_property_pointer_sdna(prop, NULL, "storage");
        RNA_def_property_struct_type(prop, "CurveMapping");
        RNA_def_property_ui_text(prop, "Mapping", "");
+       RNA_def_property_update(prop, 0, "rna_Node_update");
 }
 
 static void def_time(StructRNA *srna)
@@ -260,59 +352,44 @@ static void def_time(StructRNA *srna)
        RNA_def_property_pointer_sdna(prop, NULL, "storage");
        RNA_def_property_struct_type(prop, "CurveMapping");
        RNA_def_property_ui_text(prop, "Curve", "");
+       RNA_def_property_update(prop, 0, "rna_Node_update");
        
        prop = RNA_def_property(srna, "start", PROP_INT, PROP_NONE);
        RNA_def_property_int_sdna(prop, NULL, "custom1");
        RNA_def_property_ui_text(prop, "Start Frame", "");
+       RNA_def_property_update(prop, 0, "rna_Node_update");
        
        prop = RNA_def_property(srna, "end", PROP_INT, PROP_NONE);
        RNA_def_property_int_sdna(prop, NULL, "custom2");
        RNA_def_property_ui_text(prop, "End Frame", "");
+       RNA_def_property_update(prop, 0, "rna_Node_update");
 }
 
 static void def_val_to_rgb(StructRNA *srna)
 {
-       /*PropertyRNA *prop;*/
+       PropertyRNA *prop;
        
-       /* TODO: uncomment when ColorBand is wrapped *//*
-       prop = RNA_def_property(srna, "color_band", PROP_POINTER, PROP_NONE);
+       prop = RNA_def_property(srna, "color_ramp", PROP_POINTER, PROP_NONE);
        RNA_def_property_pointer_sdna(prop, NULL, "storage");
-       RNA_def_property_struct_type(prop, "ColorBand");
-       RNA_def_property_ui_text(prop, "Color Band", "");*/
+       RNA_def_property_struct_type(prop, "ColorRamp");
+       RNA_def_property_ui_text(prop, "Color Ramp", "");
+       RNA_def_property_update(prop, 0, "rna_Node_update");
 }
 
 static void def_mix_rgb(StructRNA *srna)
 {
        PropertyRNA *prop;
        
-       static EnumPropertyItem blend_type_items[] = {
-               { 0, "MIX",        0, "Mix",         ""},
-               { 1, "ADD",        0, "Add",         ""},
-               { 3, "SUBTRACT",   0, "Subtract",    ""},
-               { 2, "MULTIPLY",   0, "Multiply",    ""},
-               { 4, "SCREEN",     0, "Screen",      ""},
-               { 9, "OVERLAY",    0, "Overlay",     ""},
-               { 5, "DIVIDE",     0, "Divide",      ""},
-               { 6, "DIFFERENCE", 0, "Difference",  ""},
-               { 7, "DARKEN",     0, "Darken",      ""},
-               { 8, "LIGHTEN",    0, "Lighten",     ""},
-               {10, "DODGE",      0, "Dodge",       ""},
-               {11, "BURN",       0, "Burn",        ""},
-               {15, "COLOR",      0, "Color",       ""},
-               {14, "VALUE",      0, "Value",       ""},
-               {13, "SATURATION", 0, "Saturation",  ""},
-               {12, "HUE",        0, "Hue",         ""},
-               {0, NULL, 0, NULL, NULL}
-       };
-       
        prop = RNA_def_property(srna, "blend_type", PROP_ENUM, PROP_NONE);
        RNA_def_property_enum_sdna(prop, NULL, "custom1");
-       RNA_def_property_enum_items(prop, blend_type_items);
+       RNA_def_property_enum_items(prop, node_blend_type_items);
        RNA_def_property_ui_text(prop, "Blend Type", "");
+       RNA_def_property_update(prop, 0, "rna_Node_update_name");
        
        prop = RNA_def_property(srna, "alpha", PROP_BOOLEAN, PROP_NONE);
        RNA_def_property_boolean_sdna(prop, NULL, "custom2", 1);
-       RNA_def_property_ui_text(prop, "Diffuse", "Include alpha of second input in this operation");
+       RNA_def_property_ui_text(prop, "Alpha", "Include alpha of second input in this operation");
+       RNA_def_property_update(prop, 0, "rna_Node_update");
 }
 
 static void def_texture(StructRNA *srna)
@@ -324,10 +401,12 @@ static void def_texture(StructRNA *srna)
        RNA_def_property_struct_type(prop, "Texture");
        RNA_def_property_flag(prop, PROP_EDITABLE);
        RNA_def_property_ui_text(prop, "Texture", "");
+       RNA_def_property_update(prop, 0, "rna_Node_update_name");
        
        prop = RNA_def_property(srna, "node_output", PROP_INT, PROP_NONE);
        RNA_def_property_int_sdna(prop, NULL, "custom1");
        RNA_def_property_ui_text(prop, "Node Output", "For node-based textures, which output node to use");
+       RNA_def_property_update(prop, 0, "rna_Node_update");
 }
 
 
@@ -342,18 +421,22 @@ static void def_sh_material(StructRNA *srna)
        RNA_def_property_struct_type(prop, "Material");
        RNA_def_property_flag(prop, PROP_EDITABLE);
        RNA_def_property_ui_text(prop, "Material", "");
+       RNA_def_property_update(prop, 0, "rna_Node_update_name");
 
        prop = RNA_def_property(srna, "diffuse", PROP_BOOLEAN, PROP_NONE);
        RNA_def_property_boolean_sdna(prop, NULL, "custom1", SH_NODE_MAT_DIFF);
        RNA_def_property_ui_text(prop, "Diffuse", "Material Node outputs Diffuse");
+       RNA_def_property_update(prop, 0, "rna_Node_update");
 
        prop = RNA_def_property(srna, "specular", PROP_BOOLEAN, PROP_NONE);
        RNA_def_property_boolean_sdna(prop, NULL, "custom1", SH_NODE_MAT_SPEC);
        RNA_def_property_ui_text(prop, "Specular", "Material Node outputs Specular");
+       RNA_def_property_update(prop, 0, "rna_Node_update");
        
        prop = RNA_def_property(srna, "invert_normal", PROP_BOOLEAN, PROP_NONE);
        RNA_def_property_boolean_sdna(prop, NULL, "custom1", SH_NODE_MAT_NEG);
        RNA_def_property_ui_text(prop, "Invert Normal", "Material Node uses inverted normal");
+       RNA_def_property_update(prop, 0, "rna_Node_update");
 }
 
 static void def_sh_mapping(StructRNA *srna)
@@ -364,6 +447,7 @@ static void def_sh_mapping(StructRNA *srna)
        RNA_def_property_pointer_sdna(prop, NULL, "storage");
        RNA_def_property_struct_type(prop, "TexMapping");
        RNA_def_property_ui_text(prop, "Mapping", "");
+       RNA_def_property_update(prop, 0, "rna_Node_update");
 }
 
 static void def_sh_geometry(StructRNA *srna)
@@ -375,10 +459,12 @@ static void def_sh_geometry(StructRNA *srna)
        prop = RNA_def_property(srna, "uv_layer", PROP_STRING, PROP_NONE);
        RNA_def_property_string_sdna(prop, NULL, "uvname");
        RNA_def_property_ui_text(prop, "UV Layer", "");
+       RNA_def_property_update(prop, 0, "rna_Node_update");
        
        prop = RNA_def_property(srna, "color_layer", PROP_STRING, PROP_NONE);
        RNA_def_property_string_sdna(prop, NULL, "colname");
        RNA_def_property_ui_text(prop, "Vertex Color Layer", "");
+       RNA_def_property_update(prop, 0, "rna_Node_update");
 }
 
 
@@ -391,6 +477,7 @@ static void def_cmp_alpha_over(StructRNA *srna)
        prop = RNA_def_property(srna, "convert_premul", PROP_BOOLEAN, PROP_NONE);
        RNA_def_property_boolean_sdna(prop, NULL, "custom1", 1);
        RNA_def_property_ui_text(prop, "convert_premul", "TODO: don't know what this is");
+       RNA_def_property_update(prop, 0, "rna_Node_update");
        
        RNA_def_struct_sdna_from(srna, "NodeTwoFloats", "storage");
        
@@ -398,6 +485,7 @@ static void def_cmp_alpha_over(StructRNA *srna)
        RNA_def_property_float_sdna(prop, NULL, "x");
        RNA_def_property_range(prop, 0.0f, 1.0f);
        RNA_def_property_ui_text(prop, "Premul", "Mix Factor");
+       RNA_def_property_update(prop, 0, "rna_Node_update");
 }
 
 static void def_cmp_blur(StructRNA *srna)
@@ -422,58 +510,70 @@ static void def_cmp_blur(StructRNA *srna)
        RNA_def_property_int_sdna(prop, NULL, "sizex");
        RNA_def_property_range(prop, 0, 256);
        RNA_def_property_ui_text(prop, "Size X", "");
+       RNA_def_property_update(prop, 0, "rna_Node_update");
        
        prop = RNA_def_property(srna, "sizey", PROP_INT, PROP_NONE);
        RNA_def_property_int_sdna(prop, NULL, "sizey");
        RNA_def_property_range(prop, 1, 256);
        RNA_def_property_ui_text(prop, "Size Y", "");
+       RNA_def_property_update(prop, 0, "rna_Node_update");
        
        prop = RNA_def_property(srna, "samples", PROP_INT, PROP_NONE);
        RNA_def_property_int_sdna(prop, NULL, "samples");
        RNA_def_property_range(prop, 1, 256);
        RNA_def_property_ui_text(prop, "Samples", "");
+       RNA_def_property_update(prop, 0, "rna_Node_update");
        
        prop = RNA_def_property(srna, "max_speed", PROP_INT, PROP_NONE);
        RNA_def_property_int_sdna(prop, NULL, "maxspeed");
        RNA_def_property_range(prop, 1, 1024);
        RNA_def_property_ui_text(prop, "Max Speed", "");
+       RNA_def_property_update(prop, 0, "rna_Node_update");
        
        prop = RNA_def_property(srna, "min_speed", PROP_INT, PROP_NONE);
        RNA_def_property_int_sdna(prop, NULL, "minspeed");
        RNA_def_property_range(prop, 1, 1024);
        RNA_def_property_ui_text(prop, "Min Speed", "");
+       RNA_def_property_update(prop, 0, "rna_Node_update");
 
        prop = RNA_def_property(srna, "relative", PROP_BOOLEAN, PROP_NONE);
        RNA_def_property_boolean_sdna(prop, NULL, "relative", 1);
        RNA_def_property_ui_text(prop, "Relative", "");
+       RNA_def_property_update(prop, 0, "rna_Node_update");
        
        prop = RNA_def_property(srna, "factor", PROP_FLOAT, PROP_NONE);
        RNA_def_property_float_sdna(prop, NULL, "fac");
        RNA_def_property_range(prop, 0.0f, 2.0f);
        RNA_def_property_ui_text(prop, "Factor", "");
+       RNA_def_property_update(prop, 0, "rna_Node_update");
        
        prop = RNA_def_property(srna, "factor_x", PROP_FLOAT, PROP_NONE);
        RNA_def_property_float_sdna(prop, NULL, "percentx");
        RNA_def_property_range(prop, 0.0f, 1.0f);
        RNA_def_property_ui_text(prop, "Relative Size X", "");
+       RNA_def_property_update(prop, 0, "rna_Node_update");
        
        prop = RNA_def_property(srna, "factor_y", PROP_FLOAT, PROP_NONE);
        RNA_def_property_float_sdna(prop, NULL, "percenty");
        RNA_def_property_range(prop, 0.0f, 1.0f);
        RNA_def_property_ui_text(prop, "Relative Size Y", "");
+       RNA_def_property_update(prop, 0, "rna_Node_update");
        
        prop = RNA_def_property(srna, "filter_type", PROP_ENUM, PROP_NONE);
        RNA_def_property_enum_sdna(prop, NULL, "filtertype");
        RNA_def_property_enum_items(prop, filter_type_items);
        RNA_def_property_ui_text(prop, "Filter Type", "");
+       RNA_def_property_update(prop, 0, "rna_Node_update");
        
        prop = RNA_def_property(srna, "bokeh", PROP_BOOLEAN, PROP_NONE);
        RNA_def_property_boolean_sdna(prop, NULL, "bokeh", 1);
        RNA_def_property_ui_text(prop, "Bokeh", "");
+       RNA_def_property_update(prop, 0, "rna_Node_update");
        
        prop = RNA_def_property(srna, "gamma", PROP_BOOLEAN, PROP_NONE);
        RNA_def_property_boolean_sdna(prop, NULL, "gamma", 1);
        RNA_def_property_ui_text(prop, "Gamma", "");
+       RNA_def_property_update(prop, 0, "rna_Node_update");
        
        /*
                TODO:
@@ -490,21 +590,11 @@ static void def_cmp_filter(StructRNA *srna)
 {
        PropertyRNA *prop;
 
-       static EnumPropertyItem type_items[] = {
-               {0, "SOFTEN",  0, "Soften",  ""},
-               {1, "SHARPEN", 0, "Sharpen", ""},
-               {2, "LAPLACE", 0, "Laplace", ""},
-               {3, "SOBEL",   0, "Sobel",   ""},
-               {4, "PREWITT", 0, "Prewitt", ""},
-               {5, "KIRSCH",  0, "Kirsch",  ""},
-               {6, "SHADOW",  0, "Shadow",  ""},
-               {0, NULL, 0, NULL, NULL}
-       };
-       
        prop = RNA_def_property(srna, "filter_type", PROP_ENUM, PROP_NONE);
        RNA_def_property_enum_sdna(prop, NULL, "custom1");
-       RNA_def_property_enum_items(prop, type_items);
+       RNA_def_property_enum_items(prop, node_filter_items);
        RNA_def_property_ui_text(prop, "Filter Type", "");
+       RNA_def_property_update(prop, 0, "rna_Node_update_name");
 }
 
 static void def_cmp_map_value(StructRNA *srna)
@@ -517,29 +607,35 @@ static void def_cmp_map_value(StructRNA *srna)
        RNA_def_property_float_sdna(prop, NULL, "loc");
        RNA_def_property_range(prop, -1000.0f, 1000.0f);
        RNA_def_property_ui_text(prop, "Offset", "");
+       RNA_def_property_update(prop, 0, "rna_Node_update");
        
        prop = RNA_def_property(srna, "size", PROP_FLOAT, PROP_NONE);
        RNA_def_property_float_sdna(prop, NULL, "size");
        RNA_def_property_range(prop, -1000.0f, 1000.0f);
        RNA_def_property_ui_text(prop, "Size", "");
+       RNA_def_property_update(prop, 0, "rna_Node_update");
        
        prop = RNA_def_property(srna, "use_min", PROP_BOOLEAN, PROP_NONE);
        RNA_def_property_boolean_sdna(prop, NULL, "flag", TEXMAP_CLIP_MIN);
        RNA_def_property_ui_text(prop, "Use Minimum", "");
+       RNA_def_property_update(prop, 0, "rna_Node_update");
        
        prop = RNA_def_property(srna, "use_max", PROP_BOOLEAN, PROP_NONE);
        RNA_def_property_boolean_sdna(prop, NULL, "flag", TEXMAP_CLIP_MAX);
        RNA_def_property_ui_text(prop, "Use Maximum", "");
+       RNA_def_property_update(prop, 0, "rna_Node_update");
        
        prop = RNA_def_property(srna, "min", PROP_FLOAT, PROP_NONE);
        RNA_def_property_float_sdna(prop, NULL, "min");
        RNA_def_property_range(prop, -1000.0f, 1000.0f);
        RNA_def_property_ui_text(prop, "Minimum", "");
+       RNA_def_property_update(prop, 0, "rna_Node_update");
        
        prop = RNA_def_property(srna, "max", PROP_FLOAT, PROP_NONE);
        RNA_def_property_float_sdna(prop, NULL, "max");
        RNA_def_property_range(prop, -1000.0f, 1000.0f);
        RNA_def_property_ui_text(prop, "Maximum", "");
+       RNA_def_property_update(prop, 0, "rna_Node_update");
 }
 
 static void def_cmp_vector_blur(StructRNA *srna)
@@ -551,22 +647,27 @@ static void def_cmp_vector_blur(StructRNA *srna)
        prop = RNA_def_property(srna, "samples", PROP_INT, PROP_NONE);
        RNA_def_property_int_sdna(prop, NULL, "samples");
        RNA_def_property_ui_text(prop, "Samples", "");
+       RNA_def_property_update(prop, 0, "rna_Node_update");
        
        prop = RNA_def_property(srna, "min_speed", PROP_INT, PROP_NONE);
        RNA_def_property_int_sdna(prop, NULL, "minspeed");
        RNA_def_property_ui_text(prop, "Min Speed", "Minimum speed for a pixel to be blurred; used to separate background from foreground");
+       RNA_def_property_update(prop, 0, "rna_Node_update");
                
        prop = RNA_def_property(srna, "max_speed", PROP_INT, PROP_NONE);
        RNA_def_property_int_sdna(prop, NULL, "maxspeed");
-       RNA_def_property_ui_text(prop, "Min Speed", "Maximum speed, or zero for none");
+       RNA_def_property_ui_text(prop, "Max Speed", "Maximum speed, or zero for none");
+       RNA_def_property_update(prop, 0, "rna_Node_update");
        
        prop = RNA_def_property(srna, "factor", PROP_FLOAT, PROP_NONE);
        RNA_def_property_float_sdna(prop, NULL, "fac");
        RNA_def_property_ui_text(prop, "Blur Factor", "Scaling factor for motion vectors; actually 'shutter speed' in frames");
+       RNA_def_property_update(prop, 0, "rna_Node_update");
        
        prop = RNA_def_property(srna, "curved", PROP_BOOLEAN, PROP_NONE);
        RNA_def_property_boolean_sdna(prop, NULL, "curved", 1);
        RNA_def_property_ui_text(prop, "Curved", "Interpolate between frames in a bezier curve, rather than linearly");
+       RNA_def_property_update(prop, 0, "rna_Node_update");
 }
 
 static void def_cmp_image(StructRNA *srna)
@@ -586,6 +687,7 @@ static void def_cmp_image(StructRNA *srna)
        RNA_def_property_struct_type(prop, "Image");
        RNA_def_property_flag(prop, PROP_EDITABLE);
        RNA_def_property_ui_text(prop, "Image", "");
+       RNA_def_property_update(prop, 0, "rna_Node_update_name");
        
        RNA_def_struct_sdna_from(srna, "ImageUser", "storage");
 
@@ -595,24 +697,29 @@ static void def_cmp_image(StructRNA *srna)
        RNA_def_property_int_sdna(prop, NULL, "frames");
        RNA_def_property_range(prop, 1, MAXFRAMEF);
        RNA_def_property_ui_text(prop, "Frames", "Number of images used in animation");
+       RNA_def_property_update(prop, 0, "rna_Node_update");
        
        prop = RNA_def_property(srna, "start", PROP_INT, PROP_NONE);
        RNA_def_property_int_sdna(prop, NULL, "sfra");
        RNA_def_property_range(prop, 1, MAXFRAMEF);
        RNA_def_property_ui_text(prop, "Start Frame", "");
+       RNA_def_property_update(prop, 0, "rna_Node_update");
        
        prop = RNA_def_property(srna, "offset", PROP_INT, PROP_NONE);
        RNA_def_property_int_sdna(prop, NULL, "offset");
        RNA_def_property_range(prop, -MAXFRAMEF, MAXFRAMEF);
        RNA_def_property_ui_text(prop, "Offset", "Offsets the number of the frame to use in the animation");
+       RNA_def_property_update(prop, 0, "rna_Node_update");
        
        prop = RNA_def_property(srna, "cyclic", PROP_BOOLEAN, PROP_NONE);
        RNA_def_property_boolean_sdna(prop, NULL, "cycl", 1);
        RNA_def_property_ui_text(prop, "Cyclic", "");
+       RNA_def_property_update(prop, 0, "rna_Node_update");
        
        prop = RNA_def_property(srna, "auto_refresh", PROP_BOOLEAN, PROP_NONE);
        RNA_def_property_boolean_sdna(prop, NULL, "flag", IMA_ANIM_ALWAYS);
        RNA_def_property_ui_text(prop, "Auto-Refresh", "");
+       RNA_def_property_update(prop, 0, "rna_Node_update");
        
        /* } */
        
@@ -622,6 +729,7 @@ static void def_cmp_image(StructRNA *srna)
        RNA_def_property_int_sdna(prop, NULL, "layer");
        RNA_def_property_range(prop, 0, 10000);
        RNA_def_property_ui_text(prop, "Layer", "");
+       RNA_def_property_update(prop, 0, "rna_Node_update");
        
        /* } */
        
@@ -638,16 +746,19 @@ static void def_cmp_render_layers(StructRNA *srna)
        RNA_def_property_struct_type(prop, "Scene");
        RNA_def_property_flag(prop, PROP_EDITABLE);
        RNA_def_property_ui_text(prop, "Scene", "");
+       RNA_def_property_update(prop, 0, "rna_Node_update_name");
        
        /* TODO: layers in menu */
        prop = RNA_def_property(srna, "layer", PROP_INT, PROP_NONE);
        RNA_def_property_int_sdna(prop, NULL, "custom1");
        RNA_def_property_ui_text(prop, "Layer", "");
+       RNA_def_property_update(prop, 0, "rna_Node_update");
        
        /* TODO: comments indicate this might be a hack */
        prop = RNA_def_property(srna, "re_render", PROP_BOOLEAN, PROP_NONE);
        RNA_def_property_boolean_sdna(prop, NULL, "custom2", 1);
        RNA_def_property_ui_text(prop, "Re-render", "");
+       RNA_def_property_update(prop, 0, "rna_Node_update");
 }
 
 static void def_cmp_output_file(StructRNA *srna)
@@ -711,11 +822,13 @@ static void def_cmp_output_file(StructRNA *srna)
        RNA_def_property_int_sdna(prop, NULL, "sfra");
        RNA_def_property_range(prop, 1, MAXFRAMEF);
        RNA_def_property_ui_text(prop, "Start Frame", "");
+       RNA_def_property_update(prop, 0, "rna_Node_update");
        
        prop = RNA_def_property(srna, "end", PROP_INT, PROP_NONE);
        RNA_def_property_int_sdna(prop, NULL, "efra");
        RNA_def_property_range(prop, 1, MAXFRAMEF);
        RNA_def_property_ui_text(prop, "End Frame", "");
+       RNA_def_property_update(prop, 0, "rna_Node_update");
 }
 
 static void def_cmp_dilate_erode(StructRNA *srna)
@@ -725,6 +838,7 @@ static void def_cmp_dilate_erode(StructRNA *srna)
        prop = RNA_def_property(srna, "distance", PROP_INT, PROP_NONE);
        RNA_def_property_int_sdna(prop, NULL, "custom2");
        RNA_def_property_ui_text(prop, "Distance", "Distance to grow/shrink (number of iterations)");
+       RNA_def_property_update(prop, 0, "rna_Node_update");
 }
 
 static void def_cmp_scale(StructRNA *srna)
@@ -742,6 +856,7 @@ static void def_cmp_scale(StructRNA *srna)
        RNA_def_property_enum_sdna(prop, NULL, "custom1");
        RNA_def_property_enum_items(prop, space_items);
        RNA_def_property_ui_text(prop, "Space", "Coordinate space to scale relative to");
+       RNA_def_property_update(prop, 0, "rna_Node_update");
 }
 
 static void def_cmp_diff_matte(StructRNA *srna)
@@ -756,11 +871,13 @@ static void def_cmp_diff_matte(StructRNA *srna)
        RNA_def_property_float_sdna(prop, NULL, "t1");
        RNA_def_property_range(prop, 0.0f, 1.0f);
        RNA_def_property_ui_text(prop, "Tolerance", "Color distances below this threshold are keyed.");
+       RNA_def_property_update(prop, 0, "rna_Node_update");
        
        prop = RNA_def_property(srna, "falloff", PROP_FLOAT, PROP_NONE);
        RNA_def_property_float_sdna(prop, NULL, "t2");
        RNA_def_property_range(prop, 0.0f, 1.0f);
        RNA_def_property_ui_text(prop, "Falloff", "Color distances below this additional threshold are partially keyed.");
+       RNA_def_property_update(prop, 0, "rna_Node_update");
 }
 
 static void def_cmp_color_matte(StructRNA *srna)
@@ -775,16 +892,19 @@ static void def_cmp_color_matte(StructRNA *srna)
        RNA_def_property_float_sdna(prop, NULL, "t1");
        RNA_def_property_range(prop, 0.0f, 1.0f);
        RNA_def_property_ui_text(prop, "H", "Hue tolerance for colors to be considered a keying color");
+       RNA_def_property_update(prop, 0, "rna_Node_update");
        
        prop = RNA_def_property(srna, "s", PROP_FLOAT, PROP_NONE);
        RNA_def_property_float_sdna(prop, NULL, "t2");
        RNA_def_property_range(prop, 0.0f, 1.0f);
        RNA_def_property_ui_text(prop, "S", "Saturation Tolerance for the color");
+       RNA_def_property_update(prop, 0, "rna_Node_update");
        
        prop = RNA_def_property(srna, "v", PROP_FLOAT, PROP_NONE);
        RNA_def_property_float_sdna(prop, NULL, "t3");
        RNA_def_property_range(prop, 0.0f, 1.0f);
        RNA_def_property_ui_text(prop, "V", "Value Tolerance for the color");
+       RNA_def_property_update(prop, 0, "rna_Node_update");
 }
 
 static void def_cmp_distance_matte(StructRNA *srna)
@@ -799,11 +919,13 @@ static void def_cmp_distance_matte(StructRNA *srna)
        RNA_def_property_float_sdna(prop, NULL, "t1");
        RNA_def_property_range(prop, 0.0f, 1.0f);
        RNA_def_property_ui_text(prop, "Tolerance", "Color distances below this threshold are keyed.");
+       RNA_def_property_update(prop, 0, "rna_Node_update");
        
        prop = RNA_def_property(srna, "falloff", PROP_FLOAT, PROP_NONE);
        RNA_def_property_float_sdna(prop, NULL, "t2");
        RNA_def_property_range(prop, 0.0f, 1.0f);
        RNA_def_property_ui_text(prop, "Falloff", "Color distances below this additional threshold are partially keyed.");
+       RNA_def_property_update(prop, 0, "rna_Node_update");
 }
 
 static void def_cmp_color_spill(StructRNA *srna)
@@ -821,6 +943,7 @@ static void def_cmp_color_spill(StructRNA *srna)
        RNA_def_property_enum_sdna(prop, NULL, "custom1");
        RNA_def_property_enum_items(prop, channel_items);
        RNA_def_property_ui_text(prop, "Channel", "");
+       RNA_def_property_update(prop, 0, "rna_Node_update");
        
        RNA_def_struct_sdna_from(srna, "NodeChroma", "storage");
        
@@ -828,6 +951,7 @@ static void def_cmp_color_spill(StructRNA *srna)
        RNA_def_property_float_sdna(prop, NULL, "t1");
        RNA_def_property_range(prop, 0.0f, 0.5f);
        RNA_def_property_ui_text(prop, "Amount", "How much the selected channel is affected by");
+       RNA_def_property_update(prop, 0, "rna_Node_update");
 }
 
 static void def_cmp_chroma_matte(StructRNA *srna)
@@ -840,26 +964,31 @@ static void def_cmp_chroma_matte(StructRNA *srna)
        RNA_def_property_float_sdna(prop, NULL, "t1");
        RNA_def_property_range(prop, 1.0f, 80.0f);
        RNA_def_property_ui_text(prop, "Acceptance", "Tolerance for a color to be considered a keying color");
+       RNA_def_property_update(prop, 0, "rna_Node_update");
        
        prop = RNA_def_property(srna, "cutoff", PROP_FLOAT, PROP_NONE);
        RNA_def_property_float_sdna(prop, NULL, "t2");
        RNA_def_property_range(prop, 0.0f, 30.0f);
        RNA_def_property_ui_text(prop, "Cutoff", "Tolerance below which colors will be considered as exact matches");
+       RNA_def_property_update(prop, 0, "rna_Node_update");
 
        prop = RNA_def_property(srna, "lift", PROP_FLOAT, PROP_NONE);
        RNA_def_property_float_sdna(prop, NULL, "fsize");
        RNA_def_property_range(prop, 0.0f, 1.0f);
        RNA_def_property_ui_text(prop, "Lift", "Alpha lift");
+       RNA_def_property_update(prop, 0, "rna_Node_update");
        
        prop = RNA_def_property(srna, "gain", PROP_FLOAT, PROP_NONE);
        RNA_def_property_float_sdna(prop, NULL, "fstrength");
        RNA_def_property_range(prop, 0.0f, 1.0f);
        RNA_def_property_ui_text(prop, "Gain", "Alpha gain");
+       RNA_def_property_update(prop, 0, "rna_Node_update");
        
        prop = RNA_def_property(srna, "shadow_adjust", PROP_FLOAT, PROP_NONE);
        RNA_def_property_float_sdna(prop, NULL, "t3");
        RNA_def_property_range(prop, 0.0f, 1.0f);
        RNA_def_property_ui_text(prop, "Shadow Adjust", "Adjusts the brightness of any shadows captured");
+       RNA_def_property_update(prop, 0, "rna_Node_update");
        
        /* TODO: 
                if(c->t2 > c->t1)
@@ -883,10 +1012,12 @@ static void def_cmp_channel_matte(StructRNA *srna)
        RNA_def_property_enum_sdna(prop, NULL, "custom1");
        RNA_def_property_enum_items(prop, color_space_items);
        RNA_def_property_ui_text(prop, "Color Space", "");
+       RNA_def_property_update(prop, 0, "rna_Node_update");
        
        /* TODO: channel must be 1, 2 or 3 */
        prop = RNA_def_property(srna, "channel", PROP_INT, PROP_NONE);
        RNA_def_property_int_sdna(prop, NULL, "custom2");
+       RNA_def_property_update(prop, 0, "rna_Node_update");
        RNA_def_property_ui_text(prop, "Channel", "");
        
        RNA_def_struct_sdna_from(srna, "NodeChroma", "storage");
@@ -895,11 +1026,13 @@ static void def_cmp_channel_matte(StructRNA *srna)
        RNA_def_property_float_sdna(prop, NULL, "t1");
        RNA_def_property_range(prop, 0.0f, 1.0f);
        RNA_def_property_ui_text(prop, "High", "Values higher than this setting are 100% opaque");
+       RNA_def_property_update(prop, 0, "rna_Node_update");
        
        prop = RNA_def_property(srna, "low", PROP_FLOAT, PROP_NONE);
        RNA_def_property_float_sdna(prop, NULL, "t2");
        RNA_def_property_range(prop, 0.0f, 1.0f);
        RNA_def_property_ui_text(prop, "Low", "Values lower than this setting are 100% keyed");
+       RNA_def_property_update(prop, 0, "rna_Node_update");
        
        /* TODO:
                if(c->t2 > c->t1)
@@ -911,17 +1044,11 @@ static void def_cmp_flip(StructRNA *srna)
 {
        PropertyRNA *prop;
        
-       static EnumPropertyItem axis_items[] = {
-               {0, "X",  0, "X",     ""},
-               {1, "Y",  0, "Y",     ""},
-               {2, "XY", 0, "X & Y", ""},
-               {0, NULL, 0, NULL, NULL}
-       };
-       
        prop = RNA_def_property(srna, "axis", PROP_ENUM, PROP_NONE);
        RNA_def_property_enum_sdna(prop, NULL, "custom1");
-       RNA_def_property_enum_items(prop, axis_items);
+       RNA_def_property_enum_items(prop, node_flip_items);
        RNA_def_property_ui_text(prop, "Axis", "");
+       RNA_def_property_update(prop, 0, "rna_Node_update_name");
 }
 
 static void def_cmp_splitviewer(StructRNA *srna)
@@ -938,12 +1065,14 @@ static void def_cmp_splitviewer(StructRNA *srna)
        RNA_def_property_enum_sdna(prop, NULL, "custom2");
        RNA_def_property_enum_items(prop, axis_items);
        RNA_def_property_ui_text(prop, "Axis", "");
+       RNA_def_property_update(prop, 0, "rna_Node_update");
        
        /* TODO: percentage */
        prop = RNA_def_property(srna, "factor", PROP_FLOAT, PROP_PERCENTAGE);
        RNA_def_property_float_sdna(prop, NULL, "custom1");
        RNA_def_property_range(prop, 0.0f, 100.0f);
        RNA_def_property_ui_text(prop, "Factor", "");
+       RNA_def_property_update(prop, 0, "rna_Node_update");
 }
 
 static void def_cmp_id_mask(StructRNA *srna)
@@ -954,6 +1083,7 @@ static void def_cmp_id_mask(StructRNA *srna)
        RNA_def_property_int_sdna(prop, NULL, "custom1");
        RNA_def_property_range(prop, 0, 10000);
        RNA_def_property_ui_text(prop, "Index", "Pass index number to convert to alpha");
+       RNA_def_property_update(prop, 0, "rna_Node_update");
 }
 
 static void def_cmp_map_uv(StructRNA *srna)
@@ -965,6 +1095,7 @@ static void def_cmp_map_uv(StructRNA *srna)
        RNA_def_property_int_sdna(prop, NULL, "custom1");
        RNA_def_property_range(prop, 0, 100);
        RNA_def_property_ui_text(prop, "Alpha", "");
+       RNA_def_property_update(prop, 0, "rna_Node_update");
 }
 
 static void def_cmp_defocus(StructRNA *srna)
@@ -988,50 +1119,60 @@ static void def_cmp_defocus(StructRNA *srna)
        RNA_def_property_enum_sdna(prop, NULL, "bktype");
        RNA_def_property_enum_items(prop, bokeh_items);
        RNA_def_property_ui_text(prop, "Bokeh Type", "");
+       RNA_def_property_update(prop, 0, "rna_Node_update");
 
        /* TODO: angle in degrees */            
        prop = RNA_def_property(srna, "angle", PROP_INT, PROP_NONE);
        RNA_def_property_int_sdna(prop, NULL, "rotation");
        RNA_def_property_range(prop, 0, 90);
        RNA_def_property_ui_text(prop, "Angle", "Bokeh shape rotation offset in degrees");
+       RNA_def_property_update(prop, 0, "rna_Node_update");
        
        prop = RNA_def_property(srna, "gamma_correction", PROP_BOOLEAN, PROP_NONE);
        RNA_def_property_boolean_sdna(prop, NULL, "gamco", 1);
        RNA_def_property_ui_text(prop, "Gamma Correction", "Enable gamma correction before and after main process");
+       RNA_def_property_update(prop, 0, "rna_Node_update");
 
        /* TODO */
        prop = RNA_def_property(srna, "f_stop", PROP_FLOAT, PROP_NONE);
        RNA_def_property_float_sdna(prop, NULL, "fstop");
        RNA_def_property_range(prop, 0.0f, 128.0f);
        RNA_def_property_ui_text(prop, "fStop", "Amount of focal blur, 128=infinity=perfect focus, half the value doubles the blur radius");
+       RNA_def_property_update(prop, 0, "rna_Node_update");
        
        prop = RNA_def_property(srna, "max_blur", PROP_FLOAT, PROP_NONE);
        RNA_def_property_float_sdna(prop, NULL, "maxblur");
        RNA_def_property_range(prop, 0.0f, 10000.0f);
        RNA_def_property_ui_text(prop, "Max Blur", "blur limit, maximum CoC radius, 0=no limit");
+       RNA_def_property_update(prop, 0, "rna_Node_update");
        
        prop = RNA_def_property(srna, "threshold", PROP_FLOAT, PROP_NONE);
        RNA_def_property_float_sdna(prop, NULL, "bthresh");
        RNA_def_property_range(prop, 0.0f, 100.0f);
        RNA_def_property_ui_text(prop, "Threshold", "CoC radius threshold, prevents background bleed on in-focus midground, 0=off");
+       RNA_def_property_update(prop, 0, "rna_Node_update");
        
        prop = RNA_def_property(srna, "preview", PROP_BOOLEAN, PROP_NONE);
        RNA_def_property_boolean_sdna(prop, NULL, "preview", 1);
        RNA_def_property_ui_text(prop, "Preview", "Enable sampling mode, useful for preview when using low samplecounts");
+       RNA_def_property_update(prop, 0, "rna_Node_update");
        
        prop = RNA_def_property(srna, "samples", PROP_INT, PROP_NONE);
        RNA_def_property_int_sdna(prop, NULL, "samples");
        RNA_def_property_range(prop, 16, 256);
        RNA_def_property_ui_text(prop, "Samples", "Number of samples (16=grainy, higher=less noise)");
+       RNA_def_property_update(prop, 0, "rna_Node_update");
        
        prop = RNA_def_property(srna, "use_zbuffer", PROP_BOOLEAN, PROP_NONE);
        RNA_def_property_boolean_sdna(prop, NULL, "no_zbuf", 1);
        RNA_def_property_ui_text(prop, "Use Z-Buffer", "Disable when using an image as input instead of actual zbuffer (auto enabled if node not image based, eg. time node)");
+       RNA_def_property_update(prop, 0, "rna_Node_update");
        
        prop = RNA_def_property(srna, "z_scale", PROP_FLOAT, PROP_NONE);
        RNA_def_property_float_sdna(prop, NULL, "scale");
        RNA_def_property_range(prop, 0.0f, 1000.0f);
        RNA_def_property_ui_text(prop, "Z-Scale", "Scales the Z input when not using a zbuffer, controls maximum blur designated by the color white or input value 1");
+       RNA_def_property_update(prop, 0, "rna_Node_update");
 }
 
 static void def_cmp_luma_matte(StructRNA *srna)
@@ -1044,11 +1185,13 @@ static void def_cmp_luma_matte(StructRNA *srna)
        RNA_def_property_float_sdna(prop, NULL, "t1");
        RNA_def_property_range(prop, 0.0f, 1.0f);
        RNA_def_property_ui_text(prop, "High", "Values higher than this setting are 100% opaque");
+       RNA_def_property_update(prop, 0, "rna_Node_update");
        
        prop = RNA_def_property(srna, "low", PROP_FLOAT, PROP_NONE);
        RNA_def_property_float_sdna(prop, NULL, "t2");
        RNA_def_property_range(prop, 0.0f, 1.0f);
        RNA_def_property_ui_text(prop, "Low", "Values lower than this setting are 100% keyed");
+       RNA_def_property_update(prop, 0, "rna_Node_update");
        
        /* TODO: keep low less than high */
        
@@ -1061,10 +1204,12 @@ static void def_cmp_invert(StructRNA *srna)
        prop = RNA_def_property(srna, "rgb", PROP_BOOLEAN, PROP_NONE);
        RNA_def_property_boolean_sdna(prop, NULL, "custom1", CMP_CHAN_RGB);
        RNA_def_property_ui_text(prop, "RGB", "");
+       RNA_def_property_update(prop, 0, "rna_Node_update");
        
        prop = RNA_def_property(srna, "alpha", PROP_BOOLEAN, PROP_NONE);
        RNA_def_property_boolean_sdna(prop, NULL, "custom1", CMP_CHAN_A);
        RNA_def_property_ui_text(prop, "Alpha", "");
+       RNA_def_property_update(prop, 0, "rna_Node_update");
 }
 
 static void def_cmp_crop(StructRNA *srna)
@@ -1074,6 +1219,7 @@ static void def_cmp_crop(StructRNA *srna)
        prop = RNA_def_property(srna, "crop_size", PROP_BOOLEAN, PROP_NONE);
        RNA_def_property_boolean_sdna(prop, NULL, "custom1", 1);
        RNA_def_property_ui_text(prop, "Crop Image Size", "Whether to crop the size of the input image");
+       RNA_def_property_update(prop, 0, "rna_Node_update");
        
        RNA_def_struct_sdna_from(srna, "NodeTwoXYs", "storage");
 
@@ -1081,21 +1227,25 @@ static void def_cmp_crop(StructRNA *srna)
        RNA_def_property_int_sdna(prop, NULL, "x1");
        RNA_def_property_range(prop, 0, 10000);
        RNA_def_property_ui_text(prop, "X1", "");
+       RNA_def_property_update(prop, 0, "rna_Node_update");
        
        prop = RNA_def_property(srna, "x2", PROP_INT, PROP_NONE);
        RNA_def_property_int_sdna(prop, NULL, "x2");
        RNA_def_property_range(prop, 0, 10000);
        RNA_def_property_ui_text(prop, "X2", "");
+       RNA_def_property_update(prop, 0, "rna_Node_update");
        
        prop = RNA_def_property(srna, "y1", PROP_INT, PROP_NONE);
        RNA_def_property_int_sdna(prop, NULL, "y1");
        RNA_def_property_range(prop, 0, 10000);
        RNA_def_property_ui_text(prop, "Y1", "");
+       RNA_def_property_update(prop, 0, "rna_Node_update");
        
        prop = RNA_def_property(srna, "y2", PROP_INT, PROP_NONE);
        RNA_def_property_int_sdna(prop, NULL, "y2");
        RNA_def_property_range(prop, 0, 10000);
        RNA_def_property_ui_text(prop, "Y2", "");
+       RNA_def_property_update(prop, 0, "rna_Node_update");
 }
 
 static void def_cmp_dblur(StructRNA *srna)
@@ -1108,40 +1258,48 @@ static void def_cmp_dblur(StructRNA *srna)
        RNA_def_property_int_sdna(prop, NULL, "iter");
        RNA_def_property_range(prop, 1, 128);
        RNA_def_property_ui_text(prop, "Iterations", "");
+       RNA_def_property_update(prop, 0, "rna_Node_update");
        
        prop = RNA_def_property(srna, "wrap", PROP_BOOLEAN, PROP_NONE);
        RNA_def_property_boolean_sdna(prop, NULL, "wrap", 1);
        RNA_def_property_ui_text(prop, "Wrap", "");
+       RNA_def_property_update(prop, 0, "rna_Node_update");
        
        prop = RNA_def_property(srna, "center_x", PROP_FLOAT, PROP_NONE);
        RNA_def_property_float_sdna(prop, NULL, "center_x");
        RNA_def_property_range(prop, 0.0f, 1.0f);
        RNA_def_property_ui_text(prop, "Center X", "");
+       RNA_def_property_update(prop, 0, "rna_Node_update");
        
        prop = RNA_def_property(srna, "center_y", PROP_FLOAT, PROP_NONE);
        RNA_def_property_float_sdna(prop, NULL, "center_y");
        RNA_def_property_range(prop, 0.0f, 1.0f);
        RNA_def_property_ui_text(prop, "Center Y", "");
+       RNA_def_property_update(prop, 0, "rna_Node_update");
        
        prop = RNA_def_property(srna, "distance", PROP_FLOAT, PROP_NONE);
        RNA_def_property_float_sdna(prop, NULL, "distance");
        RNA_def_property_range(prop, -1.0f, 1.0f);
        RNA_def_property_ui_text(prop, "Distance", "");
+       RNA_def_property_update(prop, 0, "rna_Node_update");
        
        prop = RNA_def_property(srna, "angle", PROP_FLOAT, PROP_NONE);
        RNA_def_property_float_sdna(prop, NULL, "angle");
        RNA_def_property_range(prop, 0.0f, 360.0f);
        RNA_def_property_ui_text(prop, "Angle", "");
+       RNA_def_property_update(prop, 0, "rna_Node_update");
        
        prop = RNA_def_property(srna, "spin", PROP_FLOAT, PROP_NONE);
        RNA_def_property_float_sdna(prop, NULL, "spin");
        RNA_def_property_range(prop, -360.0f, 360.0f);
        RNA_def_property_ui_text(prop, "Spin", "");
+       RNA_def_property_update(prop, 0, "rna_Node_update");
        
        prop = RNA_def_property(srna, "zoom", PROP_FLOAT, PROP_NONE);
        RNA_def_property_float_sdna(prop, NULL, "zoom");
        RNA_def_property_range(prop, 0.0f, 100.0f);
        RNA_def_property_ui_text(prop, "Zoom", "");
+       RNA_def_property_update(prop, 0, "rna_Node_update");
 }
 
 static void def_cmp_bilateral_blur(StructRNA *srna)
@@ -1154,16 +1312,19 @@ static void def_cmp_bilateral_blur(StructRNA *srna)
        RNA_def_property_int_sdna(prop, NULL, "iter");
        RNA_def_property_range(prop, 1, 128);
        RNA_def_property_ui_text(prop, "Iterations", "");
+       RNA_def_property_update(prop, 0, "rna_Node_update");
        
        prop = RNA_def_property(srna, "sigma_color", PROP_FLOAT, PROP_NONE);
        RNA_def_property_float_sdna(prop, NULL, "sigma_color");
        RNA_def_property_range(prop, 0.01f, 3.0f);
        RNA_def_property_ui_text(prop, "Color Sigma", "");
+       RNA_def_property_update(prop, 0, "rna_Node_update");
        
        prop = RNA_def_property(srna, "sigma_space", PROP_FLOAT, PROP_NONE);
        RNA_def_property_float_sdna(prop, NULL, "sigma_space");
        RNA_def_property_range(prop, 0.01f, 30.0f);
        RNA_def_property_ui_text(prop, "Space Sigma", "");      
+       RNA_def_property_update(prop, 0, "rna_Node_update");
 }
 
 static void def_cmp_premul_key(StructRNA *srna)
@@ -1180,6 +1341,7 @@ static void def_cmp_premul_key(StructRNA *srna)
        RNA_def_property_enum_sdna(prop, NULL, "custom1");
        RNA_def_property_enum_items(prop, type_items);
        RNA_def_property_ui_text(prop, "Mapping", "Conversion between premultiplied alpha and key alpha");
+       RNA_def_property_update(prop, 0, "rna_Node_update");
        
 }
 
@@ -1208,55 +1370,66 @@ static void def_cmp_glare(StructRNA *srna)
        RNA_def_property_enum_sdna(prop, NULL, "type");
        RNA_def_property_enum_items(prop, type_items);
        RNA_def_property_ui_text(prop, "Glare Type", "");
+       RNA_def_property_update(prop, 0, "rna_Node_update");
        
        prop = RNA_def_property(srna, "quality", PROP_ENUM, PROP_NONE);
        RNA_def_property_enum_sdna(prop, NULL, "quality");
        RNA_def_property_enum_items(prop, type_items);
        RNA_def_property_ui_text(prop, "Quality", "If not set to high quality, the effect will be applied to a low-res copy of the source image");
+       RNA_def_property_update(prop, 0, "rna_Node_update");
        
        prop = RNA_def_property(srna, "iterations", PROP_INT, PROP_NONE);
        RNA_def_property_int_sdna(prop, NULL, "iter");
        RNA_def_property_range(prop, 2, 5);
        RNA_def_property_ui_text(prop, "Iterations", "");
+       RNA_def_property_update(prop, 0, "rna_Node_update");
        
        prop = RNA_def_property(srna, "color_modulation", PROP_FLOAT, PROP_NONE);
        RNA_def_property_float_sdna(prop, NULL, "colmod");
        RNA_def_property_range(prop, 0.0f, 1.0f);
        RNA_def_property_ui_text(prop, "Color Modulation", "");
+       RNA_def_property_update(prop, 0, "rna_Node_update");
        
        prop = RNA_def_property(srna, "mix", PROP_FLOAT, PROP_NONE);
        RNA_def_property_float_sdna(prop, NULL, "mix");
        RNA_def_property_range(prop, -1.0f, 1.0f);
        RNA_def_property_ui_text(prop, "Mix", "-1 is original image only, 0 is exact 50/50 mix, 1 is processed image only");
+       RNA_def_property_update(prop, 0, "rna_Node_update");
        
        prop = RNA_def_property(srna, "threshold", PROP_FLOAT, PROP_NONE);
        RNA_def_property_float_sdna(prop, NULL, "threshold");
        RNA_def_property_range(prop, 0.0f, 1000.0f);
        RNA_def_property_ui_text(prop, "Threshold", "The glare filter will only be applied to pixels brighter than this value");
+       RNA_def_property_update(prop, 0, "rna_Node_update");
        
        prop = RNA_def_property(srna, "streaks", PROP_INT, PROP_NONE);
        RNA_def_property_int_sdna(prop, NULL, "angle");
        RNA_def_property_range(prop, 2, 16);
        RNA_def_property_ui_text(prop, "Streaks", "Total number of streaks");
+       RNA_def_property_update(prop, 0, "rna_Node_update");
        
        prop = RNA_def_property(srna, "angle_offset", PROP_FLOAT, PROP_NONE);
        RNA_def_property_float_sdna(prop, NULL, "angle_ofs");
        RNA_def_property_range(prop, 0.0f, 180.0f);
        RNA_def_property_ui_text(prop, "Angle Offset", "Streak angle offset in degrees");
+       RNA_def_property_update(prop, 0, "rna_Node_update");
        
        prop = RNA_def_property(srna, "fade", PROP_FLOAT, PROP_NONE);
        RNA_def_property_float_sdna(prop, NULL, "fade");
        RNA_def_property_range(prop, 0.75f, 1.0f);
        RNA_def_property_ui_text(prop, "Fade", "Streak fade-out factor");
+       RNA_def_property_update(prop, 0, "rna_Node_update");
        
        prop = RNA_def_property(srna, "rotate_45", PROP_BOOLEAN, PROP_NONE);
        RNA_def_property_boolean_sdna(prop, NULL, "angle", 1);
        RNA_def_property_ui_text(prop, "Rotate 45", "Simple star filter: add 45 degree rotation offset");
+       RNA_def_property_update(prop, 0, "rna_Node_update");
        
        prop = RNA_def_property(srna, "size", PROP_INT, PROP_NONE);
        RNA_def_property_int_sdna(prop, NULL, "size");
        RNA_def_property_range(prop, 6, 9);
        RNA_def_property_ui_text(prop, "Size", "Glow/glare size (not actual size; relative to initial size of bright area of pixels)");
+       RNA_def_property_update(prop, 0, "rna_Node_update");
        
        /* TODO */
 }
@@ -1277,6 +1450,7 @@ static void def_cmp_tonemap(StructRNA *srna)
        RNA_def_property_enum_sdna(prop, NULL, "type");
        RNA_def_property_enum_items(prop, type_items);
        RNA_def_property_ui_text(prop, "Tonemap Type", "");
+       RNA_def_property_update(prop, 0, "rna_Node_update");
        
        /* TODO: if type==0 { */
        
@@ -1284,16 +1458,19 @@ static void def_cmp_tonemap(StructRNA *srna)
        RNA_def_property_float_sdna(prop, NULL, "key");
        RNA_def_property_range(prop, 0.0f, 1.0f);
        RNA_def_property_ui_text(prop, "Key", "The value the average luminance is mapped to");
+       RNA_def_property_update(prop, 0, "rna_Node_update");
        
        prop = RNA_def_property(srna, "offset", PROP_FLOAT, PROP_NONE);
        RNA_def_property_float_sdna(prop, NULL, "offset");
        RNA_def_property_range(prop, 0.001f, 10.0f);
        RNA_def_property_ui_text(prop, "Offset", "Normally always 1, but can be used as an extra control to alter the brightness curve");
+       RNA_def_property_update(prop, 0, "rna_Node_update");
        
        prop = RNA_def_property(srna, "gamma", PROP_FLOAT, PROP_NONE);
        RNA_def_property_float_sdna(prop, NULL, "gamma");
        RNA_def_property_range(prop, 0.001f, 3.0f);
        RNA_def_property_ui_text(prop, "Gamma", "If not used, set to 1");
+       RNA_def_property_update(prop, 0, "rna_Node_update");
        
        /* TODO: } else { */
        
@@ -1301,21 +1478,25 @@ static void def_cmp_tonemap(StructRNA *srna)
        RNA_def_property_float_sdna(prop, NULL, "f");
        RNA_def_property_range(prop, -8.0f, 8.0f);
        RNA_def_property_ui_text(prop, "Intensity", "If less than zero, darkens image; otherwise, makes it brighter");
+       RNA_def_property_update(prop, 0, "rna_Node_update");
        
        prop = RNA_def_property(srna, "contrast", PROP_FLOAT, PROP_NONE);
        RNA_def_property_float_sdna(prop, NULL, "m");
        RNA_def_property_range(prop, 0.0f, 1.0f);
        RNA_def_property_ui_text(prop, "Contrast", "Set to 0 to use estimate from input image");
+       RNA_def_property_update(prop, 0, "rna_Node_update");
        
        prop = RNA_def_property(srna, "adaptation", PROP_FLOAT, PROP_NONE);
        RNA_def_property_float_sdna(prop, NULL, "a");
        RNA_def_property_range(prop, 0.0f, 1.0f);
        RNA_def_property_ui_text(prop, "Adaptation", "If 0, global; if 1, based on pixel intensity");
+       RNA_def_property_update(prop, 0, "rna_Node_update");
        
        prop = RNA_def_property(srna, "correction", PROP_FLOAT, PROP_NONE);
        RNA_def_property_float_sdna(prop, NULL, "c");
        RNA_def_property_range(prop, 0.0f, 1.0f);
        RNA_def_property_ui_text(prop, "Color Correction", "If 0, same for all channels; if 1, each independent");
+       RNA_def_property_update(prop, 0, "rna_Node_update");
 }
 
 static void def_cmp_lensdist(StructRNA *srna)
@@ -1327,16 +1508,19 @@ static void def_cmp_lensdist(StructRNA *srna)
        prop = RNA_def_property(srna, "projector", PROP_BOOLEAN, PROP_NONE);
        RNA_def_property_boolean_sdna(prop, NULL, "proj", 1);
        RNA_def_property_ui_text(prop, "Projector", "Enable/disable projector mode. Effect is applied in horizontal direction only.");
+       RNA_def_property_update(prop, 0, "rna_Node_update");
        
        /* TODO: if proj mode is off { */
        
        prop = RNA_def_property(srna, "jitter", PROP_BOOLEAN, PROP_NONE);
        RNA_def_property_boolean_sdna(prop, NULL, "jit", 1);
        RNA_def_property_ui_text(prop, "Jitter", "Enable/disable jittering; faster, but also noisier");
+       RNA_def_property_update(prop, 0, "rna_Node_update");
        
        prop = RNA_def_property(srna, "fit", PROP_BOOLEAN, PROP_NONE);
        RNA_def_property_boolean_sdna(prop, NULL, "fit", 1);
        RNA_def_property_ui_text(prop, "Fit", "For positive distortion factor only: scale image such that black areas are not visible");
+       RNA_def_property_update(prop, 0, "rna_Node_update");
 }
        
 
@@ -1352,6 +1536,7 @@ static void def_tex_output(StructRNA *srna)
        prop = RNA_def_property(srna, "output_name", PROP_STRING, PROP_NONE);
        RNA_def_property_string_sdna(prop, NULL, "name");
        RNA_def_property_ui_text(prop, "Output Name", "");
+       RNA_def_property_update(prop, 0, "rna_Node_update");
 }
 
 static void def_tex_image(StructRNA *srna)
@@ -1362,6 +1547,7 @@ static void def_tex_image(StructRNA *srna)
        RNA_def_property_pointer_sdna(prop, NULL, "storage");
        RNA_def_property_struct_type(prop, "ImageUser");
        RNA_def_property_ui_text(prop, "Settings", "");
+       RNA_def_property_update(prop, 0, "rna_Node_update");
 }
 
 static void def_tex_bricks(StructRNA *srna)
@@ -1372,21 +1558,25 @@ static void def_tex_bricks(StructRNA *srna)
        RNA_def_property_float_sdna(prop, NULL, "custom3");
        RNA_def_property_range(prop, 0.0f, 1.0f);
        RNA_def_property_ui_text(prop, "Offset Amount", "");
+       RNA_def_property_update(prop, 0, "rna_Node_update");
        
        prop = RNA_def_property(srna, "offset_frequency", PROP_INT, PROP_NONE);
        RNA_def_property_int_sdna(prop, NULL, "custom1");
        RNA_def_property_range(prop, 2, 99);
        RNA_def_property_ui_text(prop, "Offset Frequency", "Offset every N rows");
+       RNA_def_property_update(prop, 0, "rna_Node_update");
        
        prop = RNA_def_property(srna, "squash", PROP_FLOAT, PROP_NONE);
        RNA_def_property_float_sdna(prop, NULL, "custom4");
        RNA_def_property_range(prop, 0.0f, 99.0f);
        RNA_def_property_ui_text(prop, "Squash Amount", "");
+       RNA_def_property_update(prop, 0, "rna_Node_update");
        
        prop = RNA_def_property(srna, "squash_frequency", PROP_INT, PROP_NONE);
        RNA_def_property_int_sdna(prop, NULL, "custom2");
        RNA_def_property_range(prop, 2, 99);
        RNA_def_property_ui_text(prop, "Squash Frequency", "Squash every N rows");
+       RNA_def_property_update(prop, 0, "rna_Node_update");
 }
 
 /* -------------------------------------------------------------------------- */
index c1585a71ac12e2312311421946d4624fe253161e..4c32f86e501302535eb54e7a7ef5edf0c120bafb 100644 (file)
@@ -95,6 +95,7 @@ char *ED_info_stats_string(struct Scene *scene){return NULL;}
 void ED_area_tag_redraw(struct ScrArea *sa){}
 void WM_event_add_fileselect(struct bContext *C, struct wmOperator *op){}
 void ED_node_texture_default(struct Tex *tx){}
+void ED_node_changed_update(struct bContext *C, struct bNode *node);
 int text_file_modified(struct Text *text){return 0;}
 void ED_node_shader_default(struct Material *ma){}
 void ED_screen_animation_timer_update(struct bContext *C, int redraws){}