[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [16914] trunk/blender/source/blender/src/ retopo.c: Bugfix #17720

Ton Roosendaal ton at blender.org
Sat Oct 4 13:04:11 CEST 2008


Revision: 16914
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=16914
Author:   ton
Date:     2008-10-04 13:04:09 +0200 (Sat, 04 Oct 2008)

Log Message:
-----------
Bugfix #17720

Retopo crashed on undo-redo, caused by bad copying of data for undo stack.
I solved crash or corruptions, but it still is pretty weak code here.

Modified Paths:
--------------
    trunk/blender/source/blender/src/retopo.c

Modified: trunk/blender/source/blender/src/retopo.c
===================================================================
--- trunk/blender/source/blender/src/retopo.c	2008-10-04 09:43:58 UTC (rev 16913)
+++ trunk/blender/source/blender/src/retopo.c	2008-10-04 11:04:09 UTC (rev 16914)
@@ -86,8 +86,24 @@
 } RetopoPaintHit;
 
 static void retopo_do_2d(View3D *v3d, double proj[2], float *v, char adj);
-static void retopo_paint_debug_print(RetopoPaintData *rpd);
 
+#if 0
+static void retopo_paint_debug_print(RetopoPaintData *rpd)
+{
+	RetopoPaintLine *l;
+	RetopoPaintPoint *p;
+	
+	for(l= rpd->lines.first; l; l= l->next) {
+		printf("Line:\n");
+		for(p= l->points.first; p; p= p->next) {
+			printf("   Point(%d: %d,%d)\n",p->index,p->loc.x,p->loc.y);
+		}
+	}
+	
+	fflush(stdout);
+}
+#endif
+
 /* Painting */
 RetopoPaintData *get_retopo_paint_data(void)
 {
@@ -708,17 +724,22 @@
 
 	memcpy(copy,rpd,sizeof(RetopoPaintData));
 	copy->lines.first= copy->lines.last= NULL;
+	copy->nearest.next= copy->nearest.prev= NULL;
+	copy->nearest.line= NULL;
+	copy->nearest.first= 0;
+	
 	for(l= rpd->lines.first; l; l= l->next) {
-		lcp= MEM_mallocN(sizeof(RetopoPaintLine),"RetopoPaintLineCopy");
-		memcpy(lcp,l,sizeof(RetopoPaintLine));
-		BLI_addtail(&copy->lines,lcp);
+		lcp= MEM_dupallocN(l);
+		BLI_addtail(&copy->lines, lcp);
 		
 		lcp->hitlist.first= lcp->hitlist.last= NULL;
 		lcp->points.first= lcp->points.last= NULL;
+		lcp->cyclic= NULL;
+		
 		for(p= l->points.first; p; p= p->next) {
-			pcp= MEM_mallocN(sizeof(RetopoPaintPoint),"RetopoPaintPointCopy");
-			memcpy(pcp,p,sizeof(RetopoPaintPoint));
-			BLI_addtail(&lcp->points,pcp);
+			pcp= MEM_dupallocN(p);
+			BLI_addtail(&lcp->points, pcp);
+			pcp->eve= NULL;
 		}
 	}
 
@@ -904,18 +925,3 @@
 		v3d->retopo_view_data= NULL;
 	}
 }
-
-static void retopo_paint_debug_print(RetopoPaintData *rpd)
-{
-	RetopoPaintLine *l;
-	RetopoPaintPoint *p;
-
-	for(l= rpd->lines.first; l; l= l->next) {
-		printf("Line:\n");
-		for(p= l->points.first; p; p= p->next) {
-			printf("   Point(%d: %d,%d)\n",p->index,p->loc.x,p->loc.y);
-		}
-	}
-
-	fflush(stdout);
-}





More information about the Bf-blender-cvs mailing list