private void LoadGuiSettings() { GuiInputPreferences guiInputSettings; if (CheckBoxX_ConvertModel.Checked && File.Exists(curModelFile)) { guiInputSettings = GuiInputPreferences.Load(curModelFile + EXT_CONVERSION_PREFERENCES); } else if (CheckBoxX_ConvertCollision.Checked && File.Exists(curCollisionFile)) { guiInputSettings = GuiInputPreferences.Load(curCollisionFile + EXT_CONVERSION_PREFERENCES); } else { guiInputSettings = new GuiInputPreferences(); } NUD_Scaling.Value = guiInputSettings.Scaling; SwitchButton_EnableReduceVertices.Value = Conversions.ToBoolean(guiInputSettings.ReduceDupVerts); SwitchButton_ResizeTextures.Value = guiInputSettings.ResizeTextures; SwitchButton_CenterModel.Value = guiInputSettings.CenterModel; ColorPickerButton_ShadingAmbient.SelectedColor = guiInputSettings.Shading.AmbientColor; ColorPickerButton_ShadingDiffuse.SelectedColor = guiInputSettings.Shading.DiffuseColor; curDiffusePos = guiInputSettings.Shading.DiffusePosition; bool isFogNotNothing = guiInputSettings.Fog is object; SwitchButton_EnableFog.Value = isFogNotNothing; if (isFogNotNothing) { ColorPickerButton_FogColor.SelectedColor = guiInputSettings.Fog.Color; ComboBox_FogTyp.SelectedIndex = (int)guiInputSettings.Fog.Type; } }
private void SaveGuiSettings(bool importVMap, bool importColMap) { var guiInputSettings = new GuiInputPreferences(); guiInputSettings.Scaling = NUD_Scaling.Value; guiInputSettings.ReduceDupVerts = SwitchButton_EnableReduceVertices.Value; guiInputSettings.ResizeTextures = SwitchButton_ResizeTextures.Value; guiInputSettings.CenterModel = SwitchButton_CenterModel.Value; guiInputSettings.Shading.AmbientColor = ColorPickerButton_ShadingAmbient.SelectedColor; guiInputSettings.Shading.DiffuseColor = ColorPickerButton_ShadingDiffuse.SelectedColor; guiInputSettings.Shading.DiffusePosition = curDiffusePos; if (SwitchButton_EnableFog.Value) { guiInputSettings.Fog = new Fog() { Color = ColorPickerButton_FogColor.SelectedColor, Type = (FogPreset)ComboBox_FogTyp.SelectedIndex }; } else { guiInputSettings.Fog = null; } if (importVMap) { guiInputSettings.Save(curModelFile + EXT_CONVERSION_PREFERENCES); } if (importColMap) { guiInputSettings.Save(curCollisionFile + EXT_CONVERSION_PREFERENCES); } }