\r
\r
def read_from_file(path):\r
- return read(io.BytesIO(pymeshio.common.readall(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
+ pmx=read(io.BytesIO(pymeshio.common.readall(path)))\r
+ pmx.path=path\r
+ return pmx\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