4 using namespace meshio;
7 %include "std_vector.i"
8 %include "std_wstring.i"
9 %include "std_string.i"
10 %include "../include/color.h"
11 %include "../include/la.h"
12 %include "../include/pmd.h"
14 %template(VertexVector) std::vector<meshio::pmd::Vertex>;
15 %template(MaterialVector) std::vector<meshio::pmd::Material*>;
16 %template(BoneVector) std::vector<meshio::pmd::Bone>;
17 %template(IKVector) std::vector<meshio::pmd::IK>;
18 %template(MorphVector) std::vector<meshio::pmd::Morph>;
19 %template(RigidBodyVector) std::vector<meshio::pmd::RigidBody>;
20 %template(ConstraintVector) std::vector<meshio::pmd::Constraint>;
21 %template(UintVector) std::vector<unsigned int>;
22 %template(UshortVector) std::vector<unsigned short>;
23 %template(Vector3Vector) std::vector<meshio::pmd::Vector3>;
24 %template(PBoneVector) std::vector<meshio::pmd::Bone*>;
26 ///////////////////////////////////////////////////////////////////////////////
27 // meshio::pmd::IO::each_vertex
28 ///////////////////////////////////////////////////////////////////////////////
30 //! Thin wrapper for ONLY the increment operator
31 void _vertices_incr(std::vector<meshio::pmd::Vertex>::const_iterator* iter)
33 // increment the iterator
38 %extend meshio::pmd::IO {
40 def each_vertex(self):
41 iter = self._beginVertices()
43 vertex = self._dereferenceVertex(iter)
51 //! get the first element in the vector
52 std::vector<meshio::pmd::Vertex>::const_iterator* _beginVertices()
54 return new std::vector<meshio::pmd::Vertex>::const_iterator(
55 ($self->vertices.begin()));
58 //! dereference the iterator; return NULL if at the end
59 const meshio::pmd::Vertex* _dereferenceVertex(
60 const std::vector<meshio::pmd::Vertex>::const_iterator* iter )
62 // if at the end, return NULL
63 if (*iter == ($self)->vertices.end() ) {
66 // otherwise, return the face to which this iterator points
71 ///////////////////////////////////////////////////////////////////////////////
76 ///////////////////////////////////////////////////////////////////////////////
77 %extend meshio::pmd::IO {
79 meshio::pmd::Vertex * addVertex()
81 $self->vertices.push_back(meshio::pmd::Vertex());
82 return &($self->vertices.back());
85 meshio::pmd::Material *addMaterial()
87 $self->materials.push_back(new meshio::pmd::Material);
88 return $self->materials.back();
91 meshio::pmd::Bone *addBone()
93 $self->bones.push_back(meshio::pmd::Bone());
94 return &($self->bones.back());
97 meshio::pmd::Morph *addMorph()
99 $self->morph_list.push_back(meshio::pmd::Morph());
100 return &($self->morph_list.back());
103 meshio::pmd::IK *addIK()
105 $self->ik_list.push_back(meshio::pmd::IK());
106 return &($self->ik_list.back());
109 void addBoneDisplay(unsigned short bone_index, unsigned char display_index)
111 $self->bone_display_list.push_back(
112 std::make_pair(bone_index, display_index));
115 meshio::pmd::BoneDisplayName *addBoneDisplayName()
117 $self->bone_display_name_list.push_back(meshio::pmd::BoneDisplayName());
118 return &($self->bone_display_name_list.back());
121 meshio::pmd::ToonTexture *getToonTexture(int index)
123 return &($self->toon_textures[index]);