Three-fixes-in-one:
authorTon Roosendaal <ton@blender.org>
Tue, 12 Dec 2006 11:13:43 +0000 (11:13 +0000)
committerTon Roosendaal <ton@blender.org>
Tue, 12 Dec 2006 11:13:43 +0000 (11:13 +0000)
#5417: Only Shadow material gave shadow outside of Spot bundle
#5414: Material Nodes: sockets without input were always treated as single
       value inputs, ignoring color or vector. (Caused by commit to do
       automatic conversions of socket links).
#5420: When reading with old Blender a new file that has a new window type,
       saving it over, and read back in current Blender, the window type
       should be reset to EMPTY, because all its data got lost.

source/blender/blenkernel/intern/node.c
source/blender/blenloader/intern/readfile.c
source/blender/render/intern/source/shadeoutput.c

index 20a9a5e97d8869ee5b17d72e619417b2ec96863c..bb6439d09fbe0125c40efd6c17dc2427756bfae5 100644 (file)
@@ -1802,6 +1802,8 @@ static void group_tag_used_outputs(bNode *gnode, bNodeStack *stack)
                                                ns->hasoutput= 1;
                                                ns->sockettype= sock->link->fromsock->type;
                                        }
+                                       else
+                                               sock->ns.sockettype= sock->type;
                                }
                        }
                }
@@ -1846,6 +1848,8 @@ void ntreeBeginExecTree(bNodeTree *ntree)
                                        ns->hasoutput= 1;
                                        ns->sockettype= sock->link->fromsock->type;
                                }
+                               else
+                                       sock->ns.sockettype= sock->type;
                        }
                        if(node->type==NODE_GROUP && node->id)
                                group_tag_used_outputs(node, ntree->stack[0]);
index 0f087064a6ae8a83e2380ff6ab37ae56764ea83c..3bd3999b3ae57d3311e5702831e2e27e6522be83 100644 (file)
@@ -3678,12 +3678,16 @@ static void direct_link_screen(FileData *fd, bScreen *sc)
                link_list(fd, &(sa->spacedata));
                link_list(fd, &(sa->panels));
 
+               /* accident can happen when read/save new file with older version */
+               if(sa->spacedata.first==NULL)
+                       sa->spacetype= SPACE_EMPTY;
+               
                for(pa= sa->panels.first; pa; pa=pa->next) {
                        pa->paneltab= newdataadr(fd, pa->paneltab);
                        pa->active= 0;
                        pa->sortcounter= 0;
                }
-
+               
                for (sl= sa->spacedata.first; sl; sl= sl->next) {
                        if (sl->spacetype==SPACE_VIEW3D) {
                                View3D *v3d= (View3D*) sl;
index f3a677a28ee37fec2f29be3ce36f7c82fd7b2ae9..b53954c8ace8c23ba1e2dd6c9e5dee10d0673377 100644 (file)
@@ -1373,22 +1373,26 @@ static void shade_lamp_loop_only_shadow(ShadeInput *shi, ShadeResult *shr)
                        
                        if(lar->shb || (lar->mode & LA_SHAD_RAY)) {
                                visifac= lamp_get_visibility(lar, shi->co, lv, &lampdist);
-                               if(visifac < 0.0f)
+                               if(visifac <= 0.0f) {
+                                       ir+= 1.0f;
+                                       accum+= 1.0f;
                                        continue;
-                               
+                               }
                                inpr= INPR(shi->vn, lv);
                                if(inpr <= 0.0f)
                                        continue;
                                
                                lamp_get_shadow(lar, shi, inpr, shadfac, shi->depth);
+
                                ir+= 1.0f;
-                               accum+= shadfac[3];
+                               accum+= (1.0f-visifac) + (visifac)*shadfac[3];
                        }
                }
                if(ir>0.0f) {
                        accum/= ir;
-                       shr->alpha= (shi->alpha)*(1.0f-accum);
+                       shr->alpha= (shi->mat->alpha)*(1.0f-accum);
                }
+               else shr->alpha= shi->mat->alpha;
        }
        
        /* quite disputable this...  also note it doesn't mirror-raytrace */