diff options
author | Ton Roosendaal <ton@blender.org> | 2006-04-02 15:48:22 +0400 |
---|---|---|
committer | Ton Roosendaal <ton@blender.org> | 2006-04-02 15:48:22 +0400 |
commit | 546cf1d5ba3e7cc56e9d8600bb933b125fdbc302 (patch) | |
tree | c0c1aa605160c594ca3924d1601a3f6cbfc692a4 /source/blender/blenkernel | |
parent | 3be5302e40fd837517d6721b76cb8a9264402ee8 (diff) |
Bugfix #4051
- particle duplicators should not include parent animation (error in
duplicator recode of last december)
- added exception for 'died' particles to keep correct orientation
Also in this commit:
- added comment in code to explain why vertexnormals in mesh are equal to
vertex location when no faces exist
- cleanup of BKE_object.h for functions that don't need export.
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r-- | source/blender/blenkernel/BKE_object.h | 10 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/DerivedMesh.c | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/anim.c | 17 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/object.c | 16 |
4 files changed, 24 insertions, 21 deletions
diff --git a/source/blender/blenkernel/BKE_object.h b/source/blender/blenkernel/BKE_object.h index d0f70907e5c..0ed4119ac59 100644 --- a/source/blender/blenkernel/BKE_object.h +++ b/source/blender/blenkernel/BKE_object.h @@ -75,20 +75,18 @@ void expand_local_object(struct Object *ob); void make_local_object(struct Object *ob); void set_mblur_offs(float blur); void disable_speed_curve(int val); + float bsystem_time(struct Object *ob, struct Object *par, float cfra, float ofs); void object_to_mat3(struct Object *ob, float mat[][3]); void object_to_mat4(struct Object *ob, float mat[][4]); -void ob_parcurve(struct Object *ob, struct Object *par, float mat[][4]); -void ob_parlimb(struct Object *ob, struct Object *par, float mat[][4]); -void ob_parbone(struct Object *ob, struct Object *par, float mat[][4]); /* __NLA */ -void give_parvert(struct Object *par, int nr, float *vec); -void ob_parvert3(struct Object *ob, struct Object *par, float mat[][4]); + void set_no_parent_ipo(int val); -void set_dtime(int dtime); + void disable_where_script(short on); int during_script(void); void disable_where_scriptlink(short on); int during_scriptlink(void); + void where_is_object_time(struct Object *ob, float ctime); void where_is_object(struct Object *ob); void where_is_object_simul(struct Object *ob); diff --git a/source/blender/blenkernel/intern/DerivedMesh.c b/source/blender/blenkernel/intern/DerivedMesh.c index 1eb94967900..1052007846f 100644 --- a/source/blender/blenkernel/intern/DerivedMesh.c +++ b/source/blender/blenkernel/intern/DerivedMesh.c @@ -956,7 +956,7 @@ static DerivedMesh *getEditMeshDerivedMesh(EditMesh *em, float (*vertexCos)[3]) for(i=0, eve= em->verts.first; eve; i++, eve=eve->next) { float *no = emdm->vertexNos[i]; - + /* following Mesh convention; we use vertex coordinate itself for normal in this case */ if (Normalise(no)==0.0) { VECCOPY(no, vertexCos[i]); Normalise(no); diff --git a/source/blender/blenkernel/intern/anim.c b/source/blender/blenkernel/intern/anim.c index e7000838f7d..3f7c28e0944 100644 --- a/source/blender/blenkernel/intern/anim.c +++ b/source/blender/blenkernel/intern/anim.c @@ -471,6 +471,10 @@ static void particle_duplilist(ListBase *lb, Scene *sce, Object *par, PartEff *p /* temp copy, to have ipos etc to work OK */ copyob= *ob; + /* don't want parent animation to apply on past object positions */ + if(!(paf->flag & PAF_STATIC)) + ob->parent= NULL; + for(a=0, pa= paf->keys, counter=0; a<paf->totpart; a++, pa+=paf->totkey, counter++) { if(paf->flag & PAF_STATIC) { @@ -516,14 +520,21 @@ static void particle_duplilist(ListBase *lb, Scene *sce, Object *par, PartEff *p //if(ctime < pa->time+pa->lifetime) { - /* to give ipos in object correct offset */ + /* to give ipos in object correct offset, ob->parent is NULLed */ where_is_object_time(ob, ctime-pa->time); where_is_particle(paf, pa, ctime, vec); if(paf->stype==PAF_VECT) { - where_is_particle(paf, pa, ctime+1.0f, vec1); - VecSubf(vec1, vec1, vec); + /* if particle died, we use previous position */ + if(ctime > pa->time+pa->lifetime) { + where_is_particle(paf, pa, pa->time+pa->lifetime-1.0f, vec1); + VecSubf(vec1, vec, vec1); + } + else { + where_is_particle(paf, pa, ctime+1.0f, vec1); + VecSubf(vec1, vec1, vec); + } q2= vectoquat(vec1, ob->trackflag, ob->upflag); QuatToMat3(q2, mat); diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c index bcc87ad9bed..6022c9eae19 100644 --- a/source/blender/blenkernel/intern/object.c +++ b/source/blender/blenkernel/intern/object.c @@ -1095,7 +1095,7 @@ void object_to_mat4(Object *ob, float mat[][4]) int enable_cu_speed= 1; -void ob_parcurve(Object *ob, Object *par, float mat[][4]) +static void ob_parcurve(Object *ob, Object *par, float mat[][4]) { Curve *cu; float q[4], vec[4], dir[3], *quat, x1, ctime; @@ -1165,7 +1165,7 @@ void ob_parcurve(Object *ob, Object *par, float mat[][4]) } } -void ob_parbone(Object *ob, Object *par, float mat[][4]) +static void ob_parbone(Object *ob, Object *par, float mat[][4]) { bPoseChannel *pchan; bArmature *arm; @@ -1194,7 +1194,7 @@ void ob_parbone(Object *ob, Object *par, float mat[][4]) VecAddf(mat[3], mat[3], vec); } -void give_parvert(Object *par, int nr, float *vec) +static void give_parvert(Object *par, int nr, float *vec) { EditMesh *em = G.editMesh; EditVert *eve; @@ -1273,7 +1273,7 @@ void give_parvert(Object *par, int nr, float *vec) else return; } -void ob_parvert3(Object *ob, Object *par, float mat[][4]) +static void ob_parvert3(Object *ob, Object *par, float mat[][4]) { float cmat[3][3], v1[3], v2[3], v3[3], q[4]; @@ -1307,12 +1307,6 @@ void set_no_parent_ipo(int val) no_parent_ipo= val; } -static float timefac= 1.0; /* 50 Hz, dtime:2 */ -void set_dtime(int dtime) -{ - timefac= ((float)(dtime-1))/2.0f; -} - static int during_script_flag=0; void disable_where_script(short on) { @@ -1392,7 +1386,7 @@ void where_is_object_time(Object *ob, float ctime) if(ob->partype & PARSLOW) { // include framerate - fac1= (float)(timefac/(1.0+ fabs(ob->sf))); + fac1= (1.0f/(1.0f+ fabs(ob->sf))); if(fac1>=1.0) return; fac2= 1.0f-fac1; |