Proper copy code for multiple point caches.

This commit is contained in:
Janne Karhu
2009-08-14 16:25:59 +00:00
parent 0ba5cf2450
commit 47a41ad055
4 changed files with 16 additions and 5 deletions

View File

@@ -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 *********************/

View File

@@ -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;
}

View File

@@ -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);

View File

@@ -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 */