Plumiferos report:
The new Material "LightGroups" only worked with lamps in visible layers. Now also lamps from the group that are not visible are included for rendering, ensuring that a lightgroup always works on that material, disregarding layer settings (unless lamp is type 'layer lamp').
This commit is contained in:
@@ -102,7 +102,6 @@ void free_material(Material *ma)
|
||||
|
||||
void init_material(Material *ma)
|
||||
{
|
||||
ma->lay= 1;
|
||||
ma->r= ma->g= ma->b= ma->ref= 0.8;
|
||||
ma->specr= ma->specg= ma->specb= 1.0;
|
||||
ma->mirr= ma->mirg= ma->mirb= 1.0;
|
||||
@@ -658,9 +657,12 @@ void init_render_materials(int osa, float *amb)
|
||||
Material *ma;
|
||||
|
||||
/* two steps, first initialize, then or the flags for layers */
|
||||
for(ma= G.main->mat.first; ma; ma= ma->id.next)
|
||||
for(ma= G.main->mat.first; ma; ma= ma->id.next) {
|
||||
/* is_used flag comes back in convertblender.c */
|
||||
ma->flag &= ~MA_IS_USED;
|
||||
if(ma->id.us)
|
||||
init_render_material(ma, osa, amb);
|
||||
}
|
||||
}
|
||||
|
||||
/* only needed for nodes now */
|
||||
|
||||
@@ -54,7 +54,7 @@ struct bNodeTree;
|
||||
typedef struct Material {
|
||||
ID id;
|
||||
|
||||
short colormodel, lay; /* lay: for dynamics (old engine, until 2.04) */
|
||||
short colormodel, flag;
|
||||
/* note, keep this below synced with render_types.h */
|
||||
float r, g, b;
|
||||
float specr, specg, specb;
|
||||
@@ -129,6 +129,10 @@ typedef struct Material {
|
||||
#define MA_YUV 2
|
||||
#define MA_HSV 3
|
||||
|
||||
/* flag */
|
||||
/* for render */
|
||||
#define MA_IS_USED 1
|
||||
|
||||
/* mode (is int) */
|
||||
#define MA_TRACEBLE 1
|
||||
#define MA_SHADOW 2
|
||||
|
||||
@@ -1007,6 +1007,9 @@ static Material *give_render_material(Render *re, Object *ob, int nr)
|
||||
|
||||
if(re->r.mode & R_SPEED) ma->texco |= NEED_UV;
|
||||
|
||||
/* for light groups */
|
||||
ma->flag |= MA_IS_USED;
|
||||
|
||||
return ma;
|
||||
}
|
||||
|
||||
@@ -2150,7 +2153,7 @@ static void area_lamp_vectors(LampRen *lar)
|
||||
}
|
||||
|
||||
/* If lar takes more lamp data, the decoupling will be better. */
|
||||
static void add_render_lamp(Render *re, Object *ob)
|
||||
static LampRen *add_render_lamp(Render *re, Object *ob)
|
||||
{
|
||||
Lamp *la= ob->data;
|
||||
LampRen *lar;
|
||||
@@ -2161,7 +2164,7 @@ static void add_render_lamp(Render *re, Object *ob)
|
||||
/* prevent only shadow from rendering light */
|
||||
if(la->mode & LA_ONLYSHADOW)
|
||||
if((re->r.mode & R_SHADOW)==0)
|
||||
return;
|
||||
return NULL;
|
||||
|
||||
go= MEM_callocN(sizeof(GroupObject), "groupobject");
|
||||
BLI_addtail(&re->lights, go);
|
||||
@@ -2347,6 +2350,7 @@ static void add_render_lamp(Render *re, Object *ob)
|
||||
lar->mode &= ~LA_SHAD_RAY;
|
||||
}
|
||||
}
|
||||
return lar;
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
@@ -3092,11 +3096,15 @@ static void set_material_lightgroups(Render *re)
|
||||
if(ma->group) {
|
||||
for(go= ma->group->gobject.first; go; go= go->next) {
|
||||
go->lampren= NULL;
|
||||
for(gol= re->lights.first; gol; gol= gol->next) {
|
||||
if(gol->ob==go->ob) {
|
||||
go->lampren= gol->lampren;
|
||||
break;
|
||||
if(go->ob && go->ob->type==OB_LAMP) {
|
||||
for(gol= re->lights.first; gol; gol= gol->next) {
|
||||
if(gol->ob==go->ob) {
|
||||
go->lampren= gol->lampren;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(go->lampren==NULL)
|
||||
go->lampren= add_render_lamp(re, go->ob);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2524,12 +2524,6 @@ void do_matbuts(unsigned short event)
|
||||
scrarea_queue_winredraw(curarea);
|
||||
}
|
||||
break;
|
||||
case B_MATLAY:
|
||||
if(ma && ma->lay==0) {
|
||||
ma->lay= 1;
|
||||
scrarea_queue_winredraw(curarea);
|
||||
}
|
||||
break;
|
||||
case B_MATZTRANSP:
|
||||
if(ma) {
|
||||
ma->mode &= ~MA_RAYTRANSP;
|
||||
|
||||
Reference in New Issue
Block a user