Todo items:
authorTon Roosendaal <ton@blender.org>
Mon, 3 Jan 2011 14:36:44 +0000 (14:36 +0000)
committerTon Roosendaal <ton@blender.org>
Mon, 3 Jan 2011 14:36:44 +0000 (14:36 +0000)
- New Node editor now opens with larger view, the default
  was like zoomed in factor 2.
- Add node via menu now shows new node more visible
- Click on (material) node now doesn't re-render the entire
  tree anymore, much nicer.
- Duplicate node creates preview image immediate

source/blender/editors/space_buttons/space_buttons.c
source/blender/editors/space_node/node_edit.c
source/blender/editors/space_node/node_header.c
source/blender/editors/space_node/node_select.c
source/blender/editors/space_node/space_node.c

index 87c50936f90c133174eb6138c9e28918d7d0bf66..90e11e6dc3712fc1bd5cdcef83d43b4e9861365d 100644 (file)
@@ -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);
index 7db20966a8b656aa94e0a48bbb33f3e3c54b9cdb..ead3eccd16cae39a8f9f8afd38744ecc89a4b50b 100644 (file)
@@ -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);
index 1ad5954b56eff256e2ad1220541775c92a7349ab..d215dc53b84a6d0dd1e8342f3fc16e31689f1606 100644 (file)
 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);
index e07eaa85bedd0e8aa154ea0032d3d88fa75698c2..617397359d9bb34d571d91b80f35e1d87ec3692e 100644 (file)
@@ -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);
index d38e2af734b75242a1bd85c39fec0b5bc285df65..d2e6bca8eb4a86c7904b6a94d0e8f9930cf2c1bd 100644 (file)
@@ -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;