예제 #1
0
 /// <summary>
 ///
 /// </summary>
 private static void ClearResources()
 {
     if (TextureManager != null)
     {
         TextureManager.ClearTextures();
         TextureManager = null;
     }
 }
예제 #2
0
 /// <summary>
 ///
 /// </summary>
 private void ReleaseResource()
 {
     TextureManager.ClearTextures();
     textureList.Clear();
     foreach (Bitmap bmp in BitmapList.Images)
     {
         bmp.Dispose();
     }
     BitmapList.Images.Clear();
 }
예제 #3
0
 public void ClearConfig()
 {
     LevelEditor.New();
     LevelEditor.NewVisibility();
     ConfigEditor.New();
     ClearCollisionEditors();
     ClearLayoutEditors();
     CameraEditor.New();
     ParticleEditor.New();
     TexturePatternEditor.New();
     SetIdTableEditor.New();
     LightEditor.New();
     renderer.dffRenderer.ClearObjectONEFiles();
     TextureManager.ClearTextures(renderer, LevelEditor.bspRenderer);
     renderer.Camera.Reset();
     currentSavePath = null;
 }
예제 #4
0
 private void clearTXDsToolStripMenuItem_Click(object sender, EventArgs e)
 {
     TextureManager.ClearTextures(renderer, LevelEditor.bspRenderer);
 }
예제 #5
0
파일: MobjManager.cs 프로젝트: Ploaj/HSDLib
 /// <summary>
 ///
 /// </summary>
 public void ClearRenderingCache()
 {
     TextureManager.ClearTextures();
     imageBufferTextureIndex.Clear();
 }
예제 #6
0
        /// <summary>
        /// Loads the appropriate paths stored in the <see cref="ProjectConfig"/> instance into each of the editors.
        /// </summary>
        public static void ApplyInstance(MainForm.MainForm mainForm, ProjectConfig config)
        {
            mainForm.ClearConfig();

            ExecuteIfFilePresent($"Config Editor error: file not found: {config.StageConfigPath}", "Error", config.StageConfigPath, path => mainForm.ConfigEditor.OpenFile(path, mainForm));

            if (config.IsShadow)
            {
                if (Directory.Exists(config.LevelEditorPath))
                {
                    mainForm.LevelEditor.OpenONEShadowFolder(config.LevelEditorPath, true);
                }
                else if (!string.IsNullOrEmpty(config.LevelEditorPath))
                {
                    MessageBox.Show($"Level Editor error: file not found: {config.LevelEditorPath}", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            else
            {
                ExecuteIfFilePresent($"Level Editor error: file not found: {config.LevelEditorPath}", "Error", config.LevelEditorPath, path => mainForm.LevelEditor.OpenONEHeroesFile(path, mainForm.renderer));
                ExecuteIfFilePresent($"Visibility Editor error: file not found: {config.VisibilityPath}", "Error", config.VisibilityPath, path => mainForm.LevelEditor.initVisibilityEditor(false, path));
            }

            if (config.CollisionEditorPaths != null)
            {
                foreach (var v in config.CollisionEditorPaths)
                {
                    ExecuteIfFilePresent($"Collision Editor error: file not found: {v}", "Error", v, path => mainForm.AddCollisionEditor(path));
                }
            }
            if (config.LayoutEditorPaths != null)
            {
                foreach (var v in config.LayoutEditorPaths)
                {
                    ExecuteIfFilePresent($"Layout Editor error: file not found: {v}", "Error", v, path => mainForm.AddLayoutEditor(path));
                }
            }

            ExecuteIfFilePresent($"Camera Editor error: file not found: {config.CameraEditorPath}", "Error", config.CameraEditorPath, path => mainForm.CameraEditor.OpenFile(path));
            ExecuteIfFilePresent($"Particle Editor error: file not found: {config.ParticleEditorPath}", "Error", config.ParticleEditorPath, path => mainForm.ParticleEditor.OpenFile(path));
            ExecuteIfFilePresent($"Texture Pattern Editor error: file not found: {config.TexturePatternEditorPath}", "Error", config.TexturePatternEditorPath, path => mainForm.TexturePatternEditor.OpenFile(path));
            ExecuteIfFilePresent($"Light Editor error: file not found: {config.LightEditorPath}", "Error", config.LightEditorPath, path => mainForm.LightEditor.OpenFile(path, config.LightEditorIsShadow));
            ExecuteIfFilePresent($"SET ID Table Editor error: file not found: {config.SetIdTableEditorPath}", "Error", config.SetIdTableEditorPath, path => mainForm.SetIdTableEditor.OpenExternal(path, config.SetIdTableEditorIsShadow));

            if (config.CameraSettings != null)
            {
                mainForm.renderer.Camera.ApplyConfig(config.CameraSettings);
            }

            TextureManager.ClearTextures(mainForm.renderer, mainForm.LevelEditor.bspRenderer);
            if (config.TXDPaths != null)
            {
                foreach (string s in config.TXDPaths)
                {
                    ExecuteIfFilePresent($"Error: TXD file not found: {s}", "Error", s, path => TextureManager.LoadTexturesFromTXD(s, mainForm.renderer, mainForm.LevelEditor.bspRenderer));
                }
            }

            if (config.TextureFolderPaths != null)
            {
                foreach (string s in config.TextureFolderPaths)
                {
                    ExecuteIfFilePresent($"Error: Folder not found: {s}", "Error", s, path => TextureManager.LoadTexturesFromFolder(s, mainForm.renderer, mainForm.LevelEditor.bspRenderer));
                }
            }

            mainForm.renderer.dffRenderer.ClearObjectONEFiles();
            if (config.DFFONEPaths != null)
            {
                mainForm.renderer.dffRenderer.AddDFFFiles(config.DFFONEPaths);
            }

            if (config.RenderingOptions != null)
            {
                mainForm.ApplyConfig(config.RenderingOptions);
                mainForm.ViewConfig.NumericQuadHeight.Value = (decimal)config.RenderingOptions.QuadtreeHeight;
            }
        }