Proper copy code for multiple point caches.
This commit is contained in:
@@ -192,7 +192,7 @@ struct PointCache *BKE_ptcache_add(struct ListBase *ptcaches);
|
|||||||
void BKE_ptache_free_mem(struct PointCache *cache);
|
void BKE_ptache_free_mem(struct PointCache *cache);
|
||||||
void BKE_ptcache_free(struct PointCache *cache);
|
void BKE_ptcache_free(struct PointCache *cache);
|
||||||
void BKE_ptcache_free_list(struct ListBase *ptcaches);
|
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 *********************/
|
/********************** Baking *********************/
|
||||||
|
|
||||||
|
@@ -5978,7 +5978,7 @@ static void clothModifier_copyData(ModifierData *md, ModifierData *target)
|
|||||||
|
|
||||||
tclmd->sim_parms = MEM_dupallocN(clmd->sim_parms);
|
tclmd->sim_parms = MEM_dupallocN(clmd->sim_parms);
|
||||||
tclmd->coll_parms = MEM_dupallocN(clmd->coll_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;
|
tclmd->clothObject = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1026,7 +1026,7 @@ SoftBody *copy_softbody(SoftBody *sb)
|
|||||||
|
|
||||||
sbn->scratch= NULL;
|
sbn->scratch= NULL;
|
||||||
|
|
||||||
sbn->pointcache= BKE_ptcache_copy(sb->pointcache);
|
sbn->pointcache= BKE_ptcache_copy_list(&sbn->ptcaches, &sb->ptcaches);
|
||||||
|
|
||||||
return sbn;
|
return sbn;
|
||||||
}
|
}
|
||||||
@@ -1085,7 +1085,7 @@ ParticleSystem *copy_particlesystem(ParticleSystem *psys)
|
|||||||
psysn->reactevents.first = psysn->reactevents.last = NULL;
|
psysn->reactevents.first = psysn->reactevents.last = NULL;
|
||||||
psysn->renderdata = 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);
|
id_us_plus((ID *)psysn->part);
|
||||||
|
|
||||||
|
@@ -1630,7 +1630,7 @@ void BKE_ptcache_free_list(ListBase *ptcaches)
|
|||||||
BLI_freelistN(ptcaches);
|
BLI_freelistN(ptcaches);
|
||||||
}
|
}
|
||||||
|
|
||||||
PointCache *BKE_ptcache_copy(PointCache *cache)
|
static PointCache *ptcache_copy(PointCache *cache)
|
||||||
{
|
{
|
||||||
PointCache *ncache;
|
PointCache *ncache;
|
||||||
|
|
||||||
@@ -1645,7 +1645,18 @@ PointCache *BKE_ptcache_copy(PointCache *cache)
|
|||||||
|
|
||||||
return ncache;
|
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 */
|
/* Baking */
|
||||||
|
Reference in New Issue
Block a user