Exemplo n.º 1
0
    void EndOfScript(Root.MQO.MQOFormat format)
    {
        AssetDatabase.Refresh();

        this.meshes    = null;
        this.materials = null;
        this.mqo       = null;
    }
Exemplo n.º 2
0
    // MQOファイル読み込み
    void LoadMQOFile()
    {
        string path = AssetDatabase.GetAssetPath(this.mqo);

        StreamReader stream = this.LoadFile(this.mqo, path);

        Root.MQO.MQOFormat format = Root.MQO.MQOLoader.Load(stream, Root_obj, path);
        if (format.haveMaterial == true)
        {
            BurnUnityFormatForMQO(format);
        }
        stream.Close();
    }
Exemplo n.º 3
0
    // MQOファイルをUnity形式に変換
    void BurnUnityFormatForMQO(Root.MQO.MQOFormat format)
    {
        Root_obj      = new GameObject(format.name);
        format.caller = Root_obj;

        if (format.haveMaterial == true)
        {
            Root.MQO.MQOConverter conv = new Root.MQO.MQOConverter();

            this.meshes = conv.CreateMeshes(format);
            Debug.Log("Maked meshes");

            this.materials = conv.CreateMaterials(format);
            Debug.Log("Maked materials");

            //Object prefab = UnityEditor.PrefabUtility.CreateEmptyPrefab(format.folder + "/" + format.name + ".prefab");
            GameObject[] child = new GameObject[format.object_list.obj_count];
            for (int obj_id = 0; obj_id < format.object_list.obj_count; obj_id++)
            {
                child[obj_id] = new GameObject(format.object_list.obj[obj_id].obj_name);
                conv.ReplaceObject(format, obj_id, child[obj_id], meshes[obj_id], materials);
                child[obj_id].transform.parent = Root_obj.transform;
            }
            Debug.Log("Comp Prefab");

            /*Object[] prefab = new Object[format.object_list.obj_count];
             * for(int t = 0 ; t < format.object_list.obj_count; t++) {
             *      prefab[t] = EditorUtility.CreateEmptyPrefab(format.folder + "/" + format.object_list.obj[t].obj_name + ".prefab");
             *      EditorUtility.ReplacePrefab(child[t], prefab[t], ReplacePrefabOptions.ConnectToPrefab);
             * }*/
            Object Root_Prefab = EditorUtility.CreateEmptyPrefab(format.folder + "/" + format.name + ".prefab");
            EditorUtility.ReplacePrefab(Root_obj, Root_Prefab, ReplacePrefabOptions.ConnectToPrefab);
        }
        else
        {
            Debug.Log("Error:There aren't Material");
        }
        EndOfScript(format);
    }    //*/