X-Git-Url: http://git.osdn.jp/view?a=blobdiff_plain;f=blender25-meshio%2Fpymeshio%2Fmmd.py;h=7dc8f9b673a7fa33e4dab2fb821ed33bbecd80f5;hb=65211f29fc6e1e540cc3e1c515753f860653382b;hp=af8c6f05858469f208a25a1d760f339853843303;hpb=8fc08b79ae46a263f06c893f97a0439d41b14edc;p=meshio%2Fpymeshio.git diff --git a/blender25-meshio/pymeshio/mmd.py b/blender25-meshio/pymeshio/mmd.py index af8c6f0..7dc8f9b 100644 --- a/blender25-meshio/pymeshio/mmd.py +++ b/blender25-meshio/pymeshio/mmd.py @@ -58,6 +58,34 @@ else: else: return src.decode('cp932') + +if sys.version_info[0]<3: + def to_str(src): + t=type(src) + if t==unicode: + return src.encode('cp932') + elif t==str: + return src + else: + raise "INVALID str: %s" % t + + def from_str(src): + return src + +else: + def to_str(src): + t=type(src) + if t==str: + return src + elif t==bytes: + return src.decode('cp932') + else: + raise "INVALID str: %s" % t + + def from_str(src): + return src.encode('cp932') + + def radian_to_degree(x): return x/math.pi * 180.0