Example #1
0
        // objに対応するボーンid配列を生成する。
        int[] CreateBones(MqoObject obj)
        {
            int[]  bones = new int[1];
            string name;

            try
            {
                name = ObjectBoneNames[obj.name];
            }
            catch (KeyNotFoundException)
            {
                throw new KeyNotFoundException(string.Format("ボーン指定に誤りがあります。オブジェクト {0} にボーンを割り当てる必要があります。", obj.name));
            }
            bones[0] = node_idmap[name];
            return(bones);
        }
Example #2
0
        bool SectionRoot(string[] tokens)
        {
            switch (tokens[0])
            {
            case "Metasequoia":
            {
                // Metasequoia Document
                if (tokens[1] != "Document")
                {
                    Error(tokens);
                }
            }
            break;

            case "Format":
            {
                // @since v2.2
                // Format Text Ver 1.0
                // @since v4.0
                // Format Text Ver 1.1
                if (tokens[1] != "Text")
                {
                    Error(tokens);
                }
                if (tokens[2] != "Ver")
                {
                    Error(tokens);
                }
                if (tokens[3] != "1.0" && tokens[3] != "1.1")
                {
                    Error(tokens);
                }
            }
            break;

            case "Thumbnail":
            {
                // Thumbnail 128 128 24 rgb raw {
                // ...
                // }
                if (tokens[6] != "{")
                {
                    Error(tokens);
                }

                DoRead(SectionThumbnail);
            }
            break;

            case "Scene":
            {
                if (tokens[1] != "{")
                {
                    Error(tokens);
                }

                DoRead(SectionScene);
            }
            break;

            case "Material":
            {
                if (tokens[2] != "{")
                {
                    Error(tokens);
                }

                mqo.materials = new List <MqoMaterial>(int.Parse(tokens[1]));
                DoRead(SectionMaterial);
            }
            break;

            case "Object":
            {
                if (tokens[2] != "{")
                {
                    Error(tokens);
                }

                obj = new MqoObject(tokens[1].Trim('"'));
                mqo.objects.Add(obj);
                DoRead(SectionObject);
            }
            break;

            case "Eof":
                return(false);
            }
            return(true);
        }