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.
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -1631,7 +1631,7 @@ static void *editMesh_to_undoMesh(void)
|
||||
EditFaceC *efac=NULL;
|
||||
EditSelectionC *esec=NULL;
|
||||
TFace *tface= NULL;
|
||||
int i, a;
|
||||
int a;
|
||||
|
||||
um= MEM_callocN(sizeof(UndoMesh), "undomesh");
|
||||
|
||||
|
||||
@@ -1651,6 +1651,7 @@ void recalc_editnormals(void)
|
||||
VecAddf(efa->v3->no, efa->v3->no, efa->n);
|
||||
}
|
||||
|
||||
/* following Mesh convention; we use vertex coordinate itself for normal in this case */
|
||||
for(eve= em->verts.first; eve; eve=eve->next) {
|
||||
if (Normalise(eve->no)==0.0) {
|
||||
VECCOPY(eve->no, eve->co);
|
||||
|
||||
Reference in New Issue
Block a user