2.5
authorTon Roosendaal <ton@blender.org>
Fri, 6 Feb 2009 13:07:02 +0000 (13:07 +0000)
committerTon Roosendaal <ton@blender.org>
Fri, 6 Feb 2009 13:07:02 +0000 (13:07 +0000)
Compo node fixes:
- adding new composite in scene crashed, wrong pointers passed on to
  addnode function
- scene render-layer node now gets default scene ID pointer, which
  can be viewed/edited with menu in node
- on using headerbuttons in node window, display refreshes now

source/blender/editors/space_node/drawnode.c
source/blender/editors/space_node/node_edit.c
source/blender/editors/space_node/node_header.c

index a1a7a32bf283ce5e2d11121a368deeef9b42f9bf..028cba327acf0ae23d7ac5e2bb6ca6a9e6e94d90 100644 (file)
@@ -1051,10 +1051,8 @@ static void node_browse_scene_cb(bContext *C, void *ntree_v, void *node_v)
                node->id= NULL;
        }
        sce= BLI_findlink(&G.main->scene, node->menunr-1);
-       if(sce!=CTX_data_scene(C)) {
-               node->id= &sce->id;
-               id_us_plus(node->id);
-       }
+       node->id= &sce->id;
+       id_us_plus(node->id);
        
        set_render_layers_title(C, node, NULL);
        nodeSetActive(ntree, node);
index b317c01e6c620ed986186adf49785cc84fd038e2..ed808b0dac86910dcda4288718da1658b1474d8c 100644 (file)
@@ -510,11 +510,13 @@ void node_composit_default(Scene *sce)
        
        sce->nodetree= ntreeAddTree(NTREE_COMPOSIT);
        
-       out= nodeAddNodeType(sce->nodetree, CMP_NODE_COMPOSITE, NULL, &sce->id);
+       out= nodeAddNodeType(sce->nodetree, CMP_NODE_COMPOSITE, NULL, NULL);
        out->locx= 300.0f; out->locy= 400.0f;
+       out->id= &sce->id;
        
-       in= nodeAddNodeType(sce->nodetree, CMP_NODE_R_LAYERS, NULL, &sce->id);
+       in= nodeAddNodeType(sce->nodetree, CMP_NODE_R_LAYERS, NULL, NULL);
        in->locx= 10.0f; in->locy= 400.0f;
+       in->id= &sce->id;
        nodeSetActive(sce->nodetree, in);
        
        /* links from color to color */
index eb5e85cc0017a80866e1141546dd0ac0a7a92c29..d25eefcb45ebe8a8b678c60761162b1d8d516f96 100644 (file)
@@ -648,14 +648,17 @@ static uiBlock *node_viewmenu(bContext *C, ARegion *ar, void *arg_unused)
 
 static void do_node_buttons(bContext *C, void *arg, int event)
 {
-       // NODE_FIX_ME : instead of using "current material/texture/scene" a la old buttons/G.scene
-       // have a panel from which enumerates textures, materials and scenes.
+       // NODE_FIX_ME : instead of using "current material/texture/scene", node editor can also pin context?
+       // note: scene context better not gets overridden, that'll clash too much (ton)
        SpaceNode *snode= (SpaceNode*)CTX_wm_space_data(C);
        Scene *scene= CTX_data_scene(C);
        Material *ma;
        Tex *tx;
        
        switch(event) {
+               case B_REDR:
+                       ED_area_tag_redraw(CTX_wm_area(C));                     
+                       break;
                case B_NODE_USEMAT:
                        ma= (Material *)snode->id;
                        if(ma) {
@@ -663,21 +666,17 @@ static void do_node_buttons(bContext *C, void *arg, int event)
                                        node_shader_default(ma);
                                        snode_set_context(snode, scene);
                                }
-                               /* BIF_preview_changed(ID_MA);
-                               allqueue(REDRAWNODE, 0);
-                               allqueue(REDRAWBUTSSHADING, 0);
-                               allqueue(REDRAWIPO, 0);*/
                        }               
+                       ED_area_tag_redraw(CTX_wm_area(C));                     
                        break;
                        
                case B_NODE_USESCENE:
                        if(scene->use_nodes) {
                                if(scene->nodetree==NULL)
                                        node_composit_default(scene);
-                               // addqueue(curarea->win, UI_BUT_EVENT, B_NODE_TREE_EXEC);
                        }
                        snode_set_context(snode, scene);
-                       // allqueue(REDRAWNODE, 0);
+                       ED_area_tag_redraw(CTX_wm_area(C));                     
                        break;
                        
                case B_NODE_USETEX:
@@ -688,11 +687,8 @@ static void do_node_buttons(bContext *C, void *arg, int event)
                                        node_texture_default(tx);
                                        snode_set_context(snode, scene);
                                }
-                               /* BIF_preview_changed(ID_TE);
-                               allqueue(REDRAWNODE, 0);
-                               allqueue(REDRAWBUTSSHADING, 0);
-                               allqueue(REDRAWIPO, 0);*/
                        }
+                       ED_area_tag_redraw(CTX_wm_area(C));                     
                        break;
        }
 }