Fix #24556: N Panel in Compositor doesn't work with Vector Normal node.
authorBrecht Van Lommel <brechtvanlommel@pandora.be>
Sat, 6 Nov 2010 17:55:43 +0000 (17:55 +0000)
committerBrecht Van Lommel <brechtvanlommel@pandora.be>
Sat, 6 Nov 2010 17:55:43 +0000 (17:55 +0000)
source/blender/editors/space_node/drawnode.c

index c34ade4f5e21d00f51d37e1badae1f721b5e0365..62936059609f0e9445c31f67901d158988f08a24 100644 (file)
@@ -58,6 +58,8 @@
 
 #include "RNA_access.h"
 
+#include "ED_node.h"
+
 #include "WM_api.h"
 #include "WM_types.h"
 
@@ -169,16 +171,27 @@ static void node_buts_curvecol(uiLayout *layout, bContext *UNUSED(C), PointerRNA
        uiTemplateCurveMapping(layout, ptr, "mapping", 'c', 0, 0);
 }
 
+static void node_normal_cb(bContext *C, void *ntree_v, void *node_v)
+{
+       Main *bmain = CTX_data_main(C);
+
+       ED_node_generic_update(bmain, ntree_v, node_v);
+       WM_event_add_notifier(C, NC_NODE|NA_EDITED, ntree_v);
+}
+
 static void node_buts_normal(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
 {
        uiBlock *block= uiLayoutAbsoluteBlock(layout);
+       bNodeTree *ntree= ptr->id.data;
        bNode *node= ptr->data;
        rctf *butr= &node->butr;
        bNodeSocket *sock= node->outputs.first;         /* first socket stores normal */
+       uiBut *bt;
        
-       uiDefButF(block, BUT_NORMAL, B_NODE_EXEC, "", 
+       bt= 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, "");
+       uiButSetFunc(bt, node_normal_cb, ntree, node);
 }
 #if 0 // not used in 2.5x yet
 static void node_browse_tex_cb(bContext *C, void *ntree_v, void *node_v)