private void DeleteNormalMap_Click(object sender, RoutedEventArgs e) { Debug.Assert(Layer.LayerType == LayerType.Lighting); LightingLayer layer = (LightingLayer)Layer; if (layer.FilePath != null) { ((LightingLayer)Layer).File = null; NormalMapFilename.Text = ""; NormalMapPropertyPanel.Children.Clear(); } }
private void UpdateUI() { if (Layer.LayerType == LayerType.Color) { ColorPanel.Visibility = Visibility.Visible; ColorPicker.Color = ((ColorLayer)Layer).Color; } else if (Layer.LayerType == LayerType.Image) { ImagePanel.Visibility = Visibility.Visible; string file = System.IO.Path.GetFileName(((ImageLayer)Layer).FilePath); if (file == null) { file = "<Load an image>"; } Filename.Text = file; ImageLayer layer = (ImageLayer)Layer; EdgeModeCombo.SelectedValue = layer.EdgeMode.ToString(); ImagePropertyPanel.Children.Clear(); UpdateImageProperties(ImagePropertyPanel, layer); EdgeModePanel.Children.Clear(); UpdateEdgeModeProperties(EdgeModePanel, layer); } else if (Layer.LayerType == LayerType.Lighting) { LightingPanel.Visibility = Visibility.Visible; LightingLayer lightLayer = ((LightingLayer)Layer); if (lightLayer.FilePath != null) { NormalMapFilename.Text = System.IO.Path.GetFileName(lightLayer.FilePath); NormalMapPropertyPanel.Children.Clear(); UpdateImageProperties(NormalMapPropertyPanel, (ImageLayer)Layer); UpdateEdgeModeProperties(NormalMapPropertyPanel, (ImageLayer)Layer); } UpdateLightingProperties(lightLayer); } LayerName.Text = Layer.Description; BlendType.SelectedValue = Layer.BlendMode; OpacitySlider.Value = (int)(Layer.Opacity * 100); }
private void UpdateLightingProperties(LightingLayer layer) { PropertyInfo info; LightingPropertyPanel.Children.Clear(); SceneLightingEffect lighting = layer.LightingEffect; info = lighting.GetType().GetProperties().FirstOrDefault(x => x.Name == "AmbientAmount"); Helpers.AddPropertyToPanel(lighting, layer, LightingPropertyPanel, info); info = lighting.GetType().GetProperties().FirstOrDefault(x => x.Name == "DiffuseAmount"); Helpers.AddPropertyToPanel(lighting, layer, LightingPropertyPanel, info); info = lighting.GetType().GetProperties().FirstOrDefault(x => x.Name == "SpecularAmount"); Helpers.AddPropertyToPanel(lighting, layer, LightingPropertyPanel, info); info = lighting.GetType().GetProperties().FirstOrDefault(x => x.Name == "SpecularShine"); Helpers.AddPropertyToPanel(lighting, layer, LightingPropertyPanel, info); info = lighting.GetType().GetProperties().FirstOrDefault(x => x.Name == "ReflectanceModel"); Helpers.AddPropertyToPanel(lighting, layer, LightingPropertyPanel, info); }
private void LayerType_SelectionChanged(object sender, SelectionChangedEventArgs e) { ColorPanel.Visibility = Visibility.Collapsed; ImagePanel.Visibility = Visibility.Collapsed; LightingPanel.Visibility = Visibility.Collapsed; ComboBoxItem item = LayerTypeCombo.SelectedItem as ComboBoxItem; LayerType layerType = (LayerType)item.Tag; if (Layer.LayerType != layerType) { Layer layer = null; switch (layerType) { case LayerType.Backdrop: { layer = new BackdropLayer(); } break; case LayerType.BackdropHost: { layer = new BackdropHostLayer(); } break; case LayerType.Color: { layer = new ColorLayer(); } break; case LayerType.Image: { layer = new ImageLayer(); } break; case LayerType.Lighting: { layer = new LightingLayer(); } break; case LayerType.Group: { layer = new GroupLayer(); } break; default: Debug.Assert(false); break; } // Set the new layer Layer.GroupLayer.ReplaceLayer(Layer, layer); Layer = layer; // Update the edit control UI UpdateUI(); } }