Exemplo n.º 1
0
        public void OnRequestExportCollision()
        {
            View.CollisionExportWindow window = new View.CollisionExportWindow(MainWorld.Map);
            window.FileSelector.IsFilePicker  = true;
            window.FileSelector.IsFileSaver   = true;
            window.FileSelector.FileExtension = "dae";

            if (window.ShowDialog() == true)
            {
                if (window.FileName == "")
                {
                    MessageBox.Show("No filename entered!", "Collision Export Error");
                    return;
                }

                if (window.SceneNumber == -1 || window.SceneNumber > MainWorld.Map.SceneList.Count - 1)
                {
                    MessageBox.Show("Invalid room number entered!", "Collision Export Error");
                    return;
                }

                WRoom room = GetRoomFromDropdownIndex(window.SceneNumber);

                CategoryDOMNode colCategory = room.GetChildrenOfType <CategoryDOMNode>().Find(x => x.Name == "Collision");
                WCollisionMesh  mesh        = colCategory.Children[0] as WCollisionMesh;
                mesh.ToDAEFile(window.FileName);

                MessageBox.Show("Successfully saved collision to file.", "Success");
            }
        }
Exemplo n.º 2
0
        public void ExportToDae()
        {
            if (m_CollisionMesh == null)
            {
                MessageBox.Show("You must select a room before you can export its collision.", "No collision mesh selected");
                return;
            }

            var sfd = new CommonSaveFileDialog()
            {
                Title                        = "Export DAE",
                DefaultExtension             = "dae",
                AlwaysAppendDefaultExtension = true,
            };

            sfd.Filters.Add(new CommonFileDialogFilter("Collada", ".dae"));
            if (WSettingsManager.GetSettings().LastCollisionDaePath.FilePath != "")
            {
                sfd.InitialDirectory = WSettingsManager.GetSettings().LastCollisionDaePath.FilePath;
            }

            if (sfd.ShowDialog() == CommonFileDialogResult.Ok)
            {
                m_CollisionMesh.ToDAEFile(sfd.FileName);

                WSettingsManager.GetSettings().LastCollisionDaePath.FilePath = Path.GetDirectoryName(sfd.FileName);
                WSettingsManager.SaveSettings();
            }
        }