Fix for bug #8467: a softbody hair crash.

This commit is contained in:
Brecht Van Lommel
2008-03-14 18:21:06 +00:00
parent 56d7a612e3
commit 7f556ba4ef
3 changed files with 8 additions and 6 deletions

View File

@@ -212,7 +212,7 @@ int psys_check_enabled(struct Object *ob, struct ParticleSystem *psys);
void psys_free_settings(struct ParticleSettings *part);
void free_child_path_cache(struct ParticleSystem *psys);
void psys_free_path_cache(struct ParticleSystem *psys);
void free_hair(struct ParticleSystem *psys);
void free_hair(struct ParticleSystem *psys, int softbody);
void free_keyed_keys(struct ParticleSystem *psys);
void psys_free(struct Object * ob, struct ParticleSystem * psys);
void psys_free_children(struct ParticleSystem *psys);

View File

@@ -275,7 +275,8 @@ void psys_free_settings(ParticleSettings *part)
if(part->pd)
MEM_freeN(part->pd);
}
void free_hair(ParticleSystem *psys)
void free_hair(ParticleSystem *psys, int softbody)
{
ParticleData *pa;
int i, totpart=psys->totpart;
@@ -288,7 +289,7 @@ void free_hair(ParticleSystem *psys)
psys->flag &= ~PSYS_HAIR_DONE;
if(psys->soft) {
if(softbody && psys->soft) {
sbFree(psys->soft);
psys->soft = NULL;
}
@@ -342,7 +343,7 @@ void psys_free(Object *ob, ParticleSystem * psys)
psys_free_path_cache(psys);
free_hair(psys);
free_hair(psys, 1);
free_keyed_keys(psys);

View File

@@ -4476,7 +4476,7 @@ static void system_step(Object *ob, ParticleSystem *psys, ParticleSystemModifier
part->rotfrom = PART_ROT_IINCR;
}
else
free_hair(psys);
free_hair(psys, 1);
psys->softflag= 0;
psys->recalc &= ~PSYS_TYPE;
@@ -4656,7 +4656,8 @@ void particle_system_update(Object *ob, ParticleSystem *psys){
if(psys->part->type==PART_HAIR && hair_needs_recalc(psys)){
float hcfra=0.0f;
int i;
free_hair(psys);
free_hair(psys, 0);
/* first step is negative so particles get killed and reset */
psys->cfra=1.0f;