X-Git-Url: http://git.osdn.jp/view?a=blobdiff_plain;f=pymeshio%2Fpmx%2Freader.py;h=1126f79cc4b7f6a2b33500f48dbcc77c47becf84;hb=0f304057cda88bde341c40107b9e22fa931c7890;hp=8c0858562f68ce7b85277dc93ac2c468390c3fa7;hpb=1a59747c66623ef3b6b66412d25ffc4e613cd893;p=meshio%2Fpymeshio.git diff --git a/pymeshio/pmx/reader.py b/pymeshio/pmx/reader.py index 8c08585..1126f79 100644 --- a/pymeshio/pmx/reader.py +++ b/pymeshio/pmx/reader.py @@ -273,10 +273,38 @@ class Reader(pymeshio.common.BinaryReader): def read_from_file(path): - return read(io.BytesIO(pymeshio.common.readall(path))) + """ + read from file path, then return the pymeshio.pmx.Model. + + :Parameters: + path + file path + + >>> import pymeshio.pmx.reader + >>> m=pymeshio.pmx.reader.read_from_file('resources/初音ミクVer2.pmx') + >>> print(m) + + + """ + pmx=read(io.BytesIO(pymeshio.common.readall(path))) + pmx.path=path + return pmx def read(ios): + """ + read from ios, then return the pmx pymeshio.pmx.Model. + + :Parameters: + ios + input stream (in io.IOBase) + + >>> import pymeshio.pmx.reader + >>> m=pymeshio.pmx.reader.read(io.open('resources/初音ミクVer2.pmx', 'rb')) + >>> print(m) + + + """ assert(isinstance(ios, io.IOBase)) reader=pymeshio.common.BinaryReader(ios)