3 ///////////////////////////////////////////////////////////////////////////////
5 ///////////////////////////////////////////////////////////////////////////////
7 %pybuffer_string(const char *src);
11 using namespace meshio;
14 %include "std_vector.i"
15 %include "std_wstring.i"
16 %include "std_string.i"
17 %include "../include/color.h"
18 %include "../include/la.h"
19 %include "../include/pmd.h"
21 %template(VertexVector) std::vector<meshio::pmd::Vertex>;
22 %template(MaterialVector) std::vector<meshio::pmd::Material*>;
23 %template(BoneVector) std::vector<meshio::pmd::Bone>;
24 %template(IKVector) std::vector<meshio::pmd::IK>;
25 %template(MorphVector) std::vector<meshio::pmd::Morph>;
26 %template(RigidBodyVector) std::vector<meshio::pmd::RigidBody>;
27 %template(ConstraintVector) std::vector<meshio::pmd::Constraint>;
28 %template(UintVector) std::vector<unsigned int>;
29 %template(UshortVector) std::vector<unsigned short>;
30 %template(Vector3Vector) std::vector<meshio::pmd::Vector3>;
31 %template(PBoneVector) std::vector<meshio::pmd::Bone*>;
33 ///////////////////////////////////////////////////////////////////////////////
34 // meshio::pmd::IO::each_vertex
35 ///////////////////////////////////////////////////////////////////////////////
37 //! Thin wrapper for ONLY the increment operator
38 void _vertices_incr(std::vector<meshio::pmd::Vertex>::const_iterator* iter)
40 // increment the iterator
45 %extend meshio::pmd::IO {
47 def each_vertex(self):
48 iter = self._beginVertices()
50 vertex = self._dereferenceVertex(iter)
58 //! get the first element in the vector
59 std::vector<meshio::pmd::Vertex>::const_iterator* _beginVertices()
61 return new std::vector<meshio::pmd::Vertex>::const_iterator(
62 ($self->vertices.begin()));
65 //! dereference the iterator; return NULL if at the end
66 const meshio::pmd::Vertex* _dereferenceVertex(
67 const std::vector<meshio::pmd::Vertex>::const_iterator* iter )
69 // if at the end, return NULL
70 if (*iter == ($self)->vertices.end() ) {
73 // otherwise, return the face to which this iterator points
78 ///////////////////////////////////////////////////////////////////////////////
83 ///////////////////////////////////////////////////////////////////////////////
84 %extend meshio::pmd::IO {
86 meshio::pmd::Vertex * addVertex()
88 $self->vertices.push_back(meshio::pmd::Vertex());
89 return &($self->vertices.back());
92 meshio::pmd::Material *addMaterial()
94 $self->materials.push_back(new meshio::pmd::Material);
95 return $self->materials.back();
98 meshio::pmd::Bone *addBone()
100 $self->bones.push_back(meshio::pmd::Bone());
101 return &($self->bones.back());
104 meshio::pmd::Morph *addMorph()
106 $self->morph_list.push_back(meshio::pmd::Morph());
107 return &($self->morph_list.back());
110 meshio::pmd::IK *addIK()
112 $self->ik_list.push_back(meshio::pmd::IK());
113 return &($self->ik_list.back());
116 void addBoneDisplay(unsigned short bone_index, unsigned char display_index)
118 $self->bone_display_list.push_back(
119 std::make_pair(bone_index, display_index));
122 meshio::pmd::BoneDisplayName *addBoneDisplayName()
124 $self->bone_display_name_list.push_back(meshio::pmd::BoneDisplayName());
125 return &($self->bone_display_name_list.back());
128 meshio::pmd::ToonTexture *getToonTexture(int index)
130 return &($self->toon_textures[index]);