Fix semi-exit of particle edit mode after adding/removing hairs, when

child particles were enabled, should only free edit in case the parent
particle amount changes.
This commit is contained in:
Brecht Van Lommel 2010-02-02 18:54:23 +00:00
parent 104f46afdd
commit 820517ba91

@ -172,12 +172,6 @@ static void realloc_particles(ParticleSimulationData *sim, int new_totpart)
PARTICLE_P; PARTICLE_P;
int totpart, totsaved = 0; int totpart, totsaved = 0;
if(psys->edit && psys->free_edit) {
psys->free_edit(psys->edit);
psys->edit = NULL;
psys->free_edit = NULL;
}
if(new_totpart<0) { if(new_totpart<0) {
if(part->distr==PART_DISTR_GRID && part->from != PART_FROM_VERT) { if(part->distr==PART_DISTR_GRID && part->from != PART_FROM_VERT) {
totpart= part->grid_res; totpart= part->grid_res;
@ -190,6 +184,12 @@ static void realloc_particles(ParticleSimulationData *sim, int new_totpart)
totpart=new_totpart; totpart=new_totpart;
if(totpart && totpart != psys->totpart) { if(totpart && totpart != psys->totpart) {
if(psys->edit && psys->free_edit) {
psys->free_edit(psys->edit);
psys->edit = NULL;
psys->free_edit = NULL;
}
newpars= MEM_callocN(totpart*sizeof(ParticleData), "particles"); newpars= MEM_callocN(totpart*sizeof(ParticleData), "particles");
if(psys->part->phystype == PART_PHYS_BOIDS) if(psys->part->phystype == PART_PHYS_BOIDS)
newboids= MEM_callocN(totpart*sizeof(BoidParticle), "boid particles"); newboids= MEM_callocN(totpart*sizeof(BoidParticle), "boid particles");