Fix for bug #17580: crash rendering instanced objects with

halo material attach to the object instead of the mesh.

Also for bug #13489: avoid a crash rendering with invalid
active vcol layer, most likely caused by a bug that was
already fixed.
This commit is contained in:
Brecht Van Lommel
2008-09-09 14:16:54 +00:00
parent 68d7f0a3d1
commit 160c0de87b
2 changed files with 15 additions and 13 deletions

View File

@@ -4578,17 +4578,19 @@ static int allow_render_object(Object *ob, int nolamps, int onlyselected, Object
static int allow_render_dupli_instance(Render *re, DupliObject *dob, Object *obd)
{
ParticleSystem *psys;
Material ***material;
Material *ma;
short a, *totmaterial;
/* don't allow objects with halos */
/* don't allow objects with halos. we need to have
* all halo's to sort them globally in advance */
totmaterial= give_totcolp(obd);
material= give_matarar(obd);
if(totmaterial && material) {
for(a= 0; a<*totmaterial; a++)
if((*material)[a] && (*material)[a]->mode & MA_HALO)
if(totmaterial) {
for(a= 0; a<*totmaterial; a++) {
ma= give_current_material(obd, a);
if(ma && (ma->mode & MA_HALO))
return 0;
}
}
for(psys=obd->particlesystem.first; psys; psys=psys->next)

View File

@@ -483,16 +483,16 @@ void RE_set_customdata_names(ObjectRen *obr, CustomData *data)
DerivedMesh which stores the layers is freed */
CustomDataLayer *layer;
int numlayers, i, mtfn, mcn;
int numtf = 0, numcol = 0, i, mtfn, mcn;
if (CustomData_has_layer(data, CD_MTFACE)) {
numlayers= CustomData_number_of_layers(data, CD_MTFACE);
obr->mtface= MEM_callocN(sizeof(*obr->mtface)*numlayers, "mtfacenames");
numtf= CustomData_number_of_layers(data, CD_MTFACE);
obr->mtface= MEM_callocN(sizeof(*obr->mtface)*numtf, "mtfacenames");
}
if (CustomData_has_layer(data, CD_MCOL)) {
numlayers= CustomData_number_of_layers(data, CD_MCOL);
obr->mcol= MEM_callocN(sizeof(*obr->mcol)*numlayers, "mcolnames");
numcol= CustomData_number_of_layers(data, CD_MCOL);
obr->mcol= MEM_callocN(sizeof(*obr->mcol)*numcol, "mcolnames");
}
for (i=0, mtfn=0, mcn=0; i < data->totlayer; i++) {
@@ -500,12 +500,12 @@ void RE_set_customdata_names(ObjectRen *obr, CustomData *data)
if (layer->type == CD_MTFACE) {
strcpy(obr->mtface[mtfn++], layer->name);
obr->actmtface= layer->active_rnd;
obr->actmtface= CLAMPIS(layer->active_rnd, 0, numtf);
obr->bakemtface= layer->active;
}
else if (layer->type == CD_MCOL) {
strcpy(obr->mcol[mcn++], layer->name);
obr->actmcol= layer->active_rnd;
obr->actmcol= CLAMPIS(layer->active_rnd, 0, numcol);
}
}
}