forked from bartvdbraak/blender
copying texture point density was using inline dupalloc rather then BKE_copy_pointdensity() which NULL's runtime pointers.
This commit is contained in:
parent
84d55542c3
commit
81dabf76d7
@ -486,10 +486,7 @@ void free_texture(Tex *tex)
|
||||
|
||||
if(tex->coba) MEM_freeN(tex->coba);
|
||||
if(tex->env) BKE_free_envmap(tex->env);
|
||||
if(tex->pd) {
|
||||
curvemapping_free(tex->pd->falloff_curve);
|
||||
BKE_free_pointdensity(tex->pd);
|
||||
}
|
||||
if(tex->pd) BKE_free_pointdensity(tex->pd);
|
||||
if(tex->vd) BKE_free_voxeldata(tex->vd);
|
||||
BKE_free_animdata((struct ID *)tex);
|
||||
|
||||
@ -765,14 +762,7 @@ Tex *copy_texture(Tex *tex)
|
||||
|
||||
if(texn->coba) texn->coba= MEM_dupallocN(texn->coba);
|
||||
if(texn->env) texn->env= BKE_copy_envmap(texn->env);
|
||||
|
||||
if(texn->pd) {
|
||||
texn->pd= MEM_dupallocN(texn->pd);
|
||||
if(texn->pd->falloff_curve) {
|
||||
texn->pd->falloff_curve = curvemapping_copy(texn->pd->falloff_curve);
|
||||
}
|
||||
}
|
||||
|
||||
if(texn->pd) texn->pd= BKE_copy_pointdensity(texn->pd);
|
||||
if(texn->vd) texn->vd= MEM_dupallocN(texn->vd);
|
||||
if(tex->preview) texn->preview = BKE_previewimg_copy(tex->preview);
|
||||
|
||||
@ -804,16 +794,7 @@ Tex *localize_texture(Tex *tex)
|
||||
texn->env= BKE_copy_envmap(texn->env);
|
||||
id_us_min(&texn->env->ima->id);
|
||||
}
|
||||
if(texn->pd) {
|
||||
texn->pd= MEM_dupallocN(texn->pd);
|
||||
if(texn->pd->coba) {
|
||||
texn->pd->point_tree = NULL;
|
||||
texn->pd->coba= MEM_dupallocN(texn->pd->coba);
|
||||
}
|
||||
|
||||
texn->pd->falloff_curve= curvemapping_copy(texn->pd->falloff_curve);
|
||||
|
||||
}
|
||||
if(texn->pd) texn->pd= BKE_copy_pointdensity(texn->pd);
|
||||
if(texn->vd) {
|
||||
texn->vd= MEM_dupallocN(texn->vd);
|
||||
if(texn->vd->dataset)
|
||||
@ -1396,7 +1377,7 @@ PointDensity *BKE_copy_pointdensity(PointDensity *pd)
|
||||
pdn->point_tree = NULL;
|
||||
pdn->point_data = NULL;
|
||||
if(pdn->coba) pdn->coba= MEM_dupallocN(pdn->coba);
|
||||
|
||||
pdn->falloff_curve = curvemapping_copy(pdn->falloff_curve); /* can be NULL */
|
||||
return pdn;
|
||||
}
|
||||
|
||||
@ -1414,6 +1395,8 @@ void BKE_free_pointdensitydata(PointDensity *pd)
|
||||
MEM_freeN(pd->coba);
|
||||
pd->coba = NULL;
|
||||
}
|
||||
|
||||
curvemapping_free(pd->falloff_curve); /* can be NULL */
|
||||
}
|
||||
|
||||
void BKE_free_pointdensity(PointDensity *pd)
|
||||
|
Loading…
Reference in New Issue
Block a user