diff options
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/editors/space_buttons/space_buttons.c | 4 | ||||
-rw-r--r-- | source/blender/editors/space_node/node_edit.c | 10 | ||||
-rw-r--r-- | source/blender/editors/space_node/node_header.c | 28 | ||||
-rw-r--r-- | source/blender/editors/space_node/node_select.c | 7 | ||||
-rw-r--r-- | source/blender/editors/space_node/space_node.c | 18 |
5 files changed, 37 insertions, 30 deletions
diff --git a/source/blender/editors/space_buttons/space_buttons.c b/source/blender/editors/space_buttons/space_buttons.c index 87c50936f90..90e11e6dc37 100644 --- a/source/blender/editors/space_buttons/space_buttons.c +++ b/source/blender/editors/space_buttons/space_buttons.c @@ -347,6 +347,10 @@ static void buttons_area_listener(ScrArea *sa, wmNotifier *wmn) break; } break; + case NC_NODE: + if(wmn->action==NA_SELECTED) + ED_area_tag_redraw(sa); + break; /* Listener for preview render, when doing an global undo. */ case NC_WINDOW: ED_area_tag_redraw(sa); diff --git a/source/blender/editors/space_node/node_edit.c b/source/blender/editors/space_node/node_edit.c index 7db20966a8b..ead3eccd16c 100644 --- a/source/blender/editors/space_node/node_edit.c +++ b/source/blender/editors/space_node/node_edit.c @@ -211,6 +211,8 @@ bNode *editnode_get_active(bNodeTree *ntree) void snode_notify(bContext *C, SpaceNode *snode) { + WM_event_add_notifier(C, NC_NODE|NA_EDITED, NULL); + if(snode->treetype==NTREE_SHADER) WM_event_add_notifier(C, NC_MATERIAL|ND_NODES, snode->id); else if(snode->treetype==NTREE_COMPOSIT) @@ -1464,7 +1466,7 @@ bNode *node_add_node(SpaceNode *snode, Scene *scene, int type, float locx, float /* generics */ if(node) { node->locx= locx; - node->locy= locy + 60.0f; // arbitrary.. so its visible + node->locy= locy + 60.0f; // arbitrary.. so its visible, (0,0) is top of node node->flag |= SELECT; gnode= node_tree_get_editgroup(snode->nodetree); @@ -1515,6 +1517,12 @@ static int node_duplicate_exec(bContext *C, wmOperator *UNUSED(op)) ntreeCopyTree(snode->edittree, 1); /* 1 == internally selected nodes */ + /* to ensure redraws or rerenders happen */ + for(node= snode->edittree->nodes.first; node; node= node->next) + if(node->flag & SELECT) + if(node->id) + ED_node_changed_update(node->id, node); + ntreeSolveOrder(snode->edittree); node_tree_verify_groups(snode->nodetree); snode_notify(C, snode); diff --git a/source/blender/editors/space_node/node_header.c b/source/blender/editors/space_node/node_header.c index 1ad5954b56e..d215dc53b84 100644 --- a/source/blender/editors/space_node/node_header.c +++ b/source/blender/editors/space_node/node_header.c @@ -58,8 +58,22 @@ static void do_node_add(bContext *C, void *UNUSED(arg), int event) { SpaceNode *snode= CTX_wm_space_node(C); + ScrArea *sa= CTX_wm_area(C); + ARegion *ar; bNode *node; + /* get location to add node at mouse */ + for(ar=sa->regionbase.first; ar; ar=ar->next) { + if(ar->regiontype == RGN_TYPE_WINDOW) { + wmWindow *win= CTX_wm_window(C); + int x= win->eventstate->x - ar->winrct.xmin; + int y= win->eventstate->y - ar->winrct.ymin; + + if(y < 60) y+= 60; + UI_view2d_region_to_view(&ar->v2d, x, y, &snode->mx, &snode->my); + } + } + /* store selection in temp test flag */ for(node= snode->edittree->nodes.first; node; node= node->next) { if(node->flag & NODE_SELECT) node->flag |= NODE_TEST; @@ -152,20 +166,8 @@ static void node_auto_add_menu(bContext *C, uiLayout *layout, void *arg_nodeclas static void node_menu_add(const bContext *C, Menu *menu) { - uiLayout *layout= menu->layout; SpaceNode *snode= CTX_wm_space_node(C); - ScrArea *sa= CTX_wm_area(C); - ARegion *ar; - - /* get location to add node at mouse */ - for(ar=sa->regionbase.first; ar; ar=ar->next) { - if(ar->regiontype == RGN_TYPE_WINDOW) { - wmWindow *win= CTX_wm_window(C); - UI_view2d_region_to_view(&ar->v2d, - win->eventstate->x - ar->winrct.xmin, win->eventstate->y - ar->winrct.ymin, - &snode->mx, &snode->my); - } - } + uiLayout *layout= menu->layout; if(!snode->nodetree) uiLayoutSetActive(layout, 0); diff --git a/source/blender/editors/space_node/node_select.c b/source/blender/editors/space_node/node_select.c index e07eaa85bed..617397359d9 100644 --- a/source/blender/editors/space_node/node_select.c +++ b/source/blender/editors/space_node/node_select.c @@ -108,13 +108,6 @@ static int node_select_exec(bContext *C, wmOperator *op) /* perform the select */ node= node_mouse_select(snode, ar, mval, extend); - - /* WATCH THIS, there are a few other ways to change the active material */ - if(node) { - if (node->id && ELEM(GS(node->id->name), ID_MA, ID_TE)) { - WM_event_add_notifier(C, NC_MATERIAL|ND_SHADING_DRAW, node->id); - } - } /* send notifiers */ WM_event_add_notifier(C, NC_NODE|NA_SELECTED, NULL); diff --git a/source/blender/editors/space_node/space_node.c b/source/blender/editors/space_node/space_node.c index d38e2af734b..d2e6bca8eb4 100644 --- a/source/blender/editors/space_node/space_node.c +++ b/source/blender/editors/space_node/space_node.c @@ -118,15 +118,15 @@ static SpaceLink *node_new(const bContext *UNUSED(C)) BLI_addtail(&snode->regionbase, ar); ar->regiontype= RGN_TYPE_WINDOW; - ar->v2d.tot.xmin= -10.0f; - ar->v2d.tot.ymin= -10.0f; - ar->v2d.tot.xmax= 512.0f; - ar->v2d.tot.ymax= 512.0f; - - ar->v2d.cur.xmin= 0.0f; - ar->v2d.cur.ymin= 0.0f; - ar->v2d.cur.xmax= 512.0f; - ar->v2d.cur.ymax= 512.0f; + ar->v2d.tot.xmin= -256.0f; + ar->v2d.tot.ymin= -256.0f; + ar->v2d.tot.xmax= 768.0f; + ar->v2d.tot.ymax= 768.0f; + + ar->v2d.cur.xmin= -256.0f; + ar->v2d.cur.ymin= -256.0f; + ar->v2d.cur.xmax= 768.0f; + ar->v2d.cur.ymax= 768.0f; ar->v2d.min[0]= 1.0f; ar->v2d.min[1]= 1.0f; |