-#!BPY\r
+# coding: utf-8\r
""" \r
-Name: 'Metasequoia(.mqo)...'\r
-Blender: 245\r
-Group: 'Import'\r
-Tooltip: 'Import from Metasequoia file format (.mqo)'\r
+MQO\82Ì\93Ç\82Ý\8d\9e\82Ý\r
+http://www.metaseq.net/metaseq/format.html\r
"""\r
-__author__= 'ousttrue'\r
-__url__ = ["http://gunload.web.fc2.com/blender/"]\r
-__version__= '0.4 2009/11/25'\r
-__bpydoc__= '''\\r
-\r
-MQO Importer\r
-\r
-This script imports a mqo file.\r
-\r
-0.2 20080123: update.\r
-0.3 20091125: modify for linux.\r
-0.4 20100310: rewrite.\r
-0.5 20100311: create armature from mikoto bone.\r
-'''\r
\r
import os\r
import sys\r
\r
\r
class RGBA(object):\r
+ """mqo color"""\r
__slots__=['r', 'g', 'b', 'a']\r
def __init__(self, r=0, g=0, b=0, a=0):\r
self.r=r\r
self.b=b\r
self.a=a\r
\r
+ def __getitem__(self, key):\r
+ if key==0:\r
+ return self.r\r
+ elif key==1:\r
+ return self.g\r
+ elif key==2:\r
+ return self.b\r
+ elif key==3:\r
+ return self.a\r
+ else:\r
+ assert(False)\r
+\r
+\r
class Vector3(object):\r
+ """3D coordinate"""\r
__slots__=['x', 'y', 'z']\r
def __init__(self, x=0, y=0, z=0):\r
self.x=x\r
\r
@staticmethod\r
def dot(lhs, rhs):\r
+ """dot(inner) product"""\r
return lhs.x*rhs.x + lhs.y*rhs.y + lhs.z*rhs.z\r
\r
@staticmethod\r
def cross(lhs, rhs):\r
+ """cross(outer) product"""\r
return Vector3(\r
lhs.y*rhs.z - rhs.y*lhs.z,\r
lhs.z*rhs.x - rhs.z*lhs.x,\r
\r
\r
class Vector2(object):\r
+ """2d coordinate"""\r
__slots__=['x', 'y']\r
def __init__(self, x=0, y=0):\r
self.x=x\r
\r
@staticmethod\r
def cross(lhs, rhs):\r
+ """cross(outer) product"""\r
return lhs.x*rhs.y-lhs.y*rhs.x\r
\r
\r
-###############################################################################\r
-# MQO loader\r
-###############################################################################\r
+"""\r
+MQO loader\r
+"""\r
class Material(object):\r
+ """mqo material\r
+\r
+ Attributes:\r
+ name: cp932\r
+ shader: \r
+ color: rgba\r
+ diffuse:\r
+ ambient:\r
+ emit:\r
+ specular:\r
+ power:\r
+ tex: cp932 windows file path\r
+ """\r
__slots__=[\r
"name", "shader", "color", "diffuse", \r
"ambient", "emit", "specular", "power",\r
\r
\r
class Obj(object):\r
- __slots__=["name", "depth", "folding", \r
+ """mqo object\r
+\r
+ Attributes:\r
+ name: cp932\r
+ depth: object hierarchy \r
+ folding: \r
+ scale:\r
+ rotation:\r
+ translation:\r
+ visible:\r
+ locking:\r
+ shading:\r
+ facet: smoothing threshold\r
+ color:\r
+ color_type:\r
+ mirror: mirroring\r
+ mirror_axis:\r
+ vertices:\r
+ faces:\r
+ edges:\r
+ smoothing:\r
+ """\r
+ __slots__=["name", "depth", "folding", \r
"scale", "rotation", "translation",\r
"visible", "locking", "shading", "facet",\r
"color", "color_type", "mirror", "mirror_axis",\r
\r
\r
class Face(object):\r
+ """mqo face\r
+\r
+ Attributes:\r
+ index_count: 2 or 3 or 4\r
+ indices: index x index_count\r
+ material_index:\r
+ col: vertex_color x index_count\r
+ uv: Vector2 x index_count\r
+ """\r
__slots__=[\r
"index_count",\r
"indices", "material_index", "col", "uv",\r
\r
\r
class IO(object):\r
+ """mqo loader\r
+ """\r
__slots__=[\r
"has_mikoto",\r
"eof", "io", "lines",\r
else:\r
print(\r
"%s#readObject" % name,\r
- "unknown key: %s" % name\r
+ "unknown key: %s" % key\r
)\r
\r
self.printError("readObject", "invalid eof")\r