예제 #1
0
        private void CommandBinding_NewCmdExecuted(object sender, System.Windows.Input.ExecutedRoutedEventArgs e)
        {
            MogitorsRoot mogRoot = MogitorsRoot.Instance;
            if (!(mogRoot.TerminateScene()))
                return;

            ProjectOptions opt = mogRoot.ProjectOptions;
            opt.IsNewProject = true;
            opt.ProjectName = "";
            opt.ProjectDir = MogitorsSystem.Instance.ProjectsDirectory;
            opt.SceneManagerName = "OctreeSceneManager";
            opt.TerrainDirectory = "Terrain";
            opt.ResourceDirectories.Clear();
            opt.Cameras.Clear();
            opt.SelectionBBColourForSerializer = Color.FromRgb(255, 255, 255);
            opt.HighlightBBColourForSerializer = Color.FromRgb(232, 48, 48);

            SettingsDialog dlg = new SettingsDialog(opt);
            if (dlg.ShowDialog() == true)
            {
                string fileName = MogitorsSystem.Instance.CombinePath(mogRoot.ProjectOptions.ProjectDir, mogRoot.ProjectOptions.ProjectName + ".mogscene");
                fileName = MogitorsSystem.Instance.GetFullPath(fileName);

                XmlTextWriter textWriter = new XmlTextWriter(fileName, System.Text.Encoding.Unicode);
                textWriter.Formatting = Formatting.Indented;
                textWriter.WriteStartDocument();

                // XML Root
                textWriter.WriteStartElement("MogitorScene");

                // Write project options
                mogRoot.WriteProjectOptions(textWriter, true);

                // Write new scene definition
                textWriter.WriteStartElement("Object");
                textWriter.WriteStartAttribute("Type");
                textWriter.WriteValue(mogRoot.ProjectOptions.SceneManagerName);
                textWriter.WriteEndAttribute();
                textWriter.WriteStartAttribute("SceneManagerType");
                textWriter.WriteValue(mogRoot.ProjectOptions.SceneManagerName);
                textWriter.WriteEndAttribute();
                textWriter.WriteStartAttribute("Name");
                textWriter.WriteValue("SceneManager");
                textWriter.WriteEndAttribute();
                textWriter.WriteStartAttribute("Ambient");
                textWriter.WriteValue("1.000 1.000 1.000");
                textWriter.WriteEndAttribute();
                textWriter.WriteEndElement();

                textWriter.WriteEndElement();
                textWriter.WriteEndDocument();
                textWriter.Close();

                mogRoot.LoadScene(fileName);
            }

            this.statusString.Text = "New scene created";
        }
예제 #2
0
        private void CommandBinding_SettingsCmdExecuted(object sender, System.Windows.Input.ExecutedRoutedEventArgs e)
        {
            ProjectOptions opt = MogitorsRoot.Instance.ProjectOptions;
            SettingsDialog dlg = new SettingsDialog(opt);

            List<string> directories = new List<string>();
            opt.ResourceDirectories.ForEach(s => directories.Add(s));

            if (dlg.ShowDialog() == true)
            {
                bool identical = true;
                if (directories.Count == opt.ResourceDirectories.Count)
                {
                    foreach (string orgStr in directories)
                    {
                        bool found = false;
                        foreach (string newStr in opt.ResourceDirectories)
                        {
                            if (orgStr == newStr)
                                found = true;
                        }
                        if (!found)
                        {
                            identical = false;
                            break;
                        }
                    }
                }
                else
                {
                    identical = false;
                }

                if (!identical)
                    ogreControl.ReloadUserResources();
            }
        }
예제 #3
0
        private void CommandBinding_NewCmdExecuted(object sender, System.Windows.Input.ExecutedRoutedEventArgs e)
        {
            MogitorsRoot mogRoot = MogitorsRoot.Instance;

            if (!(mogRoot.TerminateScene()))
            {
                return;
            }

            ProjectOptions opt = mogRoot.ProjectOptions;

            opt.IsNewProject     = true;
            opt.ProjectName      = "";
            opt.ProjectDir       = MogitorsSystem.Instance.ProjectsDirectory;
            opt.SceneManagerName = "OctreeSceneManager";
            opt.TerrainDirectory = "Terrain";
            opt.ResourceDirectories.Clear();
            opt.Cameras.Clear();
            opt.SelectionBBColourForSerializer = Color.FromRgb(255, 255, 255);
            opt.HighlightBBColourForSerializer = Color.FromRgb(232, 48, 48);

            SettingsDialog dlg = new SettingsDialog(opt);

            if (dlg.ShowDialog() == true)
            {
                string fileName = MogitorsSystem.Instance.CombinePath(mogRoot.ProjectOptions.ProjectDir, mogRoot.ProjectOptions.ProjectName + ".mogscene");
                fileName = MogitorsSystem.Instance.GetFullPath(fileName);

                XmlTextWriter textWriter = new XmlTextWriter(fileName, System.Text.Encoding.Unicode);
                textWriter.Formatting = Formatting.Indented;
                textWriter.WriteStartDocument();

                // XML Root
                textWriter.WriteStartElement("MogitorScene");

                // Write project options
                mogRoot.WriteProjectOptions(textWriter, true);

                // Write new scene definition
                textWriter.WriteStartElement("Object");
                textWriter.WriteStartAttribute("Type");
                textWriter.WriteValue(mogRoot.ProjectOptions.SceneManagerName);
                textWriter.WriteEndAttribute();
                textWriter.WriteStartAttribute("SceneManagerType");
                textWriter.WriteValue(mogRoot.ProjectOptions.SceneManagerName);
                textWriter.WriteEndAttribute();
                textWriter.WriteStartAttribute("Name");
                textWriter.WriteValue("SceneManager");
                textWriter.WriteEndAttribute();
                textWriter.WriteStartAttribute("Ambient");
                textWriter.WriteValue("1.000 1.000 1.000");
                textWriter.WriteEndAttribute();
                textWriter.WriteEndElement();

                textWriter.WriteEndElement();
                textWriter.WriteEndDocument();
                textWriter.Close();

                mogRoot.LoadScene(fileName);
            }

            this.statusString.Text = "New scene created";
        }