Bugfix: baking selected to active did not include materials with

Traceable disabled.
This commit is contained in:
2008-03-14 10:56:09 +00:00
parent 3bec4f5f87
commit 3f9f89fc18
3 changed files with 11 additions and 3 deletions

View File

@@ -497,6 +497,7 @@ typedef struct LampRen {
#define R_GLOB_NOPUNOFLIP 16
#define R_NEED_TANGENT 32
#define R_SKIP_MULTIRES 64
#define R_BAKE_TRACE 128
/* vlakren->flag (vlak = face in dutch) char!!! */
#define R_SMOOTH 1

View File

@@ -5318,7 +5318,6 @@ void RE_Database_FromScene_Vectors(Render *re, Scene *sce)
ListBase oldtable= {NULL, NULL}, newtable= {NULL, NULL};
ListBase strandsurface;
int step;
ModifierData *md = NULL;
re->i.infostr= "Calculating previous vectors";
re->r.mode |= R_SPEED;
@@ -5453,6 +5452,8 @@ void RE_Database_Baking(Render *re, Scene *scene, int type, Object *actob)
re->excludeob= actob;
if(type == RE_BAKE_LIGHT)
re->flag |= R_SKIP_MULTIRES;
if(actob)
re->flag |= R_BAKE_TRACE;
if(type==RE_BAKE_NORMALS && re->r.bake_normal_space==R_BAKE_SPACE_TANGENT)
re->flag |= R_NEED_TANGENT;

View File

@@ -82,6 +82,11 @@ static int vlr_check_intersect(Isect *is, int ob, RayFace *face)
ObjectInstanceRen *obi= RAY_OBJECT_GET((Render*)is->userdata, ob);
VlakRen *vlr = (VlakRen*)face;
/* for baking selected to active non-traceable materials might still
* be in the raytree */
if(!(vlr->mat->mode & MA_TRACEBLE))
return 0;
/* I know... cpu cycle waste, might do smarter once */
if(is->mode==RE_RAY_MIRROR)
return !(vlr->mat->mode & MA_ONLYCAST);
@@ -125,7 +130,8 @@ void makeraytree(Render *re)
for(v=0;v<obr->totvlak;v++) {
if((v & 255)==0) vlr= obr->vlaknodes[v>>8].vlak;
else vlr++;
if(vlr->mat->mode & MA_TRACEBLE) {
/* baking selected to active needs non-traceable too */
if((re->flag & R_BAKE_TRACE) || (vlr->mat->mode & MA_TRACEBLE)) {
if((vlr->mat->mode & MA_WIRE)==0) {
VECCOPY(co1, vlr->v1->co);
VECCOPY(co2, vlr->v2->co);
@@ -186,7 +192,7 @@ void makeraytree(Render *re)
}
else vlr++;
if(vlr->mat->mode & MA_TRACEBLE)
if((re->flag & R_BAKE_TRACE) || (vlr->mat->mode & MA_TRACEBLE))
if((vlr->mat->mode & MA_WIRE)==0)
RE_ray_tree_add_face(re->raytree, RAY_OBJECT_SET(re, obi), vlr);
}