diff options
author | Ton Roosendaal <ton@blender.org> | 2005-12-05 20:06:58 +0300 |
---|---|---|
committer | Ton Roosendaal <ton@blender.org> | 2005-12-05 20:06:58 +0300 |
commit | 863234481e751ae94dd77b18d65ea76df65ec4b1 (patch) | |
tree | c4d47fca8e763b5f13bdf0ad47885be37ada4778 /source/blender | |
parent | dd1f6c649a42258c71a2234eeede0b16b3ef245f (diff) |
"Make Local" menu (Lkey) now has as first option to make only Objects
local, keeping all Data stuff (Mesh, Materials) from Library.
The animation stuff on Object becomes local though;
- Ipo
- Action
- NLA
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/blenkernel/intern/object.c | 6 | ||||
-rw-r--r-- | source/blender/render/intern/source/ray.c | 41 | ||||
-rw-r--r-- | source/blender/render/intern/source/rendercore.c | 17 | ||||
-rw-r--r-- | source/blender/src/editobject.c | 71 |
4 files changed, 104 insertions, 31 deletions
diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c index 957d76d786b..7c19f48e2e0 100644 --- a/source/blender/blenkernel/intern/object.c +++ b/source/blender/blenkernel/intern/object.c @@ -55,6 +55,7 @@ #include "DNA_mesh_types.h" #include "DNA_meshdata_types.h" #include "DNA_modifier_types.h" +#include "DNA_nla_types.h" #include "DNA_object_types.h" #include "DNA_object_force.h" #include "DNA_object_fluidsim.h" @@ -888,6 +889,7 @@ Object *copy_object(Object *ob) void expand_local_object(Object *ob) { + bActionStrip *strip; int a; id_lib_extern((ID *)ob->action); @@ -897,6 +899,10 @@ void expand_local_object(Object *ob) for(a=0; a<ob->totcol; a++) { id_lib_extern((ID *)ob->mat[a]); } + for (strip=ob->nlastrips.first; strip; strip=strip->next) { + id_lib_extern((ID *)strip->act); + } + } void make_local_object(Object *ob) diff --git a/source/blender/render/intern/source/ray.c b/source/blender/render/intern/source/ray.c index 761f4e7fe0b..30973b0891b 100644 --- a/source/blender/render/intern/source/ray.c +++ b/source/blender/render/intern/source/ray.c @@ -2272,3 +2272,44 @@ void ray_shadow(ShadeInput *shi, LampRen *lar, float *shadfac) } +/* only when face points away from lamp, in direction of lamp, trace ray and find first exit point */ +void ray_translucent(ShadeInput *shi, LampRen *lar, float *distfac, float *co) +{ + Isect isec; + float lampco[3]; + + /* setup isec */ + isec.mode= DDA_SHADOW_TRA; + + if(lar->mode & LA_LAYER) isec.lay= lar->lay; else isec.lay= -1; + + if(lar->type==LA_SUN || lar->type==LA_HEMI) { + lampco[0]= shi->co[0] - g_oc.ocsize*lar->vec[0]; + lampco[1]= shi->co[1] - g_oc.ocsize*lar->vec[1]; + lampco[2]= shi->co[2] - g_oc.ocsize*lar->vec[2]; + } + else { + VECCOPY(lampco, lar->co); + } + + isec.vlrorig= shi->vlr; + + /* set up isec vec */ + VECCOPY(isec.start, shi->co); + VECCOPY(isec.end, lampco); + + if( d3dda(&isec)) { + /* we got a face */ + + /* render co */ + co[0]= isec.start[0]+isec.labda*(isec.vec[0]); + co[1]= isec.start[1]+isec.labda*(isec.vec[1]); + co[2]= isec.start[2]+isec.labda*(isec.vec[2]); + + *distfac= VecLength(isec.vec); + } + else + *distfac= 0.0f; +} + + diff --git a/source/blender/render/intern/source/rendercore.c b/source/blender/render/intern/source/rendercore.c index 8b6c4118786..4d29ffe3b43 100644 --- a/source/blender/render/intern/source/rendercore.c +++ b/source/blender/render/intern/source/rendercore.c @@ -1704,6 +1704,22 @@ void shade_lamp_loop(ShadeInput *shi, ShadeResult *shr) } } } + + if(R.r.mode & R_RAYTRACE) { + extern void ray_translucent(ShadeInput *shi, LampRen *lar, float *distfac, float *co); + float co[3], distfac; + + ray_translucent(shi, lar, &distfac, co); + + if(distfac<0.01f*G.rt) { + // printf("distfac %f\n", distfac); + distfac= 1.0f - distfac/(0.01f*G.rt); + shr->diff[0]+= distfac; + shr->diff[1]+= distfac; + shr->diff[2]+= distfac; + } + } + /* specularity */ if(shadfac[3]>0.0 && shi->spec!=0.0 && !(lar->mode & LA_NO_SPEC)) { @@ -2385,6 +2401,7 @@ void *shadepixel(float x, float y, int z, int facenr, int mask, float *col, floa VecMulf(shi.vn, -1.0); VecMulf(shi.facenor, -1.0); shade_lamp_loop(&shi, &shr_t); + shr.diff[0]+= shi.translucency*shr_t.diff[0]; shr.diff[1]+= shi.translucency*shr_t.diff[1]; shr.diff[2]+= shi.translucency*shr_t.diff[2]; diff --git a/source/blender/src/editobject.c b/source/blender/src/editobject.c index bb5f66e4932..da8dfc1d11b 100644 --- a/source/blender/src/editobject.c +++ b/source/blender/src/editobject.c @@ -71,6 +71,7 @@ #include "DNA_mesh_types.h" #include "DNA_meshdata_types.h" #include "DNA_meta_types.h" +#include "DNA_nla_types.h" #include "DNA_object_types.h" #include "DNA_object_force.h" #include "DNA_scene_types.h" @@ -4033,6 +4034,7 @@ void make_local(void) { Base *base; Object *ob; + bActionStrip *strip; Material *ma, ***matarar; Lamp *la; Curve *cu; @@ -4043,14 +4045,14 @@ void make_local(void) if(G.scene->id.lib) return; - mode= pupmenu("Make Local%t|Selected %x1|All %x2"); + mode= pupmenu("Make Local%t|Selected Objects %x1|Selected Objects and Data %x2|All %x3"); - if(mode==2) { + if(mode==3) { all_local(NULL); // NULL is all libs allqueue(REDRAWALL, 0); return; } - else if(mode!=1) return; + else if(mode<1) return; clear_id_newpoins(); @@ -4085,7 +4087,7 @@ void make_local(void) id= ob->data; - if(id) { + if(id && mode>1) { switch(ob->type) { case OB_LAMP: @@ -4129,44 +4131,51 @@ void make_local(void) id= (ID *)ob->action; if(id && id->lib) make_local_action(ob->action); + + for (strip=ob->nlastrips.first; strip; strip=strip->next) { + if(strip->act && strip->act->id.lib) + make_local_action(strip->act); + } + } base= base->next; } - base= FIRSTBASE; - while(base) { - ob= base->object; - if(base->flag & SELECT ) { - - if(ob->type==OB_LAMP) { - la= ob->data; - for(b=0; b<MAX_MTEX; b++) { - if(la->mtex[b] && la->mtex[b]->tex) { - make_local_texture(la->mtex[b]->tex); - } - } - } - else { + if(mode>1) { + base= FIRSTBASE; + while(base) { + ob= base->object; + if(base->flag & SELECT ) { - for(a=0; a<ob->totcol; a++) { - ma= ob->mat[a]; - if(ma) - make_local_makelocalmaterial(ma); + if(ob->type==OB_LAMP) { + la= ob->data; + for(b=0; b<MAX_MTEX; b++) { + if(la->mtex[b] && la->mtex[b]->tex) { + make_local_texture(la->mtex[b]->tex); + } + } } - - matarar= (Material ***)give_matarar(ob); - - for(a=0; a<ob->totcol; a++) { - ma= (*matarar)[a]; - if(ma) - make_local_makelocalmaterial(ma); + else { + + for(a=0; a<ob->totcol; a++) { + ma= ob->mat[a]; + if(ma) + make_local_makelocalmaterial(ma); + } + + matarar= (Material ***)give_matarar(ob); + + for(a=0; a<ob->totcol; a++) { + ma= (*matarar)[a]; + if(ma) + make_local_makelocalmaterial(ma); + } } } + base= base->next; } - base= base->next; } - allqueue(REDRAWALL, 0); BIF_undo_push("Make local"); } |