Esempio n. 1
0
        private void ButtonDuplicateSamplerClick(object sender, EventArgs e)
        {
            var name      = comboBoxSampler.SelectedItem.ToString();
            var finalName = name;
            var sampler   = LibrarySamplers.GetSampler(name);
            var isaveObj  = sampler as ISave;

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

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

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

                input.ShowDialog();

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

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

                    isaveObj.Save(finalName);
                    LibrarySamplers.Init();
                    comboBoxSampler.DataSource   = LibrarySamplers.Samplers.ToArray();
                    comboBoxSampler.SelectedItem = finalName;
                }
            }
        }
Esempio n. 2
0
        private void ButtonDeleteSamplerClick(object sender, EventArgs e)
        {
            var name = comboBoxSampler.SelectedItem.ToString();
            //TODO Localize me
            {
                if (MessageBox.Show(String.Format("Are you sure to delete {0}?", name), "Mistuba Render Sampler",
                                    MessageBoxButtons.YesNo) == DialogResult.Yes)
                {
                    var path = Path.Combine(MitsubaSettings.FolderSamplersFolder, name) + LibrarySamplers.Extension;

                    try {
                        File.Delete(path);
                        LibrarySamplers.Init();
                        comboBoxSampler.DataSource = LibrarySamplers.Samplers.ToArray();
                    }

                    catch {
                        MessageBox.Show("A problem ocurred deleting the file");
                    }
                }
            }
        }
Esempio 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();
        }