OSDN Git Service

fix test
authorousttrue <ousttrue@gmail.com>
Sun, 2 Oct 2011 17:38:32 +0000 (02:38 +0900)
committerousttrue <ousttrue@gmail.com>
Sun, 2 Oct 2011 17:38:32 +0000 (02:38 +0900)
pymeshio/pmd/__init__.py
setup.py
test/pmd_test.py

index 13e5021..61b1d01 100644 (file)
@@ -352,6 +352,9 @@ class BoneGroup(object):
         self.name=name
         self.english_name=english_name
 
+    def __eq__(self, rhs):
+        return self.name==rhs.name and self.english_name==rhs.english_name
+
 
 SHAPE_SPHERE=0
 SHAPE_BOX=1
@@ -541,4 +544,53 @@ class Model(object):
                 and self.joints==rhs.joints
                 )
 
+    def diff(self, rhs):
+        if self.name!=rhs.name: 
+            print(self.name, rhs.name)
+            return
+        if self.comment!=rhs.comment: 
+            print(self.comment, rhs.comment)
+            return
+        if self.english_name!=rhs.english_name: 
+            print(self.english_name, rhs.english_name)
+            return
+        if self.english_comment!=rhs.english_comment: 
+            print(self.english_comment, rhs.english_comment)
+            return
+        if self.vertices!=rhs.vertices: 
+            print(self.vertices, rhs.vertices)
+            return
+        if self.indices!=rhs.indices: 
+            print(self.indices, rhs.indices)
+            return
+        if self.materials!=rhs.materials: 
+            print(self.materials, rhs.materials)
+            return
+        if self.bones!=rhs.bones: 
+            print(self.bones, rhs.bones)
+            return
+        if self.ik_list!=rhs.ik_list: 
+            print(self.ik_list, rhs.ik_list)
+            return
+        if self.morphs!=rhs.morphs: 
+            print(self.morphs, rhs.morphs)
+            return
+        if self.morph_indices!=rhs.morph_indices: 
+            print(self.morph_indices, rhs.morph_indices)
+            return
+        if self.bone_group_list!=rhs.bone_group_list: 
+            print(self.bone_group_list, rhs.bone_group_list)
+            return
+        if self.bone_display_list!=rhs.bone_display_list: 
+            print(self.bone_display_list, rhs.bone_display_list)
+            return
+        if self.toon_textures!=rhs.toon_textures: 
+            print(self.toon_textures, rhs.toon_textures)
+            return
+        if self.rigidbodies!=rhs.rigidbodies: 
+            print(self.rigidbodies, rhs.rigidbodies)
+            return
+        if self.joints!=rhs.joints: 
+            print(self.joints, rhs.joints)
+            return
 
index 3fbf300..141e944 100644 (file)
--- a/setup.py
+++ b/setup.py
@@ -7,7 +7,7 @@ import os
 import shutil
 
 name='pymeshio'
-version='2.0.2'
+version='2.1.0'
 short_description='pure python 3d model io library'
 long_description='''\
 `pymeshio` is a package for 3d model io.
@@ -41,8 +41,8 @@ Usage
 -----
 ::
 
-    >>> import pymeshio.pmx.loader
-    >>> m=pymeshio.pmx.loader.load('resources/初音ミクVer2.pmx')
+    >>> import pymeshio.pmx.reader
+    >>> m=pymeshio.pmx.reader.read('resources/初音ミクVer2.pmx')
     >>> print(m)
     <pmx-2.0 "Miku Hatsune" 12354vertices>
     >>> print(dir(m))
@@ -59,6 +59,10 @@ ToDo
 
 History
 -------
+2.1.0 (2011-10-02)
+
+* refactoring api
+
 2.0.2 (2011-10-01)
 ~~~~~~~~~~~~~~~~~~
 * fix for Python 2.7(remove anotation)
index 980ce96..914f6fe 100644 (file)
@@ -54,5 +54,7 @@ class TestPmd(unittest.TestCase):
         pymeshio.pmd.writer.write(out, model)
         # read out buffer again
         model2=pymeshio.pmd.reader.read(io.BytesIO(out.getvalue()))
+        model.diff(model2)
         self.assertEqual(model, model2)
 
+