diff options
-rw-r--r-- | source/blender/blenkernel/BKE_pointcache.h | 1 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/pointcache.c | 2 | ||||
-rw-r--r-- | source/blender/editors/physics/particle_edit.c | 22 |
3 files changed, 19 insertions, 6 deletions
diff --git a/source/blender/blenkernel/BKE_pointcache.h b/source/blender/blenkernel/BKE_pointcache.h index 170965a223a..03a86b6566a 100644 --- a/source/blender/blenkernel/BKE_pointcache.h +++ b/source/blender/blenkernel/BKE_pointcache.h @@ -258,6 +258,7 @@ int BKE_ptcache_data_size(int data_type); /* Memory cache read/write helpers. */ void BKE_ptcache_mem_init_pointers(struct PTCacheMem *pm); void BKE_ptcache_mem_incr_pointers(struct PTCacheMem *pm); +int BKE_ptcache_mem_seek_pointers(int point_index, struct PTCacheMem *pm); /* Copy a specific data type from cache data to point data. */ void BKE_ptcache_data_get(void **data, int type, int index, void *to); diff --git a/source/blender/blenkernel/intern/pointcache.c b/source/blender/blenkernel/intern/pointcache.c index 807e25955a7..6b8d5b3b70f 100644 --- a/source/blender/blenkernel/intern/pointcache.c +++ b/source/blender/blenkernel/intern/pointcache.c @@ -1328,7 +1328,7 @@ void BKE_ptcache_mem_incr_pointers(PTCacheMem *pm) pm->cur[i] = (char*)pm->cur[i] + ptcache_data_size[i]; } } -static int BKE_ptcache_mem_seek_pointers(int point_index, PTCacheMem *pm) +int BKE_ptcache_mem_seek_pointers(int point_index, PTCacheMem *pm) { int data_types = pm->data_types; int i, index = pm->index_array ? pm->index_array[point_index] - 1 : point_index; diff --git a/source/blender/editors/physics/particle_edit.c b/source/blender/editors/physics/particle_edit.c index d20e0e87934..b45b06d2a39 100644 --- a/source/blender/editors/physics/particle_edit.c +++ b/source/blender/editors/physics/particle_edit.c @@ -3663,6 +3663,8 @@ 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); } } @@ -3737,6 +3739,8 @@ 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_init_pointers(pm); LOOP_POINTS { @@ -4001,12 +4005,20 @@ static void PE_create_particle_edit(Scene *scene, Object *ob, PointCache *cache, LOOP_POINTS { if(psys) { - pa = psys->particles + p; - if((pm->next && pm->next->frame < pa->time) - || (pm->prev && pm->prev->frame >= pa->dietime)) { - BKE_ptcache_mem_incr_pointers(pm); + if(pm->index_array) { + if(pm->index_array[p]) + BKE_ptcache_mem_seek_pointers(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_incr_pointers(pm); + continue; + } + } } if(!point->totkey) { |