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:
authorJanne Karhu <jhkarh@gmail.com>2011-01-09 10:41:51 +0300
committerJanne Karhu <jhkarh@gmail.com>2011-01-09 10:41:51 +0300
commite32bbef017df64a99acedd4f3f4ba32713c50a3b (patch)
tree881bf3c46da067ae6715a77a1763f2eb04d7600c /source/blender/editors/physics/particle_edit.c
parent76a762aa51a4cb774dfd7940fb77916037efad8c (diff)
Fix for [#25544] Blender crashes when changing the particles emission amount
* I've getting bad feelings about the point cache index_array for a while (cause for this bug too), so from now on memory cache uses a simple binary search directly on the index data to handle queries to specific data points. * This is a bit slower than just checking from a dedicated array, but it's much less error prone, uses less memory and makes the code more readable too, so it's not a tough choice.
Diffstat (limited to 'source/blender/editors/physics/particle_edit.c')
-rw-r--r--source/blender/editors/physics/particle_edit.c24
1 files changed, 2 insertions, 22 deletions
diff --git a/source/blender/editors/physics/particle_edit.c b/source/blender/editors/physics/particle_edit.c
index cca5df50118..4ac4bf9fa9b 100644
--- a/source/blender/editors/physics/particle_edit.c
+++ b/source/blender/editors/physics/particle_edit.c
@@ -3719,8 +3719,6 @@ static void make_PTCacheUndo(PTCacheEdit *edit, PTCacheUndo *undo)
for(; pm; pm=pm->next) {
for(i=0; i<BPHYS_TOT_DATA; i++)
pm->data[i] = MEM_dupallocN(pm->data[i]);
-
- pm->index_array = MEM_dupallocN(pm->index_array);
}
}
@@ -3795,8 +3793,6 @@ static void get_PTCacheUndo(PTCacheEdit *edit, PTCacheUndo *undo)
for(i=0; i<BPHYS_TOT_DATA; i++)
pm->data[i] = MEM_dupallocN(pm->data[i]);
- pm->index_array = MEM_dupallocN(pm->index_array);
-
BKE_ptcache_mem_pointers_init(pm);
LOOP_POINTS {
@@ -4061,25 +4057,9 @@ static void PE_create_particle_edit(Scene *scene, Object *ob, PointCache *cache,
totframe++;
for(pm=cache->mem_cache.first; pm; pm=pm->next) {
- BKE_ptcache_mem_pointers_init(pm);
-
LOOP_POINTS {
- if(psys) {
- if(pm->index_array) {
- if(pm->index_array[p])
- BKE_ptcache_mem_pointers_seek(p, pm);
- else
- continue;
- }
- else {
- pa = psys->particles + p;
- if((pm->next && pm->next->frame < pa->time)
- || (pm->prev && pm->prev->frame >= pa->dietime)) {
- BKE_ptcache_mem_pointers_incr(pm);
- continue;
- }
- }
- }
+ if(BKE_ptcache_mem_pointers_seek(p, pm) == 0)
+ continue;
if(!point->totkey) {
key = point->keys = MEM_callocN(totframe*sizeof(PTCacheEditKey),"ParticleEditKeys");