X-Git-Url: http://git.osdn.jp/view?a=blobdiff_plain;f=swig%2Fpmd.i;h=d2325f81412b294b5889b4f0e3de622fdf13abf9;hb=0432b9cff78fdbda82e8e193a903badce5d0af36;hp=723b7817e42487e61452ee77cd4cd6450324a97c;hpb=b9215aaa179f981e814eae39736f5ba45629a323;p=meshio%2Fmeshio.git diff --git a/swig/pmd.i b/swig/pmd.i index 723b781..d2325f8 100644 --- a/swig/pmd.i +++ b/swig/pmd.i @@ -1,10 +1,19 @@ %module pmd + +/////////////////////////////////////////////////////////////////////////////// +// bytearray typemap +/////////////////////////////////////////////////////////////////////////////// +%include +%pybuffer_string(const char *src); + %{ #include using namespace meshio; using namespace pmd; %} %include "std_vector.i" +%include "std_wstring.i" +%include "std_string.i" %include "../include/color.h" %include "../include/la.h" %include "../include/pmd.h" @@ -22,7 +31,7 @@ using namespace pmd; %template(PBoneVector) std::vector; /////////////////////////////////////////////////////////////////////////////// -// vertices +// meshio::pmd::IO::each_vertex /////////////////////////////////////////////////////////////////////////////// %inline %{ //! Thin wrapper for ONLY the increment operator @@ -66,3 +75,72 @@ const meshio::pmd::Vertex* _dereferenceVertex( } } +/////////////////////////////////////////////////////////////////////////////// +// addVertex +// addMaterial +// addBone +// addMorph +/////////////////////////////////////////////////////////////////////////////// +%extend meshio::pmd::IO { + +meshio::pmd::Vertex * addVertex() +{ + $self->vertices.push_back(meshio::pmd::Vertex()); + return &($self->vertices.back()); +} + +meshio::pmd::Material *addMaterial() +{ + $self->materials.push_back(new meshio::pmd::Material); + return $self->materials.back(); +} + +meshio::pmd::Bone *addBone() +{ + $self->bones.push_back(meshio::pmd::Bone()); + return &($self->bones.back()); +} + +meshio::pmd::Morph *addMorph() +{ + $self->morph_list.push_back(meshio::pmd::Morph()); + return &($self->morph_list.back()); +} + +meshio::pmd::IK *addIK() +{ + $self->ik_list.push_back(meshio::pmd::IK()); + return &($self->ik_list.back()); +} + +void addBoneDisplay(unsigned short bone_index, unsigned char display_index) +{ + $self->bone_display_list.push_back( + std::make_pair(bone_index, display_index)); +} + +meshio::pmd::BoneDisplayName *addBoneDisplayName() +{ + $self->bone_display_name_list.push_back(meshio::pmd::BoneDisplayName()); + return &($self->bone_display_name_list.back()); +} + +meshio::pmd::ToonTexture *getToonTexture(int index) +{ + return &($self->toon_textures[index]); +} + +meshio::pmd::RigidBody *addRigidBody() +{ + $self->rigidbodies.push_back(meshio::pmd::RigidBody()); + return &($self->rigidbodies.back()); +} + +meshio::pmd::Constraint *addConstraint() +{ + $self->constraints.push_back(meshio::pmd::Constraint()); + return &($self->constraints.back()); +} + +} +