diff --git a/source/blender/editors/space_node/node_buttons.c b/source/blender/editors/space_node/node_buttons.c index 63361f2be66..20650812d52 100644 --- a/source/blender/editors/space_node/node_buttons.c +++ b/source/blender/editors/space_node/node_buttons.c @@ -49,6 +49,7 @@ #include "BKE_depsgraph.h" #include "BKE_idprop.h" #include "BKE_object.h" +#include "BKE_node.h" #include "BKE_global.h" #include "BKE_scene.h" #include "BKE_screen.h" @@ -78,7 +79,6 @@ #define B_NOP 1 #define B_REDR 2 -#if 0 // XXX not used... static void do_node_region_buttons(bContext *C, void *arg, int event) { //SpaceNode *snode= CTX_wm_space_node(C); @@ -89,7 +89,44 @@ static void do_node_region_buttons(bContext *C, void *arg, int event) return; /* no notifier! */ } } -#endif + +/* poll callback for active node */ +static int active_node_poll(const bContext *C, PanelType *pt) +{ + SpaceNode *snode= CTX_wm_space_node(C); + + // TODO: include check for whether there is an active node... + return (snode && snode->nodetree); +} + +/* active node */ +static void active_node_panel(const bContext *C, Panel *pa) +{ + SpaceNode *snode= CTX_wm_space_node(C); + bNodeTree *ntree= (snode) ? snode->nodetree : NULL; // XXX what's up with edittree then? + bNode *node = (ntree) ? nodeGetActive(ntree) : NULL; + uiLayout *layout= pa->layout; + uiBlock *block; + PointerRNA ptr; + + /* verify pointers, and create RNA pointer for the node */ + if ELEM(NULL, ntree, node) + return; + RNA_pointer_create(&ntree->id, &RNA_Node, node, &ptr); + + /* set update callback */ + // xxx is this really needed + block= uiLayoutGetBlock(layout); + uiBlockSetHandleFunc(block, do_node_region_buttons, NULL); + + /* draw this node's name, etc. */ + uiItemR(layout, NULL, ICON_NODE, &ptr, "name", 0); + // TODO: a separator would be nice... + + /* draw this node's settings */ + if (node->typeinfo && node->typeinfo->uifunc) + node->typeinfo->uifunc(layout, (bContext *)C, &ptr); +} /* ******************* node buttons registration ************** */ @@ -97,7 +134,12 @@ void node_buttons_register(ARegionType *art) { PanelType *pt; - // XXX active node + pt= MEM_callocN(sizeof(PanelType), "spacetype node panel active node"); + strcpy(pt->idname, "NODE_PT_item"); + strcpy(pt->label, "Active Node"); + pt->draw= active_node_panel; + pt->poll= active_node_poll; + BLI_addtail(&art->paneltypes, pt); pt= MEM_callocN(sizeof(PanelType), "spacetype node panel gpencil"); strcpy(pt->idname, "NODE_PT_gpencil"); diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_levels.c b/source/blender/nodes/intern/CMP_nodes/CMP_levels.c index f0e314793ed..9f845727ddd 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_levels.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_levels.c @@ -50,7 +50,7 @@ static void rgb_tobw(float r, float g, float b, float* out) static void fill_bins(bNode* node, CompBuf* in, int* bins) { float value[4]; - int ivalue; + int ivalue=0; int x,y; /*fill bins */ diff --git a/source/blender/python/intern/bpy_operator.c b/source/blender/python/intern/bpy_operator.c index 1ae0a40ce16..b1577969a22 100644 --- a/source/blender/python/intern/bpy_operator.c +++ b/source/blender/python/intern/bpy_operator.c @@ -153,7 +153,7 @@ static PyObject *pyop_as_string( PyObject * self, PyObject * args) int all_args = 1; int error_val= 0; - char *buf; + char *buf = NULL; PyObject *pybuf; bContext *C = BPy_GetContext(); diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c index 76a1b860520..d490debdce6 100644 --- a/source/blender/python/intern/bpy_rna.c +++ b/source/blender/python/intern/bpy_rna.c @@ -1757,7 +1757,7 @@ static int foreach_compat_buffer(RawPropertyType raw_type, int attr_signed, cons static PyObject *foreach_getset(BPy_PropertyRNA *self, PyObject *args, int set) { PyObject *item = NULL; - int i=0, ok, buffer_is_compat; + int i=0, ok=0, buffer_is_compat; void *array= NULL; /* get/set both take the same args currently */ diff --git a/source/blender/windowmanager/intern/wm_window.c b/source/blender/windowmanager/intern/wm_window.c index a4a22f347b7..dbc3d27be6a 100644 --- a/source/blender/windowmanager/intern/wm_window.c +++ b/source/blender/windowmanager/intern/wm_window.c @@ -985,4 +985,5 @@ void WM_cursor_warp(wmWindow *win, int x, int y) win->eventstate->prevx= oldx; win->eventstate->prevy= oldy; } -} \ No newline at end of file +} +