Fix T61473: Crash particle system is updating
Original and localized particle settings were sharing some of the runtime pointers.
This commit is contained in:
parent
0e3a2acbfa
commit
f2a21472c4
|
@ -110,6 +110,7 @@ typedef struct EffectorRelation {
|
|||
|
||||
|
||||
struct PartDeflect *BKE_partdeflect_new(int type);
|
||||
struct PartDeflect *BKE_partdeflect_copy(const struct PartDeflect *pd_src);
|
||||
void BKE_partdeflect_free(struct PartDeflect *pd);
|
||||
|
||||
struct ListBase *BKE_effector_relations_create(
|
||||
|
|
|
@ -131,6 +131,18 @@ PartDeflect *BKE_partdeflect_new(int type)
|
|||
|
||||
/************************ PARTICLES ***************************/
|
||||
|
||||
PartDeflect *BKE_partdeflect_copy(const struct PartDeflect *pd_src)
|
||||
{
|
||||
if (pd_src == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
PartDeflect *pd_dst = MEM_dupallocN(pd_src);
|
||||
if (pd_dst->rng != NULL) {
|
||||
pd_dst->rng = BLI_rng_copy(pd_dst->rng);
|
||||
}
|
||||
return pd_dst;
|
||||
}
|
||||
|
||||
void BKE_partdeflect_free(PartDeflect *pd)
|
||||
{
|
||||
if (!pd) {
|
||||
|
|
|
@ -3297,8 +3297,8 @@ void BKE_particlesettings_twist_curve_init(ParticleSettings *part)
|
|||
void BKE_particlesettings_copy_data(
|
||||
Main *UNUSED(bmain), ParticleSettings *part_dst, const ParticleSettings *part_src, const int UNUSED(flag))
|
||||
{
|
||||
part_dst->pd = MEM_dupallocN(part_src->pd);
|
||||
part_dst->pd2 = MEM_dupallocN(part_src->pd2);
|
||||
part_dst->pd = BKE_partdeflect_copy(part_src->pd);
|
||||
part_dst->pd2 = BKE_partdeflect_copy(part_src->pd2);
|
||||
part_dst->effector_weights = MEM_dupallocN(part_src->effector_weights);
|
||||
part_dst->fluid = MEM_dupallocN(part_src->fluid);
|
||||
|
||||
|
|
|
@ -37,6 +37,7 @@ typedef struct RNG_THREAD_ARRAY RNG_THREAD_ARRAY;
|
|||
|
||||
struct RNG *BLI_rng_new(unsigned int seed);
|
||||
struct RNG *BLI_rng_new_srandom(unsigned int seed);
|
||||
struct RNG *BLI_rng_copy(struct RNG *rng) ATTR_NONNULL(1);
|
||||
void BLI_rng_free(struct RNG *rng) ATTR_NONNULL(1);
|
||||
|
||||
void BLI_rng_seed(struct RNG *rng, unsigned int seed) ATTR_NONNULL(1);
|
||||
|
|
|
@ -76,6 +76,11 @@ RNG *BLI_rng_new_srandom(unsigned int seed)
|
|||
return rng;
|
||||
}
|
||||
|
||||
RNG *BLI_rng_copy(RNG *rng)
|
||||
{
|
||||
return MEM_dupallocN(rng);
|
||||
}
|
||||
|
||||
void BLI_rng_free(RNG *rng)
|
||||
{
|
||||
MEM_freeN(rng);
|
||||
|
|
Loading…
Reference in New Issue