diff options
author | Ton Roosendaal <ton@blender.org> | 2006-02-02 22:31:15 +0300 |
---|---|---|
committer | Ton Roosendaal <ton@blender.org> | 2006-02-02 22:31:15 +0300 |
commit | 21e7a5f142b47f6eff3b9d221bae27391971bb3d (patch) | |
tree | 8fe5f9c9b978e5e0e24869839be7107f3231aea9 | |
parent | 2a528b285e29382f2447701058525dc5299525ed (diff) |
Render fix: object-duplicators now give their layer setting to the
duplicates, enabling lighting and layer-render properly.
-rw-r--r-- | source/blender/blenkernel/BKE_anim.h | 5 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/anim.c | 24 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/scene.c | 2 | ||||
-rw-r--r-- | source/blender/render/intern/source/convertblender.c | 4 | ||||
-rw-r--r-- | source/blender/src/drawview.c | 2 | ||||
-rw-r--r-- | source/blender/src/editobject.c | 2 |
6 files changed, 26 insertions, 13 deletions
diff --git a/source/blender/blenkernel/BKE_anim.h b/source/blender/blenkernel/BKE_anim.h index 69fb83aac30..d139afe6c25 100644 --- a/source/blender/blenkernel/BKE_anim.h +++ b/source/blender/blenkernel/BKE_anim.h @@ -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 diff --git a/source/blender/blenkernel/intern/anim.c b/source/blender/blenkernel/intern/anim.c index 5700be0fcbc..8ff5ca1d12b 100644 --- a/source/blender/blenkernel/intern/anim.c +++ b/source/blender/blenkernel/intern/anim.c @@ -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) { diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c index 492c1b1c264..9c927c80c7e 100644 --- a/source/blender/blenkernel/intern/scene.c +++ b/source/blender/blenkernel/intern/scene.c @@ -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; } diff --git a/source/blender/render/intern/source/convertblender.c b/source/blender/render/intern/source/convertblender.c index beac431ce9d..aba817212f8 100644 --- a/source/blender/render/intern/source/convertblender.c +++ b/source/blender/render/intern/source/convertblender.c @@ -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 { diff --git a/source/blender/src/drawview.c b/source/blender/src/drawview.c index 5e8cc3225ee..9e2dda98728 100644 --- a/source/blender/src/drawview.c +++ b/source/blender/src/drawview.c @@ -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); } diff --git a/source/blender/src/editobject.c b/source/blender/src/editobject.c index 1498bf15c06..adb4d91725f 100644 --- a/source/blender/src/editobject.c +++ b/source/blender/src/editobject.c @@ -3200,7 +3200,7 @@ void make_duplilist_real() apply_obmat(ob); } - BLI_freelistN(lb); + free_object_duplilist(lb); base->object->transflag &= ~OB_DUPLI; } |