Ejemplo n.º 1
0
        private void ButtonDuplicateIntegratorClick(object sender, EventArgs e)
        {
            var name       = comboBoxIntegrator.SelectedItem.ToString();
            var finalName  = name;
            var integrator = LibraryIntegrators.GetIntegrator(name);
            var isaveObj   = integrator as ISave;

            var num  = 1;
            var path = Path.Combine(MitsubaSettings.FolderIntegratorsFolder, name) + LibraryIntegrators.Extension;;

            while (File.Exists(path))
            {
                num++;
                finalName = name + " (" + num + ")";
                path      = Path.Combine(MitsubaSettings.FolderIntegratorsFolder, finalName);
                path     += LibraryIntegrators.Extension;
            }

            if (isaveObj != null)
            {
                var input = new InputBoxDlg {
                    Titul = "Mistuba Render Integrator",
                    //TODO Localize me
                    TopicText = "Please Type a Name",
                    InputText = finalName
                };

                input.ShowDialog();

                if (input.DialogResult == DialogResult.OK)
                {
                    finalName = input.InputText;
                    path      = Path.Combine(MitsubaSettings.FolderIntegratorsFolder, finalName);

                    if (File.Exists(path))
                    {
                        //TODO Localize me
                        if (MessageBox.Show("This file already exist, do you want to overwrite it?", "Mistuba Render Integrator",
                                            MessageBoxButtons.YesNo) == DialogResult.No)
                        {
                            return;
                        }
                    }

                    isaveObj.Save(finalName);
                    LibraryIntegrators.Init();
                    comboBoxIntegrator.DataSource   = LibraryIntegrators.Integrators.ToArray();
                    comboBoxIntegrator.SelectedItem = finalName;
                }
            }
        }
Ejemplo n.º 2
0
        private void ButtonDeleteIntegratorClick(object sender, EventArgs e)
        {
            var name = comboBoxIntegrator.SelectedItem.ToString();
            //TODO Localize me
            {
                if (MessageBox.Show(String.Format("Are you sure to delete {0}?", name), "Mistuba Render Integrator",
                                    MessageBoxButtons.YesNo) == DialogResult.Yes)
                {
                    var path = Path.Combine(MitsubaSettings.FolderIntegratorsFolder, name) + LibraryIntegrators.Extension;

                    try {
                        File.Delete(path);
                        LibraryIntegrators.Init();
                        comboBoxIntegrator.DataSource = LibraryIntegrators.Integrators.ToArray();
                    }

                    catch {
                        MessageBox.Show("A problem ocurred deleting the file");
                    }
                }
            }
        }
Ejemplo n.º 3
0
        private void IntegratorDialogLoad(object sender, EventArgs e)
        {
            if (String.IsNullOrEmpty(_editingPreset))
            {
                //TODO Localize me
                Text = "New Mitsuba Render Settings";
            }
            else
            {
                Text = _editingPreset;
            }

            LibraryIntegrators.Init();
            LibrarySamplers.Init();
            LibraryReconstructionFilters.Init();

            if (LibraryIntegrators.Integrators == null || !LibraryIntegrators.Integrators.Any())
            {
                MitsubaSettings.GenerateDefaultIntegrators();
            }

            if (LibrarySamplers.Samplers == null || !LibrarySamplers.Samplers.Any())
            {
                MitsubaSettings.GenerateDefaultSamplers();
            }

            if (LibraryReconstructionFilters.ReconstructionFilters == null ||
                !LibraryReconstructionFilters.ReconstructionFilters.Any())
            {
                MitsubaSettings.GenerateDefaultReconstructionFilters();
            }


            if (LibraryIntegrators.Integrators != null)
            {
                comboBoxIntegrator.DataSource = LibraryIntegrators.Integrators.ToArray();
            }

            if (LibrarySamplers.Samplers != null)
            {
                comboBoxSampler.DataSource = LibrarySamplers.Samplers.ToArray();
            }

            if (LibraryReconstructionFilters.ReconstructionFilters != null)
            {
                comboBoxReconstruction.DataSource =
                    LibraryReconstructionFilters.ReconstructionFilters.ToArray();
            }


            if (!String.IsNullOrEmpty(_editingPreset))
            {
                var preset = LibraryPresets.GetPreset(_editingPreset);
                comboBoxReconstruction.SelectedItem = preset.ReconstructionFilterName;
                comboBoxSampler.SelectedItem        = preset.SamplerName;
                comboBoxIntegrator.SelectedItem     = preset.IntegratorName;
            }

            tabControlProperties.SelectedIndex = 0;

            SaveOriginals();
        }