Bugfix #5401
authorTon Roosendaal <ton@blender.org>
Mon, 11 Dec 2006 11:33:03 +0000 (11:33 +0000)
committerTon Roosendaal <ton@blender.org>
Mon, 11 Dec 2006 11:33:03 +0000 (11:33 +0000)
Material Nodes still have undefined output to the passes. Currently only
the active Material node gives pass info. Bug was that check for active
was wrong, giving stripes because of hanging variables.
I'll work soon on providing all pass options in the Material nodes. This
fix at least correctly provides passes for active material, and clears
memory of pass info in advance.

Also: outliner view "current scene" did not show render layers.
ALso: outliner click on renderlayer now activates it (for UI)
Also: zbuffer for transparent was not initialized to 'infinity' correctly

source/blender/blenkernel/intern/node_shaders.c
source/blender/render/intern/source/zbuf.c
source/blender/src/outliner.c

index 937310273618f4c26f31a299ed9efc244d77d613..65de257af939350f1cfc7f0e16c37bcf4c6f4559 100644 (file)
@@ -330,7 +330,7 @@ static void node_shader_exec_material(void *data, bNode *node, bNodeStack **in,
                VECCOPY(out[MAT_OUT_NORMAL]->vec, shi->vn);
                
                /* copy passes, now just active node */
-               if(node->flag & NODE_ACTIVE)
+               if(node->flag & NODE_ACTIVE_ID)
                        *(shcd->shr)= shrnode;
        }
 }
@@ -1094,7 +1094,9 @@ void ntreeShaderExecTree(bNodeTree *ntree, ShadeInput *shi, ShadeResult *shr)
        /* convert caller data to struct */
        scd.shi= shi;
        scd.shr= shr;
-       
+       /* each material node has own local shaderesult, with optional copying */
+       memset(shr, 0, sizeof(ShadeResult));
+                  
        ntreeExecTree(ntree, &scd, shi->thread);        /* threads */
        
        /* better not allow negative for now */
