예제 #1
0
 public MitsubaExporter(MitsubaSettings settings, string basePath, string filename)
 {
     m_settings  = settings;
     m_basePath  = basePath;
     m_filename  = filename;
     m_meshStore = new MeshStore(basePath, m_settings.writeSerialized);
 }
예제 #2
0
 public MitsubaOptionsPage(Rhino.PersistentSettings settings)
     : base("Mitsuba")
 {
     m_settings        = settings;
     m_mitsubaSettings = new MitsubaSettings();
     m_mitsubaSettings.Load(m_settings);
     m_control = new MitsubaOptionsControl(ref m_mitsubaSettings);
 }
예제 #3
0
        public MitsubaOptionsControl(ref MitsubaSettings settings)
        {
            InitializeComponent();

            writeSerializedBox.Checked = settings.writeSerialized;
            integrator.SelectedIndex   = (int)settings.integrator;
            pathLength.Value           = settings.pathLength;
            samplesPerPixel.Value      = settings.samplesPerPixel;
            rendererDirectory.Text     = settings.rendererDirectory;
            resolution.Text            = settings.xres + "x" + settings.yres;
            pathLength.Enabled         = integrator.SelectedIndex != (int)MitsubaSettings.Integrator.EDirectIllumination;
        }
예제 #4
0
 public void Apply(ref MitsubaSettings settings)
 {
     settings.writeSerialized   = writeSerializedBox.Checked;
     settings.integrator        = (MitsubaSettings.Integrator)integrator.SelectedIndex;
     settings.rendererDirectory = rendererDirectory.Text;
     settings.samplesPerPixel   = (int)samplesPerPixel.Value;
     settings.pathLength        = (int)pathLength.Value;
     string[] parts = resolution.Text.Split('x');
     if (parts.Length != 2)
     {
         throw new Exception("Invalid resolution specification!");
     }
     settings.xres = Convert.ToInt32(parts[0]);
     settings.yres = Convert.ToInt32(parts[1]);
 }
예제 #5
0
        protected override Rhino.Commands.Result RunCommand(RhinoDoc doc, Rhino.Commands.RunMode mode)
        {
            string          basePath = Path.GetDirectoryName(doc.Path);
            string          filename = Path.GetFileNameWithoutExtension(doc.Path) + ".xml";
            MitsubaSettings settings = new MitsubaSettings();

            settings.Load(MitsubaPlugIn.ThePlugIn.PluginSettings);

            RhinoApp.WriteLine("Running command");

            try {
                MitsubaExporter exporter = new MitsubaExporter(settings, basePath, filename);
                exporter.Export(doc);
                return(Rhino.Commands.Result.Success);
            } catch (Exception ex) {
                RhinoApp.WriteLine(ex.ToString());
                return(Rhino.Commands.Result.Failure);
            }
        }