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:
authorCampbell Barton <ideasman42@gmail.com>2011-05-01 09:51:21 +0400
committerCampbell Barton <ideasman42@gmail.com>2011-05-01 09:51:21 +0400
commit81dabf76d7392c221decd339945ff3d5678a6023 (patch)
tree24b642a4a537eb6e059843adaa75f907c46945bc
parent84d55542c32e5c979f7ed7a301f28e7bb4c96d36 (diff)
copying texture point density was using inline dupalloc rather then BKE_copy_pointdensity() which NULL's runtime pointers.
-rw-r--r--source/blender/blenkernel/intern/texture.c29
1 files changed, 6 insertions, 23 deletions
diff --git a/source/blender/blenkernel/intern/texture.c b/source/blender/blenkernel/intern/texture.c
index c518403d663..866874ee5c8 100644
--- a/source/blender/blenkernel/intern/texture.c
+++ b/source/blender/blenkernel/intern/texture.c
@@ -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)