OSDN Git Service

fix export_pmd
[meshio/pymeshio.git] / pymeshio / pmd / __init__.py
index f6c9bb3..13e5021 100644 (file)
@@ -7,7 +7,7 @@ import os
 import sys
 import struct
 import warnings
-import pymeshio.common
+from .. import common
 
 
 class Vertex(object):
@@ -154,10 +154,10 @@ class Bone(object):
         self.type=type
         self.parent_index=0xFFFF
         self.tail_index=0
-        self.tail=pymeshio.common.Vector3(0, 0, 0)
+        self.tail=common.Vector3(0, 0, 0)
         self.parent=None
         self.ik_index=0xFFFF
-        self.pos=pymeshio.common.Vector3(0, 0, 0)
+        self.pos=common.Vector3(0, 0, 0)
         self.children=[]
         self.english_name=''
 
@@ -329,7 +329,7 @@ class Morph(object):
 
     def append(self, index, x, y, z):
         self.indices.append(index)
-        self.pos_list.append(Vector3(x, y, z))
+        self.pos_list.append(common.Vector3(x, y, z))
 
     def __str__(self):
         return '<Skin name: "%s", type: %d, vertex: %d>' % (
@@ -347,8 +347,10 @@ class Morph(object):
 
 
 class BoneGroup(object):
-    __slots__=['_name', '_english_name']
-    def __init__(self, name='group'): self._name=name; self._english_name='center'
+    __slots__=['name', 'english_name']
+    def __init__(self, name=b'group', english_name=b'center'): 
+        self.name=name
+        self.english_name=english_name
 
 
 SHAPE_SPHERE=0
@@ -380,16 +382,16 @@ class RigidBody(object):
             bone_index, 
             collision_group, 
             no_collision_group, 
-            shape_type,
-            shape_size,
-            shape_position, 
-            shape_rotation, 
             mass,
             linear_damping, 
             angular_damping, 
             restitution, 
             friction, 
-            mode
+            mode,
+            shape_type=0,
+            shape_size=common.Vector3(),
+            shape_position=common.Vector3(), 
+            shape_rotation=common.Vector3() 
             ):
         self.name=name
         self.bone_index=bone_index
@@ -467,24 +469,6 @@ class Joint(object):
                 )
 
 
-class ToonTextures(object):
-    __slots__=['_toon_textures']
-    def __init__(self):
-        self._toon_textures=[]
-        for i in range(10):
-            self._toon_textures.append('toon%02d.bmp' % (i+1))
-
-    def __getitem__(self, key):
-        return from_str(self._toon_textures[key])
-
-    def __setitem__(self, key, value):
-        self._toon_textures[key]=to_str(value)
-
-    def __iter__(self):
-        for toon_texture in self._toon_textures:
-            yield from_str(toon_texture)
-
-
 class Model(object):
     """pmd loader class.
 
@@ -502,7 +486,6 @@ class Model(object):
             'vertices', 'indices', 'materials', 'bones', 
             'ik_list', 'morphs',
             'morph_indices', 'bone_group_list', 'bone_display_list',
-            'bone_group_english_list',
             'toon_textures',
             'rigidbodies', 'joints',
 
@@ -524,8 +507,7 @@ class Model(object):
         self.bone_group_list=[]
         self.bone_display_list=[]
         # extend
-        self.bone_group_english_list=[]
-        self.toon_textures=ToonTextures()
+        self.toon_textures=[b'']*10
         self.rigidbodies=[]
         self.joints=[]
         # innner use
@@ -554,7 +536,6 @@ class Model(object):
                 and self.morph_indices==rhs.morph_indices
                 and self.bone_group_list==rhs.bone_group_list
                 and self.bone_display_list==rhs.bone_display_list
-                and self.bone_group_english_list==rhs.bone_group_english_list
                 and self.toon_textures==rhs.toon_textures
                 and self.rigidbodies==rhs.rigidbodies
                 and self.joints==rhs.joints