Exemple #1
0
        /// <summary>
        /// Dispose of this controller and cleanup.
        /// </summary>
        public void Dispose()
        {
            //Save UI
            var activeWindow = sceneViewController.ActiveWindow;

            if (activeWindow != null)
            {
                AnomalyConfig.CameraConfig.MainCameraPosition = activeWindow.Translation;
                AnomalyConfig.CameraConfig.MainCameraLookAt   = activeWindow.LookAt;
            }

            if (guiManager != null && AnomalyConfig.WindowsFile != null)
            {
                ConfigFile configFile = new ConfigFile(AnomalyConfig.WindowsFile);
                guiManager.saveUI(configFile, GetType().Assembly.GetName().Version);
                configFile.writeConfigFile();
            }

            //Clear resources
            resourceController.clearResources();
            resourceController.applyToScene();
            if (virtualTextureLink != null)
            {
                virtualTextureLink.Dispose();
            }

            //Dispose
            if (consoleWindow != null)
            {
                Log.Default.removeLogListener(consoleWindow);
                consoleWindow.Dispose();
            }
            if (splashScreen != null)
            {
                splashScreen.Dispose();
            }
            if (mainObjectEditor != null)
            {
                mainObjectEditor.Dispose();
            }
            if (debugVisualizer != null)
            {
                debugVisualizer.Dispose();
            }
            if (mainForm != null)
            {
                mainForm.Dispose();
            }
            if (mdiLayout != null)
            {
                mdiLayout.Dispose();
            }
            if (selectionMovementTools != null)
            {
                selectionMovementTools.Dispose();
            }
            if (guiManager != null)
            {
                guiManager.Dispose();
            }
            if (sceneViewController != null)
            {
                sceneViewController.Dispose();
            }
            if (eventManager != null)
            {
                eventManager.Dispose();
            }
            if (inputHandler != null)
            {
                inputHandler.Dispose();
            }
            if (systemTimer != null)
            {
                systemTimer.Dispose();
            }
            if (lightManager != null)
            {
                pluginManager.RendererPlugin.destroySceneViewLightManager(lightManager);
            }
            if (frameClearManager != null)
            {
                frameClearManager.Dispose();
            }
            if (pluginManager != null)
            {
                pluginManager.Dispose();
            }
            if (mainWindow != null)
            {
                mainWindow.Dispose();
            }

            AnomalyConfig.save();
            logListener.Dispose();
        }
        public void Dispose()
        {
            liveResourceManager.changeResourcesToMatch(emptyResourceManager);
            liveResourceManager.initializeResources();

            var activeWindow = sceneViewController.ActiveWindow;

            if (activeWindow != null)
            {
                OgreModelEditorConfig.CameraConfig.MainCameraPosition = activeWindow.Translation;
                OgreModelEditorConfig.CameraConfig.MainCameraLookAt   = activeWindow.LookAt;
            }

            IDisposableUtil.DisposeIfNotNull(virtualTextureDebugger);
            IDisposableUtil.DisposeIfNotNull(materialEditor);

            if (textureCompiler != null)
            {
                OgreModelEditorConfig.LastTextureCompilerSourceDirectory = textureCompiler.CurrentSrc;
                textureCompiler.Dispose();
            }

            if (consoleWindow != null)
            {
                Log.Default.removeLogListener(consoleWindow);
                consoleWindow.Dispose();
            }
            if (splashScreen != null)
            {
                splashScreen.Dispose();
            }
            if (objectMover != null)
            {
                objectMover.Dispose();
            }
            if (guiManager != null)
            {
                guiManager.Dispose();
            }
            if (sceneViewController != null)
            {
                sceneViewController.Dispose();
            }
            if (mdiLayout != null)
            {
                mdiLayout.Dispose();
            }
            if (virtualTextureLink != null)
            {
                virtualTextureLink.Dispose();
            }
            if (modelController != null)
            {
                modelController.Dispose();
            }
            if (eventManager != null)
            {
                eventManager.Dispose();
            }
            if (inputHandler != null)
            {
                inputHandler.Dispose();
            }
            if (systemTimer != null)
            {
                systemTimer.Dispose();
            }
            if (lightManager != null)
            {
                pluginManager.RendererPlugin.destroySceneViewLightManager(lightManager);
            }
            if (frameClearManager != null)
            {
                frameClearManager.Dispose();
            }
            if (mainWindow != null)
            {
                mainWindow.Dispose();
            }
            if (pluginManager != null)
            {
                pluginManager.Dispose();
            }

            OgreModelEditorConfig.save();
            logListener.Dispose();
        }