goat3d

changeset 33:f43f4849c86a

started writing blender exporter
author John Tsiombikas <nuclear@member.fsf.org>
date Sat, 05 Oct 2013 03:07:45 +0300
parents 3d669155709d
children 8471225a460c
files exporters/goatblender/src/goatblender.py
diffstat 1 files changed, 42 insertions(+), 0 deletions(-) [+]
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/exporters/goatblender/src/goatblender.py	Sat Oct 05 03:07:45 2013 +0300
     1.3 @@ -0,0 +1,42 @@
     1.4 +# Goat3D Blender >2.5 exporter
     1.5 +import bpy;
     1.6 +from bpy_extras.io_utils import ExportHelper
     1.7 +
     1.8 +bl_info = {
     1.9 +	"name": "Goat3D scene",
    1.10 +	"author": "John Tsiombikas",
    1.11 +	"version": (0, 1),
    1.12 +	"location": "File > Import-Export",
    1.13 +	"description": "Mutant Stargoat, Goat3D scene file format: http://code.google.com/p/goat3d/",
    1.14 +	"category": "Import-Export"
    1.15 +}
    1.16 +
    1.17 +class ExportGoat3D(bpy.types.Operator, ExportHelper):
    1.18 +	bl_idname = "export.goat3d"
    1.19 +	bl_label = "Goat3D scene export"
    1.20 +
    1.21 +	fname = bpy.props.Stringproperty(subtype="FILE_PATH")
    1.22 +
    1.23 +	@classmethod
    1.24 +	def poll(cls, ctx):
    1.25 +		return ctx.object is not None
    1.26 +
    1.27 +	def execute(self, context):
    1.28 +		file = open(self.filepath, "w")
    1.29 +		file.write("foobar " + ctx.object.name)
    1.30 +		return {'FINISHED'}
    1.31 +
    1.32 +def menu_func(self, ctx):
    1.33 +	self.layout.operator_context = 'INVOKE_DEFAULT'
    1.34 +	self.layout.operator(ExportGoat3D.bl_idname, text="Goat3D scene export")
    1.35 +
    1.36 +def register():
    1.37 +	bpy.utils.register_module(__name__)
    1.38 +	bpy.types.INFO_MT_file_export.append(menu_func)
    1.39 +
    1.40 +def unregister():
    1.41 +	bpy.utils.unregister_module(__name__)
    1.42 +	bpy.types.INFO_MT_file_export.remove(menu_func)
    1.43 +
    1.44 +if __name__ == "__main__":
    1.45 +	register()