• R/O
  • HTTP
  • SSH
  • HTTPS

meshio: Commit

3D model(pmd, mqo...) IO library using C++.


Commit MetaInfo

Revision2e20441ea9b71f8cf62b517868f4715da230f0cb (tree)
Time2011-05-04 00:14:04
Authorousttrue <ousttrue@gmai...>
Commiterousttrue

Log Message

add swig/python

Change Summary

Incremental Difference

--- /dev/null
+++ b/swig/mqo.i
@@ -0,0 +1,18 @@
1+%module(package="meshio") mqo
2+%{
3+#include "mqo.h"
4+%}
5+%include "../../src/mqo.h"
6+%include "../../src/la.h"
7+%include "../../src/color.h"
8+
9+%include "std_string.i"
10+
11+%include "std_vector.i"
12+namespace std {
13+ %template(Vector3Vector) vector<meshio::Vector3>;
14+ %template(MaterialVector) vector<meshio::mqo::Material>;
15+ %template(ObjectVector) vector<meshio::mqo::Object>;
16+ %template(FaceVector) vector<meshio::mqo::Face>;
17+}
18+
--- /dev/null
+++ b/swig/pmd.i
@@ -0,0 +1,26 @@
1+%module pmd
2+
3+%{
4+#include <pmd.h>
5+%}
6+%include "../../src/color.h"
7+%include "../../src/la.h"
8+%include "../../src/pmd.h"
9+
10+%include "std_pair.i"
11+%include "std_vector.i"
12+%template(VertexVector) std::vector<meshio::pmd::Vertex>;
13+%template(MaterialVector) std::vector<meshio::pmd::Material>;
14+%template(BoneVector) std::vector<meshio::pmd::Bone>;
15+%template(IKVector) std::vector<meshio::pmd::IK>;
16+%template(MorphVector) std::vector<meshio::pmd::Morph>;
17+%template(RigidBodyVector) std::vector<meshio::pmd::RigidBody>;
18+%template(ConstraintVector) std::vector<meshio::pmd::Constraint>;
19+%template(UintVector) std::vector<unsigned int>;
20+%template(UshortVector) std::vector<unsigned short>;
21+%template(Vector3Vector) std::vector<meshio::Vector3>;
22+%template(PBoneVector) std::vector<meshio::pmd::Bone*>;
23+%template(BoneGroupVector) std::vector<meshio::pmd::BoneGroup>;
24+%template(DisplayPair) std::pair<unsigned short, unsigned char>;
25+%template(BoneDisplayVector) std::vector<std::pair<unsigned short, unsigned char> >;
26+
--- /dev/null
+++ b/swig/python/__init__.py
@@ -0,0 +1,2 @@
1+import mqo
2+import pmd
--- /dev/null
+++ b/swig/python/setup.py
@@ -0,0 +1,35 @@
1+# swig -c++ -python -o mqo_wrap.cxx ../mqo.i
2+# swig -c++ -python -o pmd_wrap.cxx ../pmd.i
3+import os
4+from distutils.core import setup, Extension
5+
6+if os.name=='nt':
7+ extra_compile_args=[]
8+else:
9+ extra_compile_args=['-std=c++0x']
10+
11+setup(
12+ name='meshio',
13+ version='1.0',
14+ description='3D mesh IO library',
15+ py_modules=["__init__", "mqo", "pmd"],
16+ ext_modules = [
17+ Extension("_mqo",
18+ language="c++",
19+ sources=["mqo_wrap.cxx"],
20+ include_dirs=["../../src"],
21+ extra_compile_args=extra_compile_args,
22+ library_dirs=["../../debug"],
23+ libraries=["meshio"]
24+ ),
25+ Extension("_pmd",
26+ language="c++",
27+ sources=["pmd_wrap.cxx"],
28+ include_dirs=["../../src"],
29+ extra_compile_args=extra_compile_args,
30+ library_dirs=["../../debug"],
31+ libraries=["meshio"]
32+ ),
33+ ]
34+ )
35+
Show on old repository browser