private void button_RemoveLayer_Click(object sender, System.EventArgs e) { int iIndex = SelectedLayerIndex; System.Diagnostics.Debug.Assert(iIndex >= 0); SkyConfig.Layers.RemoveAt(iIndex); FillLayerList(iIndex); SkyConfig.Update(); }
private void toolStripButton_PasteConfig_Click(object sender, EventArgs e) { SkyConfig newConf = EditorManager.Clipboard.DataObject as SkyConfig; if (newConf == null) { return; } SkyConfig = newConf; // this clones it SkyConfig.Update(); }
private void button_AddLayer_Click(object sender, System.EventArgs e) { int iIndex = SkyConfig.Layers.Add(new SkyLayer()); if (SkyConfig.LayerCount > 4 && !bLayerCountReported) { bLayerCountReported = true; EditorManager.ShowMessageBox("More than 4 layers are supported but a custom shader is needed to blend additional layers.", "More than 4 Sky Layers", MessageBoxButtons.OK, MessageBoxIcon.Information); } FillLayerList(iIndex); SkyConfig.Update(); }
private void button_RemoveLayer_Click(object sender, System.EventArgs e) { int iIndex = SelectedLayerIndex; System.Diagnostics.Debug.Assert(iIndex >= 0); SkyConfig.Layers.RemoveAt(iIndex); FillLayerList(iIndex); if (SkyConfig.Layers.Count == 0) { this.PropertyGrid_Layer.SelectedObject = null; } SkyConfig.Update(); }
private void button_AddLayer_Click(object sender, System.EventArgs e) { if (SkyConfig.Layers.Count >= 4) { EditorManager.ShowMessageBox("More than 4 layers are not supported.", "More than 4 Sky Layers", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } int iIndex = SkyConfig.Layers.Add(new SkyLayer()); FillLayerList(iIndex); SkyConfig.Update(); }
private void button_LayerDown_Click(object sender, EventArgs e) { int iIndex = SelectedLayerIndex; if (iIndex < 0 || iIndex >= SkyConfig.Layers.Count - 1) { return; } SkyLayer layer = SkyConfig.Layers[iIndex]; SkyConfig.Layers.RemoveAt(iIndex); SkyConfig.Layers.InsertAt(iIndex + 1, layer); FillLayerList(iIndex + 1); SkyConfig.Update(); }
private void toolStripButton_Load_Click(object sender, EventArgs e) { if (_skyConfig == null) { return; } OpenFileDialog dlg = new OpenFileDialog(); dlg.InitialDirectory = EditorManager.Project.ProjectDir; dlg.FileName = null; dlg.Filter = "Sky setup|*.Sky"; dlg.Title = "Load Sky setup from file"; if (dlg.ShowDialog(this) != DialogResult.OK) { return; } string filename = dlg.FileName; dlg.Dispose(); SkyConfig _sky = null; try { BinaryFormatter fmt = SerializationHelper.BINARY_FORMATTER; FileStream fs = new FileStream(filename, FileMode.Open, FileAccess.Read); _sky = (SkyConfig)fmt.Deserialize(fs); fs.Close(); } catch (Exception ex) { EditorManager.ShowMessageBox("Failed to load sky setup from file:\n\n" + ex.Message, "Error loading file", MessageBoxButtons.OK, MessageBoxIcon.Error); } if (_sky != null) { SkyConfig = _sky; SkyConfig.Update(); } EditorManager.ActiveView.UpdateView(true); }
private void propertyGrid1_PropertyValueChanged(object s, System.Windows.Forms.PropertyValueChangedEventArgs e) { if (SkyConfig == null) { return; } // Atmospheric scattering doesn't need to rebuild lookups on layer changes if (SkyConfig.SkyClass != "VAtmosphere") { SkyConfig.RecomputeLookup = true; } SkyConfig.Update(); if (e.ChangedItem.Label == "Mapping" || e.ChangedItem.Label == "LayerName") // when mapping type changes, update the list view { FillLayerList(SelectedLayerIndex); //listView_layers_SelectedIndexChanged(null,null); // update the property object if layer type changed } }
public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value) { SkyConfigDlg dlg = new SkyConfigDlg(); SkyConfig oldsky = SceneSkyConfig; oldsky.Active = false; // disable this config dlg.SkyConfig = oldsky; if (dlg.ShowDialog() == DialogResult.OK) { EditorManager.Actions.Add(new SkyConfigChangedAction(SceneV3DLayer, dlg.SkyConfig)); return(dlg.SkyConfig); } //restore old sky again dlg.SkyConfig.Active = false; oldsky.Active = true; oldsky.Update(); return(oldsky); }
public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value) { using (SkyConfigDlg dlg = new SkyConfigDlg()) { SkyConfig oldsky = SceneSkyConfig; dlg.SkyConfig = oldsky; // this assignment will clone the config oldsky.Active = false; // disable the old config dlg.SkyConfig.HidePropertiesInEditor = false; if (dlg.ShowDialog() == DialogResult.OK) { dlg.SkyConfig.HidePropertiesInEditor = true; EditorManager.Actions.Add(new SkyConfigChangedAction(SceneV3DLayer, dlg.SkyConfig)); return(dlg.SkyConfig); } // restore old sky oldsky.Active = true; oldsky.Update(); return(oldsky); } }