Render fix: object-duplicators now give their layer setting to the
duplicates, enabling lighting and layer-render properly.
This commit is contained in:
@@ -38,10 +38,12 @@ struct Path;
|
||||
struct Object;
|
||||
struct PartEff;
|
||||
struct Scene;
|
||||
struct ListBase;
|
||||
|
||||
typedef struct DupliObject {
|
||||
struct DupliObject *next, *prev;
|
||||
struct Object *ob;
|
||||
unsigned int origlay;
|
||||
float mat[4][4], omat[4][4];
|
||||
} DupliObject;
|
||||
|
||||
@@ -50,7 +52,8 @@ void calc_curvepath(struct Object *ob);
|
||||
int interval_test(int min, int max, int p1, int cycl);
|
||||
int where_on_path(struct Object *ob, float ctime, float *vec, float *dir);
|
||||
|
||||
ListBase *object_duplilist(struct Scene *sce, struct Object *ob);
|
||||
struct ListBase *object_duplilist(struct Scene *sce, struct Object *ob);
|
||||
void free_object_duplilist(struct ListBase *lb);
|
||||
int count_duplilist(struct Object *ob);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -277,13 +277,15 @@ int where_on_path(Object *ob, float ctime, float *vec, float *dir) /* returns OK
|
||||
|
||||
/* ****************** DUPLICATOR ************** */
|
||||
|
||||
static void new_dupli_object(ListBase *lb, Object *ob, float mat[][4])
|
||||
static void new_dupli_object(ListBase *lb, Object *ob, float mat[][4], int lay)
|
||||
{
|
||||
DupliObject *dob= MEM_mallocN(sizeof(DupliObject), "dupliobject");
|
||||
BLI_addtail(lb, dob);
|
||||
dob->ob= ob;
|
||||
Mat4CpyMat4(dob->mat, mat);
|
||||
Mat4CpyMat4(dob->omat, ob->obmat);
|
||||
dob->origlay= ob->lay;
|
||||
ob->lay= lay;
|
||||
}
|
||||
|
||||
static void group_duplilist(ListBase *lb, Object *ob)
|
||||
@@ -300,7 +302,7 @@ static void group_duplilist(ListBase *lb, Object *ob)
|
||||
for(go= ob->dup_group->gobject.first; go; go= go->next) {
|
||||
if(go->ob!=ob) {
|
||||
Mat4MulMat4(mat, go->ob->obmat, ob->obmat);
|
||||
new_dupli_object(lb, go->ob, mat);
|
||||
new_dupli_object(lb, go->ob, mat, ob->lay);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -329,7 +331,7 @@ static void frames_duplilist(ListBase *lb, Object *ob)
|
||||
if(ok) {
|
||||
do_ob_ipo(ob);
|
||||
where_is_object_time(ob, (float)G.scene->r.cfra);
|
||||
new_dupli_object(lb, ob, ob->obmat);
|
||||
new_dupli_object(lb, ob, ob->obmat, ob->lay);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -367,7 +369,7 @@ static void vertex_dupli__mapFunc(void *userData, int index, float *co, float *n
|
||||
Mat4CpyMat4(tmat, obmat);
|
||||
Mat4MulMat43(obmat, tmat, mat);
|
||||
}
|
||||
new_dupli_object(vdd->lb, vdd->ob, obmat);
|
||||
new_dupli_object(vdd->lb, vdd->ob, obmat, vdd->par->lay);
|
||||
}
|
||||
|
||||
static void vertex_duplilist(ListBase *lb, Scene *sce, Object *par)
|
||||
@@ -495,7 +497,7 @@ static void particle_duplilist(ListBase *lb, Scene *sce, Object *par, PartEff *p
|
||||
}
|
||||
|
||||
VECCOPY(ob->obmat[3], vec);
|
||||
new_dupli_object(lb, ob, ob->obmat);
|
||||
new_dupli_object(lb, ob, ob->obmat, par->lay);
|
||||
}
|
||||
}
|
||||
else { // non static particles
|
||||
@@ -521,7 +523,7 @@ static void particle_duplilist(ListBase *lb, Scene *sce, Object *par, PartEff *p
|
||||
}
|
||||
|
||||
VECCOPY(ob->obmat[3], vec);
|
||||
new_dupli_object(lb, ob, ob->obmat);
|
||||
new_dupli_object(lb, ob, ob->obmat, par->lay);
|
||||
}
|
||||
}
|
||||
/* temp copy, to have ipos etc to work OK */
|
||||
@@ -596,7 +598,7 @@ static void font_duplilist(ListBase *lb, Object *par)
|
||||
Mat4CpyMat4(obmat, par->obmat);
|
||||
VECCOPY(obmat[3], vec);
|
||||
|
||||
new_dupli_object(lb, ob, obmat);
|
||||
new_dupli_object(lb, ob, obmat, par->lay);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -638,6 +640,14 @@ ListBase *object_duplilist(Scene *sce, Object *ob)
|
||||
return &duplilist;
|
||||
}
|
||||
|
||||
void free_object_duplilist(ListBase *lb)
|
||||
{
|
||||
DupliObject *dob;
|
||||
|
||||
for(dob= lb->first; dob; dob= dob->next)
|
||||
dob->ob->lay= dob->origlay;
|
||||
BLI_freelistN(lb);
|
||||
}
|
||||
|
||||
int count_duplilist(Object *ob)
|
||||
{
|
||||
|
||||
@@ -396,7 +396,7 @@ int next_object(int val, Base **base, Object **ob)
|
||||
Mat4CpyMat4(dupob->ob->obmat, dupob->omat);
|
||||
}
|
||||
|
||||
BLI_freelistN(duplilist);
|
||||
free_object_duplilist(duplilist);
|
||||
duplilist= NULL;
|
||||
run_again= 1;
|
||||
}
|
||||
|
||||
@@ -2845,7 +2845,7 @@ void RE_Database_FromScene(Render *re, Scene *scene, int use_camera_view)
|
||||
}
|
||||
Mat4CpyMat4(obd->obmat, dob->omat);
|
||||
}
|
||||
BLI_freelistN(lb);
|
||||
free_object_duplilist(lb);
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -3011,7 +3011,7 @@ static void database_fromscene_vectors(Render *re, Scene *scene)
|
||||
}
|
||||
Mat4CpyMat4(obd->obmat, dob->omat);
|
||||
}
|
||||
BLI_freelistN(lb);
|
||||
free_object_duplilist(lb);
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -2170,7 +2170,7 @@ static void draw_dupli_objects(View3D *v3d, Base *base)
|
||||
}
|
||||
/* Transp afterdraw disabled, afterdraw only stores base pointers, and duplis can be same obj */
|
||||
|
||||
BLI_freelistN(lb);
|
||||
free_object_duplilist(lb);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -3200,7 +3200,7 @@ void make_duplilist_real()
|
||||
apply_obmat(ob);
|
||||
}
|
||||
|
||||
BLI_freelistN(lb);
|
||||
free_object_duplilist(lb);
|
||||
|
||||
base->object->transflag &= ~OB_DUPLI;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user