private static void UnloadResources(SceneView sceneView) { List<Otter.UI.Resources.Resource> resources = new List<Otter.UI.Resources.Resource>(); resources.AddRange(sceneView.Scene.Textures.OfType<Otter.UI.Resources.Resource>()); resources.AddRange(sceneView.Scene.Sounds.OfType<Otter.UI.Resources.Resource>()); foreach (Otter.UI.Resources.Resource res in resources) res.Unload(); }
/// <summary> /// Opens a scene for editing /// </summary> /// <param name="scene"></param> private void OpenEntry(GUIProjectEntry entry) { GUIProjectScene projectScene = entry as GUIProjectScene; SceneView sceneView = null; // Check to see if the document is already open, and focus // on it if so. foreach (DockContent doc in mDockPanel.Documents) { SceneView view = doc as SceneView; if (view != null && view.Scene == projectScene.Scene) { doc.Show(); return; } } // We don't have a sceneview for this scene, create and // add it now. if (sceneView == null) { LoadResources(projectScene); sceneView = new SceneView(projectScene.Scene); sceneView.TabText = projectScene.Name; sceneView.SelectedControlsChanged += new SceneView.ControlsEventHandler(SceneView_ControlsSelectionChanged); sceneView.ActiveViewChanged += new SceneView.ViewEventHandler(SceneView_ActiveViewChanged); sceneView.GUIControlUpdated += new SceneView.ControlEventHandler(SceneView_ControlUpdated); sceneView.Enter += new EventHandler(SceneView_Enter); sceneView.FormClosing += new FormClosingEventHandler(SceneView_FormClosing); sceneView.FormClosed += new FormClosedEventHandler(SceneView_FormClosed); sceneView.Show(mDockPanel, DockState.Document); } }