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); } }
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; } }
private void Menu_Engine_EditSky_Click(object sender, System.EventArgs e) { V3DLayer layer = null; if (EditorManager.Scene!=null) layer = EditorApp.Scene.V3DLayer; if (layer==null || !layer.Modifiable) return; SkyConfigDlg dlg = new SkyConfigDlg(); dlg.SkyConfig = layer.SkyConfig; // this assignment will clone the config if (dlg.ShowDialog()==DialogResult.OK) { EditorManager.Actions.Add(new SkyConfigChangedAction(layer,dlg.SkyConfig)); } else { layer.SkyConfig.Update(); // restore old sky } dlg.Dispose(); }
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; }
private void Menu_Engine_EditSky_Click(object sender, System.EventArgs e) { V3DLayer layer = null; if (EditorManager.Scene!=null) layer = EditorApp.Scene.V3DLayer; if (layer==null || !layer.Modifiable) return; using (SkyConfigDlg dlg = new SkyConfigDlg()) { dlg.SkyConfig = layer.SkyConfig; // this assignment will clone the config layer.SkyConfig.Active = false; // set the layer's SkyConfig to inactive, since only one instance should be active at the same time dlg.SkyConfig.HidePropertiesInEditor = false; if (dlg.ShowDialog() == DialogResult.OK) { dlg.SkyConfig.HidePropertiesInEditor = true; EditorManager.Actions.Add(new SkyConfigChangedAction(layer, dlg.SkyConfig)); } else { // restore old sky layer.SkyConfig.Active = true; layer.SkyConfig.Update(); } } }