goat3d

changeset 37:d259a5094390

trying to figure out how to properly call C functions from the python plugin
author John Tsiombikas <nuclear@member.fsf.org>
date Sun, 06 Oct 2013 17:42:43 +0300
parents 9a211986a28b
children 60f2037680ee
files exporters/blendgoat/src/blendgoat.py
diffstat 1 files changed, 10 insertions(+), 8 deletions(-) [+]
line diff
     1.1 --- a/exporters/blendgoat/src/blendgoat.py	Sun Oct 06 15:34:45 2013 +0300
     1.2 +++ b/exporters/blendgoat/src/blendgoat.py	Sun Oct 06 17:42:43 2013 +0300
     1.3 @@ -16,12 +16,11 @@
     1.4  }
     1.5  
     1.6  class ExportGoat3D(bpy.types.Operator, ExportHelper):
     1.7 -	bl_idname = "export.goat3d"
     1.8 -	bl_label = "export"
     1.9 +	bl_idname = "export_scene.goat3d"
    1.10 +	bl_label = "Export Goat3D Scene"
    1.11  	bl_options = {'PRESET'}
    1.12  	filename_ext = ".goatsce"
    1.13 -
    1.14 -	fname = bpy.props.StringProperty(subtype="FILE_PATH")
    1.15 +	filter_glob = bpy.props.StringProperty(default="*.goatsce", options={'HIDDEN'})
    1.16  
    1.17  	@classmethod
    1.18  	def poll(cls, ctx):
    1.19 @@ -32,6 +31,7 @@
    1.20  		if not libname:
    1.21  			self.report({'ERROR'}, "Could not find the goat3d library! make sure it's installed.")
    1.22  			return {'CANCELLED'}
    1.23 +
    1.24  		libgoat = CDLL(libname)
    1.25  		if not libgoat:
    1.26  			self.report({'ERROR'}, "Could not open goat3d library!")
    1.27 @@ -45,17 +45,19 @@
    1.28  		goat3d_free.argtypes = [c_void_p]
    1.29  		goat3d_free.restype = None
    1.30  
    1.31 -		goat3d_save_file = libgoat.goat3d_save_file
    1.32 -		goat3d_save_file.argtypes = [c_void_p, c_char_p]
    1.33 +		goat3d_save = libgoat.goat3d_save
    1.34 +		goat3d_save.argtypes = [c_void_p, c_char_p]
    1.35  
    1.36 -		self.report({'INFO'}, "Exporting goat3d file")
    1.37 +		print("Exporting goat3d file: " + self.filepath)
    1.38  
    1.39  		goat = goat3d_create()
    1.40  		if not goat:
    1.41  			self.report({'ERROR'}, "Failed to create goat3d object")
    1.42  			return {'CANCELLED'}
    1.43  
    1.44 -		goat3d_save_file(goat, "/tmp/lala.xml")
    1.45 +		print(type(goat))
    1.46 +		print(type(self.filepath))
    1.47 +		goat3d_save(goat, c_char_p(self.filepath))
    1.48  		goat3d_free(goat)
    1.49  		return {'FINISHED'}
    1.50