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:
authorSergey Sharybin <sergey.vfx@gmail.com>2012-09-27 18:37:20 +0400
committerSergey Sharybin <sergey.vfx@gmail.com>2012-09-27 18:37:20 +0400
commitc1abde5935eef790420308ba740ea45d14904708 (patch)
treeed29abab69a87954df48c09cc7c1896d7b7a0601 /source/blender/blenkernel/intern/pointcache.c
parente116d3a7be30c23707279a40089fb7483fe438e1 (diff)
Fix #32667: Curve softbodies doesn't render animation (cycles)
Issue was caused by cycles being duplicated curve objects before converting them to mesh. This duplication will loose pointcache which resulted in object not being properly deformed.
Diffstat (limited to 'source/blender/blenkernel/intern/pointcache.c')
-rw-r--r--source/blender/blenkernel/intern/pointcache.c43
1 files changed, 35 insertions, 8 deletions
diff --git a/source/blender/blenkernel/intern/pointcache.c b/source/blender/blenkernel/intern/pointcache.c
index 780528f4a0d..0d01bb33fc5 100644
--- a/source/blender/blenkernel/intern/pointcache.c
+++ b/source/blender/blenkernel/intern/pointcache.c
@@ -2663,32 +2663,59 @@ void BKE_ptcache_free_list(ListBase *ptcaches)
}
}
-static PointCache *ptcache_copy(PointCache *cache)
+static PointCache *ptcache_copy(PointCache *cache, int copy_data)
{
PointCache *ncache;
ncache= MEM_dupallocN(cache);
- /* hmm, should these be copied over instead? */
ncache->mem_cache.first = NULL;
ncache->mem_cache.last = NULL;
- ncache->cached_frames = NULL;
- ncache->edit = NULL;
- ncache->flag= 0;
- ncache->simframe= 0;
+ if (copy_data == FALSE) {
+ ncache->mem_cache.first = NULL;
+ ncache->mem_cache.last = NULL;
+ ncache->cached_frames = NULL;
+
+ ncache->flag= 0;
+ ncache->simframe= 0;
+ }
+ else {
+ PTCacheMem *pm;
+
+ for (pm = cache->mem_cache.first; pm; pm = pm->next) {
+ PTCacheMem *pmn = MEM_dupallocN(pm);
+ int i;
+
+ for (i = 0; i < BPHYS_TOT_DATA; i++) {
+ if (pmn->data[i])
+ pmn->data[i] = MEM_dupallocN(pm->data[i]);
+ }
+
+ BKE_ptcache_mem_pointers_init(pm);
+
+ BLI_addtail(&ncache->mem_cache, pmn);
+ }
+
+ if (ncache->cached_frames)
+ ncache->cached_frames = MEM_dupallocN(cache->cached_frames);
+ }
+
+ /* hmm, should these be copied over instead? */
+ ncache->edit = NULL;
return ncache;
}
+
/* returns first point cache */
-PointCache *BKE_ptcache_copy_list(ListBase *ptcaches_new, ListBase *ptcaches_old)
+PointCache *BKE_ptcache_copy_list(ListBase *ptcaches_new, ListBase *ptcaches_old, int copy_data)
{
PointCache *cache = ptcaches_old->first;
ptcaches_new->first = ptcaches_new->last = NULL;
for (; cache; cache=cache->next)
- BLI_addtail(ptcaches_new, ptcache_copy(cache));
+ BLI_addtail(ptcaches_new, ptcache_copy(cache, copy_data));
return ptcaches_new->first;
}