public string OnAddScene(TagPath path) { GameDefinition game = instance.GetGameDefinitionByGameID(path.Game); string tagName = path.Path + "." + path.Extension; Type type = game.TypeTable.LocateEntryByName(path.Extension).TagType; if (!new List <Type>(type.GetInterfaces()).Contains(typeof(IInstanceable))) { throw new CoreException("Cannot preview tag; {0} does not implement {1}.", type.FullName, typeof(IInstanceable).Name); } Tag tag = pool.Open(path.ToPath(), type, true); string identifier = path.ToPath(); if (!scenes.ContainsKey(identifier)) { scenes.Add(identifier, tag); } Camera newCam = new Camera(); if (tag is ScenarioBase) { Interfaces.Rendering.Radiosity.WorldBounds totalBounds = (tag as ScenarioBase).BspList[0].WorldBounds; foreach (IBsp bsp in (tag as ScenarioBase).BspList) { totalBounds &= bsp.WorldBounds; } newCam.Position = new Vector3((totalBounds.X.Lower + totalBounds.X.Upper) / 2, (totalBounds.Y.Lower + totalBounds.Y.Upper) / 2, (totalBounds.Z.Lower + totalBounds.Z.Upper) / 2); } RenderCore.AddScene(identifier, tagName, newCam, ((IInstanceable)tag).Instance, RenderState.Textured, game.GetSceneType(tag)); // Temp using RenderState.Textured until we load the value from the project file. RenderCore.ActiveSceneName = identifier; //added this line to activate the latest Scene - gren return(identifier); }