diff SceneGraph/BlenderScript/export_xml.py @ 1035:ff0e6d00c060

bledenr script
author tkaito
date Mon, 29 Nov 2010 18:27:06 +0900
parents 22d7263cec2d
children
line wrap: on
line diff
--- a/SceneGraph/BlenderScript/export_xml.py	Fri Nov 26 04:35:34 2010 +0900
+++ b/SceneGraph/BlenderScript/export_xml.py	Mon Nov 29 18:27:06 2010 +0900
@@ -1,6 +1,6 @@
 #!BPY
 """Registration info for Blender menus:
-Name: 'Libps3 (.xml)'
+Name: 'Libps+x (.xml)'
 Blender: 240
 Group: 'Export'
 Tooltip: 'Export to (.xml) for libps3'
@@ -144,7 +144,7 @@
 		#str = ""
 		file.write("")
 		matrix = obj.getMatrix()
-
+		big = 6
 		for mindex in range(len(flist)):
 			fl = flist[mindex]
 			if fl != []:
@@ -166,9 +166,9 @@
 					tri_second = vlist[f[1]]
 					tri_third = vlist[f[2]]
 
-					file.write("\t\t\t%f %f %f\n" %(tri_first[0][0] + matrix[3][0], tri_first[0][1] + matrix[3][1], tri_first[0][2] + matrix[3][2]) )
-					file.write("\t\t\t%f %f %f\n" %(tri_second[0][0] + matrix[3][0], tri_second[0][1] + matrix[3][1], tri_second[0][2] + matrix[3][2]) )
-					file.write("\t\t\t%f %f %f\n" %(tri_third[0][0] + matrix[3][0], tri_third[0][1] + matrix[3][1], tri_third[0][2] + matrix[3][2]) )
+					file.write("\t\t\t%f %f %f\n" %(big*(tri_first[0][0]  + matrix[3][0]), big*(tri_first[0][1]  + matrix[3][1]), big*(tri_first[0][2]  + matrix[3][2])) )
+					file.write("\t\t\t%f %f %f\n" %(big*(tri_second[0][0] + matrix[3][0]), big*(tri_second[0][1] + matrix[3][1]), big*(tri_second[0][2] + matrix[3][2])) )
+					file.write("\t\t\t%f %f %f\n" %(big*(tri_third[0][0]  + matrix[3][0]), big*(tri_third[0][1]  + matrix[3][1]), big*(tri_third[0][2]  + matrix[3][2])) )
 				file.write("\t\t</coordinate>\n")
 
 				file.write("\t\t<normal>\n")
@@ -177,9 +177,9 @@
 					tri_second = vlist[f[1]]
 					tri_third = vlist[f[2]]
 
-					file.write("\t\t\t%f %f %f\n" %(tri_first[1][0], tri_first[1][1], tri_first[1][2]) )
-					file.write("\t\t\t%f %f %f\n" %(tri_second[1][0], tri_second[1][1], tri_second[1][2]) )
-					file.write("\t\t\t%f %f %f\n" %(tri_third[1][0], tri_third[1][1], tri_third[1][2]) )
+					file.write("\t\t\t%f %f %f\n" %(big*(tri_first[1][0]),  big*(tri_first[1][1]),  big*(tri_first[1][2])) )
+					file.write("\t\t\t%f %f %f\n" %(big*(tri_second[1][0]), big*(tri_second[1][1]), big*(tri_second[1][2])) )
+					file.write("\t\t\t%f %f %f\n" %(big*(tri_third[1][0]),  big*(tri_third[1][1]),  big*(tri_third[1][2])) )
 				file.write("\t\t</normal>\n" )
 
 				file.write("\t\t<model>\n" )
@@ -193,28 +193,26 @@
 						tri_first = vlist[f[0]]
 						tri_second = vlist[f[1]]
 						tri_third = vlist[f[2]]
-
-						file.write("\t\t\t%f %f\n" %(tri_first[2][0], tri_first[2][1]) )
-						file.write("\t\t\t%f %f\n" %(tri_second[2][0], tri_second[2][1]) )
-						file.write("\t\t\t%f %f\n" %(tri_third[2][0], tri_third[2][1]) )
+						file.write("\t\t\t%f %f\n" %(tri_first[2][0], (-1*(tri_first[2][1])+1 )))
+						file.write("\t\t\t%f %f\n" %(tri_second[2][0], (-1*(tri_second[2][1])+1 )))
+						file.write("\t\t\t%f %f\n" %(tri_third[2][0], (-1*(tri_third[2][1])+1 )))
 					file.write("\t\t</texture>\n")
 				else:
-					file.write("\t\t<texture/>\n")
-
-
+					file.write("\t\t<texture>\n")
+					for f in fl:
+						file.write("\t\t\t0.000000 0.000000\n")
+						file.write("\t\t\t0.000000 0.000000\n")
+						file.write("\t\t\t0.000000 0.000000\n")
+					file.write("\t\t</texture>\n")
 				### get texture_image and change base64 data
 				texture = mesh.faces[0].image
 				if texture:
-					file.write(loadTexture(texture))	
-					
+					file.write(loadTexture(texture))
 				else:
-					file.write("\t\t<image name=\"%s\">\n" %("sample_white.png") )
-
-					file.write("\t\t\tiVBORw0KGgoAAAANSUhEUgAAAAgAAAAICAAAAADhZOFXAAAAEElEQVQImWP8zwABTAwUMQBJQQEP\n");
-					file.write("\t\t\tlYH+agAAAABJRU5ErkJggg==\n");
-
+					file.write("\t\t<image name=\"%s\">\n" %("dummy.png") )
+					file.write("\t\t\tiVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAAAGUlEQVQokWP8/fs3AymAiSTVoxpG\n");
+					file.write("\t\t\tNQwpDQAwxQMRlevqcQAAAABJRU5ErkJggg==\n");
 					file.write("\t\t</image>\n")
-
 		#return str
 
 	vdata = []