changeset 1235:1bb43068289b draft

update blender script
author kazz <kazz@cr.ie.u-ryukyu.ac.jp>
date Thu, 20 Oct 2011 19:08:41 +0900
parents be0eb46dd20a
children bf913abaed15 fd9b7519a17b
files SceneGraph/BlenderScript/export_xml3.py
diffstat 1 files changed, 9 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/SceneGraph/BlenderScript/export_xml3.py	Thu Oct 20 00:02:53 2011 +0900
+++ b/SceneGraph/BlenderScript/export_xml3.py	Thu Oct 20 19:08:41 2011 +0900
@@ -258,10 +258,13 @@
 			else:
 				normal = face.normal
 			uvs = []
-			if not (mesh.uv_texture_stencil is None):
+			if mesh.uv_texture_stencil:
 				uv_texture = mesh.uv_texture_stencil.data[face.index]
 				uvs = [uv_texture.uv1, uv_texture.uv2, uv_texture.uv3, uv_texture.uv4]
-
+			print(len(uvs))
+			print(" ")
+			print(len(face.vertices))
+			print("\n")
 			if len(uvs) == len(face.vertices):
 				uv = uvs[vi]
 			else:
@@ -350,6 +353,8 @@
 				continue
 
 			data = ob_derived.to_mesh(sce, True, 'PREVIEW')
+#			data = bpy.data.meshes[ob_derived.name]
+			data.uv_texture_stencil = bpy.data.meshes[ob_derived.name].uv_texture_stencil
 #                       data = getMeshFromObject(ob_derived, None, True, False, sce)
 			if data:
 				data.transform(mat)
@@ -458,18 +463,13 @@
 	'''Export to Cerium XML file format.'''
 	bl_idname = "export.ps3cerium"
 	bl_label = 'Export PS3 Cerium'
+	filepath = StringProperty(subtype='FILE_PATH')
 
 	# List of operator properties, the attributes will be assigned
 	# to the class instance from the operator settings before calling.
 
-	path = StringProperty(subtype='FILE_PATH')
-
-#	path = StringProperty(name="File Path", description="File path used for exporting the Cerium XML file", maxlen= 1024, default= "")
-
-
 	def execute(self, context):
-#		save_xml(self.properties.path, context)
-		save_xml("/test.xml", context)
+		save_xml(bpy.path.ensure_ext(self.filepath, ".xml"), context)
 		return {'FINISHED'}
 	def invoke(self, context, event):
 		wm = context.window_manager