void newLight_LightTypeChanged(object sender, EventArgs e) { UnitLight light = sender as UnitLight; light.UpdateTransform(); viewPort.Children.Remove(light.ModelRepresentation); light.ModelRepresentation = light.CreateGeometry(); viewPort.Children.Add(light.ModelRepresentation); lbLights.SelectedItem = light; }
private void cbLightType_SelectionChanged(object sender, SelectionChangedEventArgs e) { UnitLight light = ((FrameworkElement)((sender as ComboBox).Parent)).DataContext as UnitLight; if (light != null) { light.UpdateTransform(); if (light.ModelRepresentation != null) { viewPort.Children.Remove(light.ModelRepresentation); } light.CreateGeometry(); viewPort.Children.Add(light.ModelRepresentation); // manipulator.Bind(light.ModelRepresentation); } }
private void btnCloneLight_Click(object sender, RoutedEventArgs e) { if (lbLights.SelectedItem is UnitLight) { UnitLight selLight = (UnitLight)lbLights.SelectedItem; selLight.UpdateTransform(); UnitLight light = new UnitLight(); light.LightDebugName = new String8Property() { Value = "New" }; light.LightColor = selLight.LightColor; light.LightType = selLight.LightType; light.LightCullDistance = selLight.LightCullDistance; light.LightId = selLight.LightId; light.LightInnerRadius = selLight.LightInnerRadius; light.LightOuterRadius = selLight.LightOuterRadius; light.LightSpecLevels = selLight.LightSpecLevels; light.LightLength = selLight.LightLength; light.IsVolumetric = selLight.IsVolumetric; light.LightDiffuseLevel = selLight.LightDiffuseLevel; light.LightVolStrength = selLight.LightVolStrength; light.LightFalloffStart = selLight.LightFalloffStart; light.LightTransform = new TransformProperty(); light.LightTransform.SetMatrix(selLight.LightTransform.GetAsMatrix3D()); light.LightTransform.Unknown = selLight.LightTransform.Unknown; light.LightTransform.Flags = selLight.LightTransform.Flags; light.CreateGeometry(); UnitFileEntry.UnitLights.Add(light); UnitFileEntry.UnitLights.Changed(); if (chkLights.IsChecked.GetValueOrDefault(false)) { viewPort.Children.Add(light.ModelRepresentation); } } }