OSDN Git Service

update document
authorousttrue <ousttrue@gmail.com>
Thu, 6 Oct 2011 22:17:12 +0000 (07:17 +0900)
committerousttrue <ousttrue@gmail.com>
Thu, 6 Oct 2011 22:17:12 +0000 (07:17 +0900)
pymeshio/converter.py
pymeshio/mqo/reader.py
pymeshio/pmd/reader.py
pymeshio/pmd/writer.py
pymeshio/pmx/reader.py
pymeshio/pmx/writer.py
setup.py

index a78f322..c01df92 100644 (file)
@@ -14,9 +14,14 @@ class ConvertException(Exception):
     """
     pass
 
+
 def pmd_to_pmx(src):
     """
-    convert pmd model to pmx model.
+    return pymeshio.pmx.Model.
+
+    :Parameters:
+        src
+            pymeshio.pmd.Model
     """
     dst=pmx.Model()
     dst.name=src.name.decode("cp932")
index a5ada0b..47cb578 100644 (file)
@@ -159,12 +159,25 @@ class Reader(object):
 \r
 \r
 def read_from_file(path):\r
+    """\r
+    read from file path, then return the pymeshio.mqo.Model.\r
+\r
+    :Parameters:\r
+      path\r
+        file path\r
+    """\r
     with io.open(path, 'rb') as ios:\r
         return read(ios)\r
 \r
 \r
 def read(ios):\r
-    print(type(ios), ios)\r
+    """\r
+    read from ios, then return the pymeshio.mqo.Model.\r
+\r
+    :Parameters:\r
+      ios\r
+        input stream (in io.IOBase)\r
+    """\r
     assert(isinstance(ios, io.IOBase))\r
     reader=Reader(ios)\r
     model=mqo.Model()\r
index b120052..0b41da2 100644 (file)
@@ -181,10 +181,36 @@ def __read(reader, model):
 \r
 \r
 def read_from_file(path):\r
+    """\r
+    read from file path, then return the pymeshio.pmd.Model.\r
+\r
+    :Parameters:\r
+      path\r
+        file path\r
+\r
+    >>> import pymeshio.pmd.reader\r
+    >>> m=pymeshio.pmd.reader.read_from_file('resources/初音ミクVer2.pmd')\r
+    >>> print(m)\r
+    <pmd-2.0 "Miku Hatsune" 12354vertices>\r
+\r
+    """\r
     return read(io.BytesIO(common.readall(path)))\r
 \r
 \r
 def read(ios):\r
+    """\r
+    read from ios, then return the pymeshio.pmd.Model.\r
+\r
+    :Parameters:\r
+      ios\r
+        input stream (in io.IOBase)\r
+\r
+    >>> import pymeshio.pmd.reader\r
+    >>> m=pymeshio.pmd.reader.read(io.open('resources/初音ミクVer2.pmd', 'rb'))\r
+    >>> print(m)\r
+    <pmd-2.0 "Miku Hatsune" 12354vertices>\r
+\r
+    """\r
     assert(isinstance(ios, io.IOBase))\r
     reader=common.BinaryReader(ios)\r
 \r
index 136ec7a..cd526fa 100644 (file)
@@ -119,6 +119,19 @@ class Writer(common.BinaryWriter):
 \r
 \r
 def write(ios, model):\r
+    """\r
+    write model to ios.\r
+\r
+    :Parameters:\r
+        ios\r
+            output stream (in io.IOBase)\r
+        model\r
+            pmd model\r
+\r
+    >>> import pymeshio.pmd.writer\r
+    >>> pymeshio.pmd.writer.write(io.open('out.pmd', 'wb'))\r
+\r
+    """\r
     assert(isinstance(ios, io.IOBase))\r
     assert(isinstance(model, pmd.Model))\r
     writer=Writer(ios)\r
index 8c08585..59a7eff 100644 (file)
@@ -273,10 +273,36 @@ class Reader(pymeshio.common.BinaryReader):
 \r
 \r
 def read_from_file(path):\r
+    """\r
+    read from file path, then return the pymeshio.pmx.Model.\r
+\r
+    :Parameters:\r
+      path\r
+        file path\r
+\r
+    >>> import pymeshio.pmx.reader\r
+    >>> m=pymeshio.pmx.reader.read_from_file('resources/初音ミクVer2.pmx')\r
+    >>> print(m)\r
+    <pmx-2.0 "Miku Hatsune" 12354vertices>\r
+\r
+    """\r
     return read(io.BytesIO(pymeshio.common.readall(path)))\r
 \r
 \r
 def read(ios):\r
+    """\r
+    read from ios, then return the pmx pymeshio.pmx.Model.\r
+\r
+    :Parameters:\r
+      ios\r
+        input stream (in io.IOBase)\r
+\r
+    >>> import pymeshio.pmx.reader\r
+    >>> m=pymeshio.pmx.reader.read(io.open('resources/初音ミクVer2.pmx', 'rb'))\r
+    >>> print(m)\r
+    <pmx-2.0 "Miku Hatsune" 12354vertices>\r
+\r
+    """\r
     assert(isinstance(ios, io.IOBase))\r
     reader=pymeshio.common.BinaryReader(ios)\r
 \r
index f823985..3ad89ca 100644 (file)
@@ -259,8 +259,21 @@ class Writer(common.BinaryWriter):
             self.write_vector3(j.spring_constant_rotation)\r
 \r
 \r
-def write(ios, model, text_encoding=1):\r
-    """pmx書き込み\r
+def write(ios, model, text_encoding=0):\r
+    """\r
+    write model to ios.\r
+\r
+    :Parameters:\r
+        ios\r
+            output stream (in io.IOBase)\r
+        model\r
+            pmx model\r
+        text_encoding\r
+            text field encoding (0: UTF16, 1:UTF-8).\r
+\r
+    >>> import pymeshio.pmx.writer\r
+    >>> pymeshio.pmx.writer.write(io.open('out.pmx', 'wb'))\r
+\r
     """\r
     assert(isinstance(ios, io.IOBase))\r
     assert(isinstance(model, pmx.Model))\r
index 6c74add..e7c692d 100644 (file)
--- a/setup.py
+++ b/setup.py
@@ -7,7 +7,7 @@ import os
 import shutil
 
 name='pymeshio'
-version='2.2.0'
+version='2.2.1'
 short_description='pure python 3d model io library'
 long_description='''\
 `pymeshio` is a package for 3d model io.
@@ -42,7 +42,7 @@ Usage
 ::
 
     >>> import pymeshio.pmx.reader
-    >>> m=pymeshio.pmx.reader.read('resources/初音ミクVer2.pmx')
+    >>> m=pymeshio.pmx.reader.read_from_file('resources/初音ミクVer2.pmx')
     >>> print(m)
     <pmx-2.0 "Miku Hatsune" 12354vertices>
     >>> print(dir(m))
@@ -58,6 +58,10 @@ ToDo
 
 New
 -------
+2.2.1 (1011-10-07)
+~~~~~~~~~~~~~~~~~~
+* importer pmd to pmx converter
+
 2.2.0 (2011-10-03)
 ~~~~~~~~~~~~~~~~~~
 * implement pmx writer