[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [14934] branches/apricot: fix for triangle lightmap packing and remove some prints

Campbell Barton ideasman42 at gmail.com
Fri May 23 02:04:31 CEST 2008


Revision: 14934
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=14934
Author:   campbellbarton
Date:     2008-05-23 02:04:31 +0200 (Fri, 23 May 2008)

Log Message:
-----------
fix for triangle lightmap packing and remove some prints

Modified Paths:
--------------
    branches/apricot/release/scripts/uvcalc_lightmap.py
    branches/apricot/source/blender/python/api2_2x/Mesh.c

Modified: branches/apricot/release/scripts/uvcalc_lightmap.py
===================================================================
--- branches/apricot/release/scripts/uvcalc_lightmap.py	2008-05-22 23:25:32 UTC (rev 14933)
+++ branches/apricot/release/scripts/uvcalc_lightmap.py	2008-05-23 00:04:31 UTC (rev 14934)
@@ -313,14 +313,11 @@
 			for f in face_groups[0]:
 				x,y,z = f.cent
 				face_grid.setdefault( ( int(((x-xmin)/xdepth)*div), int(((y-ymin)/ydepth)*div) ), [] ).append(f)
-		print face_grid.keys()
+		
 		# Replace the old face list
 		face_groups[:] = face_grid.values()
 	
 	
-	print "Test1234", len(face_groups)
-	print face_groups
-	
 	for face_sel in face_groups:
 		print "\nStarting unwrap"
 		
@@ -337,10 +334,6 @@
 		
 		pretty_faces = [prettyface(f,skip_faces[i]) for i,f in enumerate(face_sel) if len(f) == 4]
 		
-		
-		print len(pretty_faces)
-		print pretty_faces
-		
 		# Do we have any tri's
 		if len(pretty_faces) != len(face_sel):
 			# Now add tri's, not so simple because we need to pair them up.
@@ -363,7 +356,7 @@
 				
 				return (f, lens, lens_order), noarea
 				
-			tri_lengths = [trylens(f,skip_faces[i]) for f,i in enumerate(face_sel) if len(f) == 3]
+			tri_lengths = [trylens(f,skip_faces[i]) for i,f in enumerate(face_sel) if len(f) == 3]
 			del trylens
 			
 			def trilensdiff(t1,t2):
@@ -384,7 +377,7 @@
 				best_noarea = False
 				
 				i=0
-				for tri2, noarea in enumerate(tri_lengths):
+				for tri2, noarea in tri_lengths:
 					diff = trilensdiff(tri1, tri2)
 					if diff < best_tri_diff:
 						best_tri_index = i
@@ -392,8 +385,8 @@
 					
 					if diff==0: break
 					i+=1
-				
-				pretty_faces.append(prettyface((tri1, tri_lengths.pop(best_tri_index) ))  )
+				tri2, noarea = tri_lengths.pop(best_tri_index)
+				pretty_faces.append(prettyface((tri1, tri2))  )
 		
 		
 		# Get the min, max and total areas
@@ -418,13 +411,7 @@
 		curr_len = max_len
 		
 		print '\tGenerating lengths...',
-
-		print "test"
-		print "test", min_len
-		print "test", curr_len
 		
-		print skip_faces
-		
 		lengths = []
 		while curr_len > min_len:
 			lengths.append(curr_len) 
@@ -436,6 +423,8 @@
 			if curr_len/4 < side_len/PREF_MARGIN_DIV:
 				break
 		
+		if not lengths:
+			lengths.append(curr_len)
 
 		
 		

Modified: branches/apricot/source/blender/python/api2_2x/Mesh.c
===================================================================
--- branches/apricot/source/blender/python/api2_2x/Mesh.c	2008-05-22 23:25:32 UTC (rev 14933)
+++ branches/apricot/source/blender/python/api2_2x/Mesh.c	2008-05-23 00:04:31 UTC (rev 14934)
@@ -4009,7 +4009,7 @@
 			xmaxi = (int)(ibuf->x * xmax) +1;
 			ymaxi = (int)(ibuf->y * ymax) +1;
 			
-			printf("%d %d %d %d \n", xmini, ymini, xmaxi, ymaxi);
+			/*printf("%d %d %d %d \n", xmini, ymini, xmaxi, ymaxi);*/
 			
 			if (xmini < 0) xmini = 0;
 			if (ymini < 0) ymini = 0;





More information about the Bf-blender-cvs mailing list