private void Menu_Engine_EditFog_Click(object sender, EventArgs e) { V3DLayer layer = null; if (EditorManager.Scene != null) layer = EditorApp.Scene.V3DLayer; if (layer == null || !layer.Modifiable) return; FogSetup oldSetup = layer.FogSetup.Clone() as FogSetup; bool bDeferred = (layer.RendererNodeClass == IRendererNodeManager.RENDERERNODECLASS_DEFERRED); bool bForward = (layer.RendererNodeClass == IRendererNodeManager.RENDERERNODECLASS_FORWARD); bool bIR = (layer.RendererNodeClass == "VInfraredRendererNode"); FogDlg dlg = new FogDlg(layer.FogSetup, bDeferred || bIR, bDeferred || bForward || bIR); if (dlg.ShowDialog() != DialogResult.OK) { // Revert changes to original state. layer.FogSetup = oldSetup; EditorManager.EngineManager.SetFogParameters(layer.FogSetup); } else { // Get changed fog setup and apply it to the layer via the appropriate action. EditorManager.Actions.Add(new FogSetupChangedAction(layer, (FogSetup)dlg.Setup.Clone())); layer.Modified = true; } }
private void Menu_Engine_EditFog_Click(object sender, EventArgs e) { V3DLayer layer = null; if (EditorManager.Scene != null) layer = EditorApp.Scene.V3DLayer; if (layer == null || !layer.Modifiable) return; FogSetup oldSetup = layer.FogSetup.Clone() as FogSetup; ShapeComponentType fogCompType = EditorManager.RendererNodeManager.ComponentTypes.FirstOrDefault(t => t.UniqueName.Equals("VGlobalFogPostprocess")); bool bSupportsHeightFog = fogCompType != null && EditorManager.RendererNodeManager.CanAttachPostprocessor(fogCompType.ProbeComponent); bool bSupportsTimeOfDay = EditorManager.RendererNodeManager.SupportsTimeOfDay(); FogDlg dlg = new FogDlg(layer.FogSetup, bSupportsHeightFog, bSupportsTimeOfDay); if (dlg.ShowDialog() != DialogResult.OK) { // Revert changes to original state. layer.FogSetup = oldSetup; EditorManager.EngineManager.SetFogParameters(layer.FogSetup); } else { // Get changed fog setup and apply it to the layer via the appropriate action. EditorManager.Actions.Add(new FogSetupChangedAction(layer, (FogSetup)dlg.Setup.Clone())); layer.Modified = true; } }