private void btnOpenSandbox_Click(object sender, RoutedEventArgs e) { var ofd = new OpenFileDialog(); if ((bool)ofd.ShowDialog()) { var h3 = new Halo3(ofd.FileName); lblSandboxPath.Text = ofd.FileName; var container = new Model3DCollection(); foreach (var placedObject in h3.SandboxObjects.Where(placedObject => placedObject.TagIndex != -1)) { // Try to load Model if (placedObject.TagEntry.Tag.TagPath.Contains("spawning")) { } string gameAssetPath; try { gameAssetPath = VariousFunctions.GetGameAsset(Halo3.GameId, placedObject.TagEntry.Tag.TagPath); } catch (FileNotFoundException) { ActionLog.AddEntry("Missing Game Asset"); continue; } var model = (Model3D)ModelImporter.Load(gameAssetPath); model.Transform = CreateTransformGroup(placedObject); container.Add(model); } ModelViewport.Children.Clear(); ModelViewport.Children.Add(new GridLines()); foreach (var model in container) { ModelViewport.Children.Add(new ModelVisual3D { Content = model }); } var light = new LightVisual3D(); var ambientLight = new AmbientLight(Colors.WhiteSmoke) { Transform = new MatrixTransform3D(new Matrix3D { OffsetX = 0, OffsetY = 0, OffsetZ = 100 }) }; light.Content = ambientLight; ModelViewport.Children.Add(light); ModelViewport.ShowCameraInfo = true; ModelViewport.ZoomExtents(); ModelViewport.IsHeadLightEnabled = true; } }