4 using namespace meshio;
7 %include "std_vector.i"
8 %include "std_wstring.i"
9 %include "../include/color.h"
10 %include "../include/la.h"
11 %include "../include/pmd.h"
13 %template(VertexVector) std::vector<meshio::pmd::Vertex>;
14 %template(MaterialVector) std::vector<meshio::pmd::Material*>;
15 %template(BoneVector) std::vector<meshio::pmd::Bone>;
16 %template(IKVector) std::vector<meshio::pmd::IK>;
17 %template(MorphVector) std::vector<meshio::pmd::Morph>;
18 %template(RigidBodyVector) std::vector<meshio::pmd::RigidBody>;
19 %template(ConstraintVector) std::vector<meshio::pmd::Constraint>;
20 %template(UintVector) std::vector<unsigned int>;
21 %template(UshortVector) std::vector<unsigned short>;
22 %template(Vector3Vector) std::vector<meshio::pmd::Vector3>;
23 %template(PBoneVector) std::vector<meshio::pmd::Bone*>;
25 ///////////////////////////////////////////////////////////////////////////////
26 // meshio::pmd::IO::each_vertex
27 ///////////////////////////////////////////////////////////////////////////////
29 //! Thin wrapper for ONLY the increment operator
30 void _vertices_incr(std::vector<meshio::pmd::Vertex>::const_iterator* iter)
32 // increment the iterator
37 %extend meshio::pmd::IO {
39 def each_vertex(self):
40 iter = self._beginVertices()
42 vertex = self._dereferenceVertex(iter)
50 //! get the first element in the vector
51 std::vector<meshio::pmd::Vertex>::const_iterator* _beginVertices()
53 return new std::vector<meshio::pmd::Vertex>::const_iterator(
54 ($self->vertices.begin()));
57 //! dereference the iterator; return NULL if at the end
58 const meshio::pmd::Vertex* _dereferenceVertex(
59 const std::vector<meshio::pmd::Vertex>::const_iterator* iter )
61 // if at the end, return NULL
62 if (*iter == ($self)->vertices.end() ) {
65 // otherwise, return the face to which this iterator points
70 ///////////////////////////////////////////////////////////////////////////////
75 ///////////////////////////////////////////////////////////////////////////////
76 %extend meshio::pmd::IO {
78 meshio::pmd::Vertex * addVertex()
80 $self->vertices.push_back(meshio::pmd::Vertex());
81 return &($self->vertices.back());
84 meshio::pmd::Material *addMaterial()
86 $self->materials.push_back(new meshio::pmd::Material);
87 return $self->materials.back();
90 meshio::pmd::Bone *addBone()
92 $self->bones.push_back(meshio::pmd::Bone());
93 return &($self->bones.back());
96 meshio::pmd::Morph *addMorph()
98 $self->morph_list.push_back(meshio::pmd::Morph());
99 return &($self->morph_list.back());
102 meshio::pmd::IK *addIK()
104 $self->ik_list.push_back(meshio::pmd::IK());
105 return &($self->ik_list.back());