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>2009-08-14 20:25:59 +0400
committerJanne Karhu <jhkarh@gmail.com>2009-08-14 20:25:59 +0400
commit47a41ad055f40a140b862499ca3955081e860a76 (patch)
tree7c7d15fec18a0448407eda491f828dd4044e171a /source/blender/blenkernel
parent0ba5cf245023e8c2310cdcbfe03d9da21d9330a5 (diff)
Proper copy code for multiple point caches.
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r--source/blender/blenkernel/BKE_pointcache.h2
-rw-r--r--source/blender/blenkernel/intern/modifier.c2
-rw-r--r--source/blender/blenkernel/intern/object.c4
-rw-r--r--source/blender/blenkernel/intern/pointcache.c13
4 files changed, 16 insertions, 5 deletions
diff --git a/source/blender/blenkernel/BKE_pointcache.h b/source/blender/blenkernel/BKE_pointcache.h
index b83afb6b28f..c8a7a1cbf90 100644
--- a/source/blender/blenkernel/BKE_pointcache.h
+++ b/source/blender/blenkernel/BKE_pointcache.h
@@ -192,7 +192,7 @@ struct PointCache *BKE_ptcache_add(struct ListBase *ptcaches);
void BKE_ptache_free_mem(struct PointCache *cache);
void BKE_ptcache_free(struct PointCache *cache);
void BKE_ptcache_free_list(struct ListBase *ptcaches);
-struct PointCache *BKE_ptcache_copy(struct PointCache *cache);
+struct PointCache *BKE_ptcache_copy_list(struct ListBase *ptcaches_new, struct ListBase *ptcaches_old);
/********************** Baking *********************/
diff --git a/source/blender/blenkernel/intern/modifier.c b/source/blender/blenkernel/intern/modifier.c
index 0c975a10c0a..ecba1c1a6ad 100644
--- a/source/blender/blenkernel/intern/modifier.c
+++ b/source/blender/blenkernel/intern/modifier.c
@@ -5978,7 +5978,7 @@ static void clothModifier_copyData(ModifierData *md, ModifierData *target)
tclmd->sim_parms = MEM_dupallocN(clmd->sim_parms);
tclmd->coll_parms = MEM_dupallocN(clmd->coll_parms);
- tclmd->point_cache = BKE_ptcache_copy(clmd->point_cache);
+ tclmd->point_cache = BKE_ptcache_copy_list(&tclmd->ptcaches, &clmd->ptcaches);
tclmd->clothObject = NULL;
}
diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c
index 150a5aa97aa..9423f80cba2 100644
--- a/source/blender/blenkernel/intern/object.c
+++ b/source/blender/blenkernel/intern/object.c
@@ -1026,7 +1026,7 @@ SoftBody *copy_softbody(SoftBody *sb)
sbn->scratch= NULL;
- sbn->pointcache= BKE_ptcache_copy(sb->pointcache);
+ sbn->pointcache= BKE_ptcache_copy_list(&sbn->ptcaches, &sb->ptcaches);
return sbn;
}
@@ -1085,7 +1085,7 @@ ParticleSystem *copy_particlesystem(ParticleSystem *psys)
psysn->reactevents.first = psysn->reactevents.last = NULL;
psysn->renderdata = NULL;
- psysn->pointcache= BKE_ptcache_copy(psys->pointcache);
+ psysn->pointcache= BKE_ptcache_copy_list(&psysn->ptcaches, &psys->ptcaches);
id_us_plus((ID *)psysn->part);
diff --git a/source/blender/blenkernel/intern/pointcache.c b/source/blender/blenkernel/intern/pointcache.c
index 7aa01de71d0..59e2c3f6d72 100644
--- a/source/blender/blenkernel/intern/pointcache.c
+++ b/source/blender/blenkernel/intern/pointcache.c
@@ -1630,7 +1630,7 @@ void BKE_ptcache_free_list(ListBase *ptcaches)
BLI_freelistN(ptcaches);
}
-PointCache *BKE_ptcache_copy(PointCache *cache)
+static PointCache *ptcache_copy(PointCache *cache)
{
PointCache *ncache;
@@ -1645,7 +1645,18 @@ PointCache *BKE_ptcache_copy(PointCache *cache)
return ncache;
}
+/* returns first point cache */
+PointCache *BKE_ptcache_copy_list(ListBase *ptcaches_new, ListBase *ptcaches_old)
+{
+ PointCache *cache = ptcaches_old->first;
+
+ ptcaches_new->first = ptcaches_new->last = NULL;
+ for(; cache; cache=cache->next)
+ BLI_addtail(ptcaches_new, ptcache_copy(cache));
+
+ return ptcaches_new->first;
+}
/* Baking */