Mercurial > touhou-blender
comparison io_scene_touhou/__init__.py @ 0:8265ef6db380
Hello Gensokyo _o/
author | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> |
---|---|
date | Tue, 05 Mar 2013 20:10:10 +0100 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:8265ef6db380 |
---|---|
1 # ##### BEGIN GPL LICENSE BLOCK ##### | |
2 # | |
3 # This program is free software; you can redistribute it and/or | |
4 # modify it under the terms of the GNU General Public License | |
5 # as published by the Free Software Foundation; either version 2 | |
6 # of the License, or (at your option) any later version. | |
7 # | |
8 # This program is distributed in the hope that it will be useful, | |
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
11 # GNU General Public License for more details. | |
12 # | |
13 # You should have received a copy of the GNU General Public License | |
14 # along with this program; if not, write to the Free Software Foundation, | |
15 # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | |
16 # | |
17 # ##### END GPL LICENSE BLOCK ##### | |
18 | |
19 # <pep8-80 compliant> | |
20 | |
21 | |
22 bl_info = { | |
23 "name": "Touhou stage format (.std)", | |
24 "author": "Emmanuel Gil Peyrot", | |
25 "version": (0, 0), | |
26 "blender": (2, 66, 0), | |
27 "location": "File > Import-Export > Touhou Stage (.std) ", | |
28 "description": "Import-Export Touhou Stage", | |
29 "warning": "", | |
30 "wiki_url": "http://wiki.blender.org/index.php/Extensions:2.6/Py/" | |
31 "Scripts/Import-Export/Raw_Mesh_IO", | |
32 "tracker_url": "https://projects.blender.org/tracker/index.php?" | |
33 "func=detail&aid=25692", | |
34 "category": "Import-Export"} | |
35 | |
36 if "bpy" in locals(): | |
37 import imp | |
38 if "import_std" in locals(): | |
39 imp.reload(import_std) | |
40 else: | |
41 import bpy | |
42 | |
43 from bpy.props import StringProperty | |
44 | |
45 | |
46 class StageImporter(bpy.types.Operator): | |
47 """Load Touhou triangle mesh data""" | |
48 bl_idname = "import_mesh.std" | |
49 bl_label = "Import Touhou" | |
50 bl_options = {'UNDO'} | |
51 | |
52 filepath = StringProperty( | |
53 subtype='FILE_PATH', | |
54 ) | |
55 filter_glob = StringProperty(default="stage*.std", options={'HIDDEN'}) | |
56 | |
57 def execute(self, context): | |
58 from . import import_std | |
59 import_std.read(self.filepath) | |
60 return {'FINISHED'} | |
61 | |
62 def invoke(self, context, event): | |
63 wm = context.window_manager | |
64 wm.fileselect_add(self) | |
65 return {'RUNNING_MODAL'} | |
66 | |
67 | |
68 def menu_import(self, context): | |
69 self.layout.operator(StageImporter.bl_idname, text="Touhou Stage (.std)") | |
70 | |
71 | |
72 def register(): | |
73 bpy.utils.register_module(__name__) | |
74 bpy.types.INFO_MT_file_import.append(menu_import) | |
75 | |
76 | |
77 def unregister(): | |
78 bpy.utils.unregister_module(__name__) | |
79 bpy.types.INFO_MT_file_import.remove(menu_import) | |
80 | |
81 if __name__ == "__main__": | |
82 register() |