• R/O
  • HTTP
  • SSH
  • HTTPS

pymeshio: コミット

pmdとmqoの入出力ライブラリと、それを使ったBlender2.5向けのaddon。


コミットメタ情報

リビジョン98b5d410b5584124dc2545acac78a2a513a4b1e7 (tree)
日時2011-10-12 11:36:25
作者ousttrue <ousttrue@gmai...>
コミッターousttrue

ログメッセージ

add blender26-meshio

変更サマリ

差分

--- /dev/null
+++ b/blender26-meshio/__init__.py
@@ -0,0 +1,57 @@
1+# coding: utf-8
2+
3+bl_info={
4+ 'category': 'Import-Export',
5+ 'name': 'extended MikuMikuDance model format(.pmx)',
6+ 'author': 'ousttrue',
7+ 'blender': (2, 6, 0),
8+ 'location': 'File > Import-Export',
9+ 'description': 'Import from the extended MikuMikuDance Model Format(.pmx)',
10+ 'warning': '', # used for warning icon and text in addons panel
11+ 'wiki_url': 'http://sourceforge.jp/projects/meshio/wiki/FrontPage',
12+ }
13+
14+if "bpy" in locals():
15+ import imp
16+ if "import_pmx" in locals():
17+ imp.reaload(import_pmx)
18+
19+
20+import bpy
21+import bpy_extras
22+
23+
24+class ImportPMX(bpy.types.Operator, bpy_extras.io_utils.ImportHelper):
25+ '''Import from the extended MikuMikuDance Model Format(.pmx)'''
26+ bl_idname='import_scene.mmd_pmx'
27+ bl_label='Import PMX'
28+ bl_options={'UNDO'}
29+ filename_ext='.pmx'
30+ filter_glob=bpy.props.StringProperty(
31+ default="*.pmx", options={'HIDDEN'})
32+
33+
34+ def execute(self, context):
35+ from . import import_pmx
36+ keywords=self.as_keywords()
37+ return import_pmx.load(self, context, **keywords)
38+
39+
40+def menu_func_import(self, context):
41+ self.layout.operator(ImportPMX.bl_idname,
42+ text="MikuMikuDance model (.pmx)",
43+ icon='PLUGIN'
44+ )
45+
46+def register():
47+ bpy.utils.register_module(__name__)
48+ bpy.types.INFO_MT_file_import.append(menu_func_import)
49+
50+def unregister():
51+ bpy.utils.unregister_module(__name__)
52+ bpy.types.INFO_MT_file_import.remove(menu_func_import)
53+
54+
55+if __name__=="__main__":
56+ register()
57+
--- /dev/null
+++ b/blender26-meshio/import_pmx.py
@@ -0,0 +1,15 @@
1+# coding: utf-8
2+
3+def load(operator, context, filepath, **kw):
4+ print(filepath)
5+ print(kw)
6+
7+ from .pymeshio.pmx import reader
8+ model=reader.read_from_file(filepath)
9+ if not model:
10+ print("fail to load %s" % filepath)
11+ return
12+ print(model)
13+
14+ return {'FINISHED'}
15+
--- a/setup.py
+++ b/setup.py
@@ -90,11 +90,18 @@ classifiers=[
9090 ]
9191
9292 # copy pymeshio dir for blender25 plugin
93-PYMESHIO_DIR_IN_BLENDER='blender25-meshio/pymeshio'
94-if os.path.exists(PYMESHIO_DIR_IN_BLENDER):
95- shutil.rmtree(PYMESHIO_DIR_IN_BLENDER)
96-print("copy pymeshio to blender-25")
97-shutil.copytree('pymeshio', PYMESHIO_DIR_IN_BLENDER)
93+PYMESHIO_DIR_IN_BLENDER25='blender25-meshio/pymeshio'
94+if os.path.exists(PYMESHIO_DIR_IN_BLENDER25):
95+ shutil.rmtree(PYMESHIO_DIR_IN_BLENDER25)
96+print("copy pymeshio to %s" % PYMESHIO_DIR_IN_BLENDER25)
97+shutil.copytree('pymeshio', PYMESHIO_DIR_IN_BLENDER25)
98+# copy pymeshio dir for blender26 plugin
99+PYMESHIO_DIR_IN_BLENDER26='blender26-meshio/pymeshio'
100+if os.path.exists(PYMESHIO_DIR_IN_BLENDER26):
101+ shutil.rmtree(PYMESHIO_DIR_IN_BLENDER26)
102+print("copy pymeshio to %s" % PYMESHIO_DIR_IN_BLENDER26)
103+shutil.copytree('pymeshio', PYMESHIO_DIR_IN_BLENDER26)
104+
98105
99106 setup(
100107 name=name,
旧リポジトリブラウザで表示