index 3ee501102182091c44dc2d3ccf96a127a6ed9c32..44fbd7822149393043d3eec944f00b5d5c45293a 100644 (file)
@@ -3181,7 +3181,7 @@ void convert_zbuf_to_distbuf(RenderPart *pa, RenderLayer *rl)
        rectz= pa->rectz;
        
        for(a=pa->rectx*pa->recty; a>0; a--, rectz++, rectzf++) {
-               if(*rectz==0x7FFFFFFF)
+               if(*rectz>=0x7FFFFFF0)
                        *rectzf= 10e10;
                else {
                        /* inverse of zbuf calc: zbuf = MAXZ*hoco_z/hoco_w */
index a5bea95943eae18a6bf2c391aaf6777490cdaf7b..f728fbe97dbd9e34858548894dec3ced42bb0051 100644 (file)
@@ -474,6 +474,38 @@ static void outliner_add_bone(SpaceOops *soops, ListBase *lb, ID *id, Bone *curB
        }
 }
 
+static void outliner_add_scene_contents(SpaceOops *soops, ListBase *lb, Scene *sce, TreeElement *te)
+{
+       SceneRenderLayer *srl;
+       TreeElement *tenla= outliner_add_element(soops, lb, sce, te, TSE_R_LAYER_BASE, 0);
+       int a;
+       
+       tenla->name= "RenderLayers";
+       for(a=0, srl= sce->r.layers.first; srl; srl= srl->next, a++) {
+               TreeElement *tenlay= outliner_add_element(soops, &tenla->subtree, sce, te, TSE_R_LAYER, a);
+               tenlay->name= srl->name;
+               tenlay->directdata= &srl->passflag;
+               
+               if(srl->light_override)
+                       outliner_add_element(soops, &tenlay->subtree, srl->light_override, tenlay, TSE_LINKED_LAMP, 0);
+               if(srl->mat_override)
+                       outliner_add_element(soops, &tenlay->subtree, srl->mat_override, tenlay, TSE_LINKED_MAT, 0);
+               
+               outliner_add_passes(soops, tenlay, &sce->id, srl);
+       }
+       
+       outliner_add_element(soops,  lb, sce->world, te, 0, 0);
+       
+       if(sce->scriptlink.scripts) {
+               int a= 0;
+               tenla= outliner_add_element(soops,  lb, sce, te, TSE_SCRIPT_BASE, 0);
+               tenla->name= "Scripts";
+               for (a=0; a<sce->scriptlink.totscript; a++) {
+                       outliner_add_element(soops, &tenla->subtree, sce->scriptlink.scripts[a], tenla, 0, 0);
+               }
+       }
+
+}
 
 static TreeElement *outliner_add_element(SpaceOops *soops, ListBase *lb, void *idv, 
                                                                                 TreeElement *parent, short type, short index)
@@ -508,37 +540,7 @@ static TreeElement *outliner_add_element(SpaceOops *soops, ListBase *lb, void *i
                        te->name= ((Library *)id)->name;
                        break;
                case ID_SCE:
-                       {
-                               Scene *sce= (Scene *)id;
-                               SceneRenderLayer *srl;
-                               TreeElement *tenla= outliner_add_element(soops, &te->subtree, sce, te, TSE_R_LAYER_BASE, 0);
-                               int a;
-                               
-                               tenla->name= "RenderLayers";
-                               for(a=0, srl= sce->r.layers.first; srl; srl= srl->next, a++) {
-                                       TreeElement *tenlay= outliner_add_element(soops, &tenla->subtree, sce, te, TSE_R_LAYER, a);
-                                       tenlay->name= srl->name;
-                                       tenlay->directdata= &srl->passflag;
-                                       
-                                       if(srl->light_override)
-                                               outliner_add_element(soops, &tenlay->subtree, srl->light_override, tenlay, TSE_LINKED_LAMP, 0);
-                                       if(srl->mat_override)
-                                               outliner_add_element(soops, &tenlay->subtree, srl->mat_override, tenlay, TSE_LINKED_MAT, 0);
-                                       
-                                       outliner_add_passes(soops, tenlay, &sce->id, srl);
-                               }
-                               
-                               outliner_add_element(soops, &te->subtree, sce->world, te, 0, 0);
-                               
-                               if(sce->scriptlink.scripts) {
-                                       int a= 0;
-                                       tenla= outliner_add_element(soops, &te->subtree, sce, te, TSE_SCRIPT_BASE, 0);
-                                       tenla->name= "Scripts";
-                                       for (a=0; a<sce->scriptlink.totscript; a++) {
-                                               outliner_add_element(soops, &tenla->subtree, sce->scriptlink.scripts[a], tenla, 0, 0);
-                                       }
-                               }
-                       }
+                       outliner_add_scene_contents(soops, &te->subtree, (Scene *)id, te);
                        break;
                case ID_OB:
                        {
@@ -972,7 +974,8 @@ static void outliner_build_tree(SpaceOops *soops)
                }
        }
        else if(soops->outlinevis == SO_CUR_SCENE) {
-               outliner_add_element(soops, &soops->tree, G.scene->world, NULL, 0, 0);
+               
+               outliner_add_scene_contents(soops, &soops->tree, G.scene, NULL);
                
                for(base= G.scene->base.first; base; base= base->next) {
                        ten= outliner_add_element(soops, &soops->tree, base->object, NULL, 0, 0);
@@ -1235,6 +1238,25 @@ void outliner_page_up_down(ScrArea *sa, int up)
 
 /* **** do clicks on items ******* */
 
+static int tree_element_active_renderlayer(TreeElement *te, TreeStoreElem *tselem, int set)
+{
+       Scene *sce;
+       
+       /* paranoia check */
+       if(te->idcode!=ID_SCE)
+               return 0;
+       sce= (Scene *)tselem->id;
+       
+       if(set) {
+               sce->r.actlay= tselem->nr;
+               allqueue(REDRAWBUTSSCENE, 0);
+       }
+       else {
+               return sce->r.actlay==tselem->nr;
+       }
+       return 0;
+}
+
 static void tree_element_active_object(SpaceOops *soops, TreeElement *te)
 {
        TreeStoreElem *tselem= TREESTORE(te);
@@ -1739,10 +1761,10 @@ static int tree_element_type_active(SpaceOops *soops, TreeElement *te, TreeStore
                        break;
                case TSE_POSE_CHANNEL:
                        return tree_element_active_posechannel(te, tselem, set);
-                       break;
                case TSE_CONSTRAINT:
                        return tree_element_active_constraint(te, tselem, set);
-                       break;
+               case TSE_R_LAYER:
+                       return tree_element_active_renderlayer(te, tselem, set);
        }
        return 0;
 }