Exemple #1
0
    /// Imports all exported Sectors into the scene. Safe to call from the command line.
    public static void ImportSceneChunks()
    {
        int numSectors = SECTR_Sector.All.Count;

        for (int sectorIndex = 0; sectorIndex < numSectors; ++sectorIndex)
        {
            SECTR_Sector sector = SECTR_Sector.All[sectorIndex];
            if (sector.Frozen)
            {
                EditorUtility.DisplayProgressBar("Importing Scene Chunks", "Importing " + sector.name, (float)sectorIndex / (float)numSectors);
                ImportFromChunk(sector);
            }
        }
        if (SECTR_VC.CheckOut(EditorApplication.currentScene))
        {
            EditorApplication.SaveScene();
            SECTR_VC.WaitForVC();
        }
        EditorUtility.ClearProgressBar();
    }
Exemple #2
0
    /// Reverts all imported Sectors into the scene. Safe to call from the command line.
    public static void RevertSceneChunks()
    {
        int numSectors = SECTR_Sector.All.Count;

        for (int sectorIndex = 0; sectorIndex < numSectors; ++sectorIndex)
        {
            SECTR_Sector sector = SECTR_Sector.All[sectorIndex];
            SECTR_Chunk  chunk  = sector.GetComponent <SECTR_Chunk>();
            if (!sector.Frozen && chunk &&
                System.IO.File.Exists(SECTR_Asset.UnityToOSPath(chunk.NodeName)))
            {
                EditorUtility.DisplayProgressBar("Reverting Scene Chunks", "Reverting " + sector.name, (float)sectorIndex / (float)numSectors);
                DeleteExportedSector(sector);
            }
        }
        if (SECTR_VC.CheckOut(EditorApplication.currentScene))
        {
            EditorApplication.SaveScene();
            SECTR_VC.WaitForVC();
        }
        EditorUtility.ClearProgressBar();
    }
Exemple #3
0
    /// Exports all of the Sectors in the scene, with user prompts and other helpful dialogs.
    public static void ExportSceneChunksUI()
    {
        if (string.IsNullOrEmpty(EditorApplication.currentScene))
        {
            EditorUtility.DisplayDialog("Export Error", "Cannot export from a scene that's never been saved.", "Ok");
        }

        if (!SECTR_VC.CheckOut(EditorApplication.currentScene))
        {
            EditorUtility.DisplayDialog("Export Error", "Could not check out " + EditorApplication.currentScene + ". Export aborted.", "Ok");
            return;
        }

        string sceneDir;
        string sceneName;
        string exportDir = SECTR_Asset.MakeExportFolder("Chunks", false, out sceneDir, out sceneName);

        if (string.IsNullOrEmpty(exportDir))
        {
            EditorUtility.DisplayDialog("Export Error", "Could not create Chunks folder. Aborting Export.", "Ok");
            return;
        }

        SECTR_Loader[] loaders = (SECTR_Loader[])GameObject.FindObjectsOfType(typeof(SECTR_Loader));
        if (loaders.Length == 0 && !EditorUtility.DisplayDialog("No Loaders", "This scene has no loaders. Are you sure you wish to export?", "Ok", "Cancel"))
        {
            return;
        }

        int backupValue = _ShowBackupPrompt();

        if (backupValue != 1)
        {
            ExportSceneChunks();
            EditorUtility.DisplayDialog("Streaming Export Complete", "If this is the first time you've exported this level since launching Unity, you will need to build the project before you can use the _Streaming level.", "Ok");
        }
    }