Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrecht Van Lommel <brechtvanlommel@pandora.be>2007-11-29 16:34:38 +0300
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2007-11-29 16:34:38 +0300
commit19f6bab818183fdb02a63f8d5035e4bc7056aebf (patch)
treeae1e3a630a9548fcb8d5366fd4b5f08083a751d4 /source/blender/src/editparticle.c
parent231b160a568e72f3c821e05f6330394b93bce82a (diff)
Bugfix:
Particle edit mode option interpolated for the add brush crashed with no existing particles.
Diffstat (limited to 'source/blender/src/editparticle.c')
-rw-r--r--source/blender/src/editparticle.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/source/blender/src/editparticle.c b/source/blender/src/editparticle.c
index e08ca3279d6..c9cf745fa44 100644
--- a/source/blender/src/editparticle.c
+++ b/source/blender/src/editparticle.c
@@ -1703,10 +1703,10 @@ static int remove_tagged_elements(Object *ob, ParticleSystem *psys)
}
}
- MEM_freeN(psys->particles);
+ if(psys->particles) MEM_freeN(psys->particles);
psys->particles = new_pars;
- MEM_freeN(edit->keys);
+ if(edit->keys) MEM_freeN(edit->keys);
edit->keys = new_keys;
if(edit->mirror_cache) {
@@ -2256,10 +2256,10 @@ static void brush_add(Object *ob, ParticleSystem *psys, short *mval, short numbe
memcpy(new_keys, edit->keys, totpart * sizeof(ParticleEditKey*));
/* change old arrays to new ones */
- MEM_freeN(psys->particles);
+ if(psys->particles) MEM_freeN(psys->particles);
psys->particles = new_pars;
- MEM_freeN(edit->keys);
+ if(edit->keys) MEM_freeN(edit->keys);
edit->keys = new_keys;
if(edit->mirror_cache) {
@@ -2267,8 +2267,6 @@ static void brush_add(Object *ob, ParticleSystem *psys, short *mval, short numbe
edit->mirror_cache = NULL;
}
- psys->totpart = newtotpart;
-
/* create tree for interpolation */
if(pset->flag & PE_INTERPOLATE_ADDED && psys->totpart){
tree=BLI_kdtree_new(psys->totpart);
@@ -2281,6 +2279,8 @@ static void brush_add(Object *ob, ParticleSystem *psys, short *mval, short numbe
BLI_kdtree_balance(tree);
}
+ psys->totpart = newtotpart;
+
/* create new elements */
pa = psys->particles + totpart;
key = edit->keys + totpart;
@@ -2691,10 +2691,10 @@ void PE_mirror_x(int tagged)
memcpy(new_pars, psys->particles, totpart*sizeof(ParticleData));
memcpy(new_keys, edit->keys, totpart*sizeof(ParticleEditKey*));
- MEM_freeN(psys->particles);
+ if(psys->particles) MEM_freeN(psys->particles);
psys->particles= new_pars;
- MEM_freeN(edit->keys);
+ if(edit->keys) MEM_freeN(edit->keys);
edit->keys= new_keys;
if(edit->mirror_cache) {