public void Load(PersistentSettings settings) { writeSerialized = settings.GetBool("WriteSerialized", true); rendererDirectory = settings.GetString("RendererDirectory", ""); xres = settings.GetInteger("XResolution", 1024); yres = settings.GetInteger("YResolution", 768); pathLength = settings.GetInteger("PathLength", 3); samplesPerPixel = settings.GetInteger("SamplesPerPixel", 4); integrator = (Integrator)settings.GetInteger("Integrator", (int)Integrator.EDirectIllumination); }
protected override Result RunCommand(RhinoDoc doc, RunMode mode) { // Get persistent settings (from Registry) PersistentSettings settings = this.PlugIn.Settings; bool save_settings = false; bool enabled = settings.GetBool("enabled", true); bool new_layer_visible_in_layout = settings.GetBool("new_layer_visible_in_layout", false); GetOption go = new GetOption(); OptionToggle option_toggle_enabled = new OptionToggle(enabled, "off", "on"); OptionToggle option_toggle_newLayerLayoutVisible = new OptionToggle(new_layer_visible_in_layout, "off", "on"); go.AddOptionToggle("enabled", ref option_toggle_enabled); go.AddOptionToggle("new_layer_visible_in_layout", ref option_toggle_newLayerLayoutVisible); go.SetCommandPrompt("Safe Layout Settings"); Rhino.Input.GetResult get_rc = go.Get(); Result rc = go.CommandResult(); if (enabled != option_toggle_enabled.CurrentValue) { enabled = option_toggle_enabled.CurrentValue; settings.SetBool("enabled", enabled); save_settings = true; } if (new_layer_visible_in_layout != option_toggle_newLayerLayoutVisible.CurrentValue) { new_layer_visible_in_layout = option_toggle_newLayerLayoutVisible.CurrentValue; settings.SetBool("new_layer_visible_in_layout", new_layer_visible_in_layout); save_settings = true; } if (save_settings) { this.PlugIn.SaveSettings(); } return(rc); }