[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [36401] trunk/blender/source/blender: fix for r36399

Campbell Barton ideasman42 at gmail.com
Sun May 1 07:41:09 CEST 2011


Revision: 36401
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=36401
Author:   campbellbarton
Date:     2011-05-01 05:41:08 +0000 (Sun, 01 May 2011)
Log Message:
-----------
fix for r36399
- missing copy, free calls to curve falloff.
- missing localizing call for texture preview.
- also moved versioning into do_versions()

Revision Links:
--------------
    http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=36399

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

Modified: trunk/blender/source/blender/blenkernel/intern/texture.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/texture.c	2011-05-01 04:40:59 UTC (rev 36400)
+++ trunk/blender/source/blender/blenkernel/intern/texture.c	2011-05-01 05:41:08 UTC (rev 36401)
@@ -486,7 +486,10 @@
 	
 	if(tex->coba) MEM_freeN(tex->coba);
 	if(tex->env) BKE_free_envmap(tex->env);
-	if(tex->pd) BKE_free_pointdensity(tex->pd);
+	if(tex->pd) {
+		curvemapping_free(tex->pd->falloff_curve);
+		BKE_free_pointdensity(tex->pd);
+	}
 	if(tex->vd) BKE_free_voxeldata(tex->vd);
 	BKE_free_animdata((struct ID *)tex);
 	
@@ -762,9 +765,15 @@
 	
 	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) {
+		texn->pd= MEM_dupallocN(texn->pd);
+		if(texn->pd->falloff_curve) {
+			texn->pd->falloff_curve = curvemapping_copy(texn->pd->falloff_curve);
+		}
+	}
+
 	if(texn->vd) texn->vd= MEM_dupallocN(texn->vd);
-	
 	if(tex->preview) texn->preview = BKE_previewimg_copy(tex->preview);
 
 	if(tex->nodetree) {
@@ -802,6 +811,8 @@
 			texn->pd->coba= MEM_dupallocN(texn->pd->coba);
 		}
 
+		texn->pd->falloff_curve= curvemapping_copy(texn->pd->falloff_curve);
+
 	}
 	if(texn->vd) {
 		texn->vd= MEM_dupallocN(texn->vd);

Modified: trunk/blender/source/blender/blenloader/intern/readfile.c
===================================================================
--- trunk/blender/source/blender/blenloader/intern/readfile.c	2011-05-01 04:40:59 UTC (rev 36400)
+++ trunk/blender/source/blender/blenloader/intern/readfile.c	2011-05-01 05:41:08 UTC (rev 36401)
@@ -2964,20 +2964,9 @@
 		tex->pd->point_tree = NULL;
 		tex->pd->coba= newdataadr(fd, tex->pd->coba);
 		tex->pd->falloff_curve= newdataadr(fd, tex->pd->falloff_curve);
-		
-		/*hack to avoid a do_versions patch*/
-		if (tex->pd->falloff_speed_scale == 0.0)
-			tex->pd->falloff_speed_scale = 100.0;
-		
-		if (!tex->pd->falloff_curve) {
-			tex->pd->falloff_curve = curvemapping_add(1, 0, 0, 1, 1);
-			
-			tex->pd->falloff_curve->preset = CURVE_PRESET_LINE;
-			tex->pd->falloff_curve->cm->flag &= ~CUMA_EXTEND_EXTRAPOLATE;
-			curvemap_reset(tex->pd->falloff_curve->cm, &tex->pd->falloff_curve->clipr, tex->pd->falloff_curve->preset, CURVEMAP_SLOPE_POSITIVE);
-			curvemapping_changed(tex->pd->falloff_curve, 0);
-		} else
+		if(tex->pd->falloff_curve) {
 			direct_link_curvemapping(fd, tex->pd->falloff_curve);
+		}
 	}
 	
 	tex->vd= newdataadr(fd, tex->vd);
@@ -11637,6 +11626,26 @@
 				}
 			}
 		}
+
+		{
+			/* Initialize texture point density curve falloff */
+			Tex *tex;
+			for(tex= main->tex.first; tex; tex= tex->id.next) {
+				if(tex->pd) {
+					if (tex->pd->falloff_speed_scale == 0.0)
+						tex->pd->falloff_speed_scale = 100.0;
+
+					if (!tex->pd->falloff_curve) {
+						tex->pd->falloff_curve = curvemapping_add(1, 0, 0, 1, 1);
+
+						tex->pd->falloff_curve->preset = CURVE_PRESET_LINE;
+						tex->pd->falloff_curve->cm->flag &= ~CUMA_EXTEND_EXTRAPOLATE;
+						curvemap_reset(tex->pd->falloff_curve->cm, &tex->pd->falloff_curve->clipr, tex->pd->falloff_curve->preset, CURVEMAP_SLOPE_POSITIVE);
+						curvemapping_changed(tex->pd->falloff_curve, 0);
+					}
+				}
+			}
+		}
 	}
 	
 	/* WATCH IT!!!: pointers from libdata have not been converted yet here! */




More information about the Bf-blender-cvs mailing list