* fixed code that tried to restore material links, after radiosity, and

when you want a new Mesh.
  Problem happened when over 16 materials are used for 'collect meshes'.
  Blender does not support (yet) more than 16. For clarity, I added a
  warning for the user when this occurs

  (was bug 370)
This commit is contained in:
Ton Roosendaal 2003-07-11 12:45:04 +00:00
parent 6c03e374fa
commit a31693cca4
2 changed files with 6 additions and 7 deletions

@ -55,6 +55,7 @@
#include "BLI_blenlib.h" #include "BLI_blenlib.h"
#include "BLI_arithb.h" #include "BLI_arithb.h"
#include "BIF_toolbox.h" // notice()
#include "DNA_material_types.h" #include "DNA_material_types.h"
#include "DNA_mesh_types.h" #include "DNA_mesh_types.h"
@ -702,6 +703,8 @@ void rad_addmesh(void)
if(RG.totface==0) return; if(RG.totface==0) return;
if(RG.totmat==MAXMAT) notice("warning: cannot assign more than 16 materials to 1 mesh");
/* make sure there's alpha in the color, to distinguish */ /* make sure there's alpha in the color, to distinguish */
for(a=0; a<RG.totface; a++) { for(a=0; a<RG.totface; a++) {
RAD_NEXTFACE(a); RAD_NEXTFACE(a);

@ -364,13 +364,9 @@ void rad_collect_meshes()
} }
else { else {
for(a=0; a<base->object->totcol; a++) { for(a=0; a<base->object->totcol; a++) {
if(a+RG.totmat>MAXMAT-1) break; if(RG.totmat >= MAXMAT) break;
RG.matar[a+RG.totmat]= give_current_material(base->object, a+1); RG.matar[RG.totmat]= give_current_material(base->object, a+1);
} RG.totmat++;
RG.totmat+= base->object->totcol;
if (RG.totmat >= MAXMAT) {
RG.totmat = MAXMAT - 1;
} }
} }
} }