[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [36402] trunk/blender/source/blender/ blenkernel/intern/texture.c: copying texture point density was using inline dupalloc rather then BKE_copy_pointdensity () which NULL's runtime pointers.

Campbell Barton ideasman42 at gmail.com
Sun May 1 07:51:21 CEST 2011


Revision: 36402
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=36402
Author:   campbellbarton
Date:     2011-05-01 05:51:21 +0000 (Sun, 01 May 2011)
Log Message:
-----------
copying texture point density was using inline dupalloc rather then BKE_copy_pointdensity() which NULL's runtime pointers.

Modified Paths:
--------------
    trunk/blender/source/blender/blenkernel/intern/texture.c

Modified: trunk/blender/source/blender/blenkernel/intern/texture.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/texture.c	2011-05-01 05:41:08 UTC (rev 36401)
+++ trunk/blender/source/blender/blenkernel/intern/texture.c	2011-05-01 05:51:21 UTC (rev 36402)
@@ -486,10 +486,7 @@
 	
 	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 @@
 	
 	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 @@
 		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 @@
 	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 @@
 		MEM_freeN(pd->coba);
 		pd->coba = NULL;
 	}
+
+	curvemapping_free(pd->falloff_curve); /* can be NULL */
 }
 
 void BKE_free_pointdensity(PointDensity *pd)




More information about the Bf-blender-cvs mailing list