示例#1
0
        /// <summary>
        /// Exports the specified projectScene to disk.
        /// </summary>
        /// <param name="scene"></param>
        private void ExportScene(GUIProjectScene projectScene)
        {
            if(Otter.Editor.Properties.Settings.Default.SaveOnExport && CanSaveProject(false))
                SaveProject();

            ArrayList itemsToExport = ImporterExporter.GetItemsToExport(projectScene);    

            Exporting.AssetExporter assetExporter = new Exporting.AssetExporter(GUIProject.CurrentProject, itemsToExport);
            assetExporter.ShowDialog();
        }
示例#2
0
        /// <summary>
        /// Adds a new scene to the project
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public GUIProjectScene AddScene()
        {
            if(mProject == null)
                return null;

            string name = "NewScene";
            int cnt = 0;

            GUIProjectScene newSceneEntry = new GUIProjectScene(name + cnt);

            bool bUnique = false;
            while(!bUnique)
            {
                bUnique = true;

                cnt++;
                newSceneEntry.Name = name + cnt;

                // Check if it already exists on disk.
                if(System.IO.File.Exists(newSceneEntry.FullPath))
                {
                    bUnique = false;
                }

                // If it does not exist on disk, make sure there isn't
                // another entry by the same name
                if(bUnique)
                {
                    foreach (GUIProjectScene projectScene in mProject.Entries)
                    {
                        if (projectScene.Name == newSceneEntry.Name)
                        {
                            bUnique = false;
                            break;
                        }
                    }
                }
            };

            // Cycle through the entries and determine the max id.
            uint maxID = 0;
            foreach (GUIProjectEntry entry in mProject.Entries)
            {
                if (entry.ID > maxID)
                    maxID = entry.ID;
            }

            newSceneEntry.ID = maxID + 1;
                        
            // Save it the scene.
            newSceneEntry.Save();
            mProject.Entries.Add(newSceneEntry);
            this.ProjectModified = true;

            RefreshProjectView();

            NotifyCreateEntry(newSceneEntry);

            return newSceneEntry;
        }
示例#3
0
        private static void LoadResources(GUIProjectScene projectScene)
        {
            List<Otter.UI.Resources.Resource> resources = new List<Otter.UI.Resources.Resource>();

            resources.AddRange(projectScene.Scene.Textures.OfType<Otter.UI.Resources.Resource>());
            resources.AddRange(projectScene.Scene.Sounds.OfType<Otter.UI.Resources.Resource>());

            if (resources.Count == 0)
                return;

            LoadingForm form = new LoadingForm();

            form.ProgressBar.Minimum = 0;
            form.ProgressBar.Maximum = resources.Count;
            form.ProgressBar.Value = 0;
            form.Status.Text = "";

            form.Action = () =>
            {
                int cnt = 1;
                foreach (Otter.UI.Resources.Resource resource in resources)
                {
                    form.Status.Text = "[" + (cnt++) + "/" + resources.Count + "] : " + resource;

                    Thread thread = new Thread(new ThreadStart(() => { resource.Load(); }));
                    thread.Start();

                    while (thread.IsAlive)
                        Application.DoEvents();

                    form.ProgressBar.Value++;
                }
            };

            form.ShowDialog();
        }