diff --git a/SCANassets/SCANsat.version b/SCANassets/SCANsat.version index cd10ae580..fcc9902a7 100644 --- a/SCANassets/SCANsat.version +++ b/SCANassets/SCANsat.version @@ -11,7 +11,7 @@ "MAJOR":1, "MINOR":1, "PATCH":1, - "BUILD":3 + "BUILD":4 }, "KSP_VERSION":{ "MAJOR":0, diff --git a/SCANmechjeb/Properties/AssemblyInfo.cs b/SCANmechjeb/Properties/AssemblyInfo.cs index bfafe994d..60707581e 100644 --- a/SCANmechjeb/Properties/AssemblyInfo.cs +++ b/SCANmechjeb/Properties/AssemblyInfo.cs @@ -32,9 +32,9 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.1.3.0")] -[assembly: AssemblyFileVersion("1.1.3.0")] -[assembly: AssemblyInformationalVersion ("v11rc3")] +[assembly: AssemblyVersion("1.1.4.0")] +[assembly: AssemblyFileVersion("1.1.4.0")] +[assembly: AssemblyInformationalVersion ("v11rc4")] [assembly: KSPAssembly ("SCANmechjeb", 0, 1)] [assembly: KSPAssemblyDependency ("SCANsat", 1, 1)] diff --git a/SCANsat/CHANGELOG.txt b/SCANsat/CHANGELOG.txt index b2d926104..cb74ea3c4 100644 --- a/SCANsat/CHANGELOG.txt +++ b/SCANsat/CHANGELOG.txt @@ -1,4 +1,11 @@ -Version 11.3 - 2014-4-18 +Version 11.4 - 2015-4-18 +------------------------ + +- Make slope and biome color selection persistent + +- Update resource selection when syncing zoom map to big map + +Version 11.3 - 2015-4-18 ------------------------ - Color management options for slope maps @@ -20,7 +27,7 @@ Version 11.3 - 2014-4-18 - Tweaks to Zoom Map synchronization - Click the zoom scale indicator to refresh the zoom map and re-sync with the current settings of the big map -Version 11.2 - 2014-4-12 +Version 11.2 - 2015-4-12 ------------------------ - Fix a bug preventing maps from working in sandbox or science mode saves diff --git a/SCANsat/Properties/AssemblyInfo.cs b/SCANsat/Properties/AssemblyInfo.cs index 9cb4f4a4c..bd8627d69 100644 --- a/SCANsat/Properties/AssemblyInfo.cs +++ b/SCANsat/Properties/AssemblyInfo.cs @@ -14,9 +14,9 @@ // The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}". // The form "{Major}.{Minor}.*" will automatically update the build and revision, // and "{Major}.{Minor}.{Build}.*" will update just the revision. -[assembly: AssemblyVersion ("1.1.3.0")] -[assembly: AssemblyFileVersion ("1.1.3.0")] -[assembly: AssemblyInformationalVersion ("v11rc3")] +[assembly: AssemblyVersion ("1.1.4.0")] +[assembly: AssemblyFileVersion ("1.1.4.0")] +[assembly: AssemblyInformationalVersion ("v11rc4")] [assembly: KSPAssembly ("SCANsat", 1, 1)] diff --git a/SCANsat/SCAN_Color_Config.cs b/SCANsat/SCAN_Color_Config.cs index 1a9b37844..b2d3d71f2 100644 --- a/SCANsat/SCAN_Color_Config.cs +++ b/SCANsat/SCAN_Color_Config.cs @@ -55,16 +55,6 @@ internal SCAN_Color_Config(string filepath, string node) public override void OnDecodeFromConfigNode() { - SCANUtil.SCANdebugLog("SCANsat Color Config Decode"); - SCANUtil.SCANdebugLog("-------->Default Min Height Range => {0}", defaultMinHeightRange); - SCANUtil.SCANdebugLog("-------->Default Max Height Range => {0}", defaultMaxHeightRange); - SCANUtil.SCANdebugLog("-------->Default Palette => {0}", defaultPalette); - SCANUtil.SCANdebugLog("-------->Low Biome Color => {0}", lowBiomeColor); - SCANUtil.SCANdebugLog("-------->High Biome Color => {0}", highBiomeColor); - SCANUtil.SCANdebugLog("-------->Biome Transparency => {0}", biomeTransparency); - SCANUtil.SCANdebugLog("-------->Stock Biome => {0}", stockBiomeMap); - SCANUtil.SCANdebugLog("-------->Low Slope Color => {0}", bottomLowSlopeColor); - SCANUtil.SCANdebugLog("-------->High Slope Color => {0}", bottemHighSlopeColor); SCANcontroller.setMasterTerrainNodes(SCANsat_Altimetry); SCANcontroller.setMasterResourceNodes(SCANsat_Resources); } @@ -73,7 +63,6 @@ public override void OnEncodeToConfigNode() { SCANUtil.SCANlog("Saving SCANsat configuration file..."); SCANUtil.SCANlog("SCANcolors.cfg saved to ---> {0}", FilePath); - SCANUtil.SCANdebugLog("Saving Config Master Node"); SCANsat_Altimetry = SCANcontroller.EncodeTerrainConfigs; SCANsat_Resources = SCANcontroller.EncodeResourceConfigs; diff --git a/SCANsat/SCAN_Platform/Extensions/Colors/UnityEngine.Color_.cs b/SCANsat/SCAN_Platform/Extensions/Colors/UnityEngine.Color_.cs index ad6e7bbad..a48dc4f57 100644 --- a/SCANsat/SCAN_Platform/Extensions/Colors/UnityEngine.Color_.cs +++ b/SCANsat/SCAN_Platform/Extensions/Colors/UnityEngine.Color_.cs @@ -170,9 +170,9 @@ public static string ToHex(this Color c) { } public static string ToRGBString(this Color c) { - return c.r.ToString("F3") - + c.g.ToString("F3") - + c.b.ToString("F3"); + return c.r.ToString("F4") + "," + + c.g.ToString("F4") + "," + + c.b.ToString("F4"); } public static Color FromHex(this Color c, string s) { diff --git a/SCANsat/SCAN_UI/SCANcolorSelection.cs b/SCANsat/SCAN_UI/SCANcolorSelection.cs index 506a5997b..d853a18eb 100644 --- a/SCANsat/SCAN_UI/SCANcolorSelection.cs +++ b/SCANsat/SCAN_UI/SCANcolorSelection.cs @@ -121,11 +121,16 @@ protected override void Start() slopeColorPickerLow = new SCANuiColorPicker(SCANcontroller.controller.lowSlopeColorOne, SCANcontroller.controller.highSlopeColorOne, true); slopeColorPickerHigh = new SCANuiColorPicker(SCANcontroller.controller.lowSlopeColorTwo, SCANcontroller.controller.highSlopeColorTwo, true); + slopeColorPickerLow.updateOldSwatches(); + slopeColorPickerHigh.updateOldSwatches(); + bTrans = SCANcontroller.controller.biomeTransparency; biomeTransSlider = new SCANuiSlider(0, 80, bTrans, "Ter. Trans: ", "%", 0); biomeColorPicker = new SCANuiColorPicker(SCANcontroller.controller.lowBiomeColor, SCANcontroller.controller.highBiomeColor, true); + biomeColorPicker.updateOldSwatches(); + if (SCANconfigLoader.GlobalResource) { loadedResources = SCANcontroller.setLoadedResourceList(); @@ -532,16 +537,10 @@ private void windowTabs(int id) if (GUILayout.Button("Slope")) { windowMode = 1; - - //slopeColorPicker.updateOldSwatches(); } if (GUILayout.Button("Biome")) { windowMode = 2; - - fineControlMode = oldFineControl = false; - - biomeColorPicker.updateOldSwatches(); } if (SCANconfigLoader.GlobalResource) { diff --git a/SCANsat/SCAN_UI/SCANzoomWindow.cs b/SCANsat/SCAN_UI/SCANzoomWindow.cs index 07915fb2d..383516982 100644 --- a/SCANsat/SCAN_UI/SCANzoomWindow.cs +++ b/SCANsat/SCAN_UI/SCANzoomWindow.cs @@ -113,21 +113,34 @@ public void setMapCenter(double lat, double lon, SCANmap big) Visible = true; bigmap = big; - SCANdata dat = SCANUtil.getData(bigmap.Body); - if (dat == null) - dat = new SCANdata(bigmap.Body); - - data = dat; - b = data.Body; - - spotmap.MapScale = 10; - spotmap.setBody(b); + SCANcontroller.controller.MechJebSelecting = false; + SCANcontroller.controller.MechJebSelectingActive = false; if (bigmap.Projection == MapProjection.Polar) spotmap.setProjection(MapProjection.Polar); else spotmap.setProjection(MapProjection.Rectangular); + if (bigmap.Body != b) + { + SCANdata dat = SCANUtil.getData(bigmap.Body); + if (dat == null) + dat = new SCANdata(bigmap.Body); + + data = dat; + b = data.Body; + + spotmap.setBody(b); + } + + if (SCANconfigLoader.GlobalResource) + { + spotmap.Resource = bigmap.Resource; + spotmap.Resource.CurrentBodyConfig(b.name); + } + + spotmap.MapScale = 10; + spotmap.centerAround(lon, lat); spotmap.resetMap(bigmap.MType, false); } diff --git a/SCANsat/SCANcontroller.cs b/SCANsat/SCANcontroller.cs index 575380900..1f867017e 100644 --- a/SCANsat/SCANcontroller.cs +++ b/SCANsat/SCANcontroller.cs @@ -110,18 +110,14 @@ public static SCANcontroller controller public bool useStockBiomes = false; [KSPField(isPersistant = true)] public float biomeTransparency = 40; - [KSPField(isPersistant = true)] + + /* Biome and slope colors can't be serialized properly as a KSP Field */ public Color lowBiomeColor = palette.xkcd_CamoGreen; - [KSPField(isPersistant = true)] public Color highBiomeColor = palette.xkcd_Marigold; - [KSPField(isPersistant = true)] public Color lowSlopeColorOne = palette.xkcd_PukeGreen; - [KSPField(isPersistant = true)] public Color highSlopeColorOne = palette.xkcd_Yellow; - [KSPField(isPersistant = true)] - public Color lowSlopeColorTwo = palette.xkcd_PukeGreen; - [KSPField(isPersistant = true)] - public Color highSlopeColorTwo = palette.xkcd_Yellow; + public Color lowSlopeColorTwo = palette.xkcd_Yellow; + public Color highSlopeColorTwo = palette.xkcd_OrangeRed; /* Available resources for overlays; loaded from SCANsat configs; only loaded once */ private static Dictionary masterResourceNodes = new Dictionary(); @@ -524,6 +520,21 @@ public SCANwaypoint MechJebTarget public override void OnLoad(ConfigNode node) { + try + { + lowBiomeColor = ConfigNode.ParseColor(node.GetValue("lowBiomeColor")); + highBiomeColor = ConfigNode.ParseColor(node.GetValue("highBiomeColor")); + lowSlopeColorOne = ConfigNode.ParseColor(node.GetValue("lowSlopeColorOne")); + highSlopeColorOne = ConfigNode.ParseColor(node.GetValue("highSlopeColorOne")); + lowSlopeColorTwo = ConfigNode.ParseColor(node.GetValue("lowSlopeColorTwo")); + highSlopeColorTwo = ConfigNode.ParseColor(node.GetValue("highSlopeColorTwo")); + } + catch (Exception e) + { + SCANUtil.SCANlog("Error While Loading SCANsat Colors: {0}", e); + } + + ConfigNode node_vessels = node.GetNode("Scanners"); if (node_vessels != null) { @@ -675,70 +686,74 @@ public override void OnLoad(ConfigNode node) public override void OnSave(ConfigNode node) { - if (HighLogic.LoadedScene != GameScenes.EDITOR) + node.AddValue("lowBiomeColor", ConfigNode.WriteColor(lowBiomeColor)); + node.AddValue("highBiomeColor", ConfigNode.WriteColor(highBiomeColor)); + node.AddValue("lowSlopeColorOne", ConfigNode.WriteColor(lowSlopeColorOne)); + node.AddValue("highSlopeColorOne", ConfigNode.WriteColor(highSlopeColorOne)); + node.AddValue("lowSlopeColorTwo", ConfigNode.WriteColor(lowSlopeColorTwo)); + node.AddValue("highSlopeColorTwo", ConfigNode.WriteColor(highSlopeColorTwo)); + + ConfigNode node_vessels = new ConfigNode("Scanners"); + foreach (Guid id in knownVessels.Keys) { - ConfigNode node_vessels = new ConfigNode("Scanners"); - foreach (Guid id in knownVessels.Keys) + ConfigNode node_vessel = new ConfigNode("Vessel"); + node_vessel.AddValue("guid", id.ToString()); + if (knownVessels[id].vessel != null) node_vessel.AddValue("name", knownVessels[id].vessel.vesselName); // not read + foreach (SCANsensor sensor in knownVessels[id].sensors.Values) { - ConfigNode node_vessel = new ConfigNode("Vessel"); - node_vessel.AddValue("guid", id.ToString()); - if (knownVessels[id].vessel != null) node_vessel.AddValue("name", knownVessels[id].vessel.vesselName); // not read - foreach (SCANsensor sensor in knownVessels[id].sensors.Values) - { - ConfigNode node_sensor = new ConfigNode("Sensor"); - node_sensor.AddValue("type", (int)sensor.sensor); - node_sensor.AddValue("fov", sensor.fov); - node_sensor.AddValue("min_alt", sensor.min_alt); - node_sensor.AddValue("max_alt", sensor.max_alt); - node_sensor.AddValue("best_alt", sensor.best_alt); - node_vessel.AddNode(node_sensor); - } - node_vessels.AddNode(node_vessel); + ConfigNode node_sensor = new ConfigNode("Sensor"); + node_sensor.AddValue("type", (int)sensor.sensor); + node_sensor.AddValue("fov", sensor.fov); + node_sensor.AddValue("min_alt", sensor.min_alt); + node_sensor.AddValue("max_alt", sensor.max_alt); + node_sensor.AddValue("best_alt", sensor.best_alt); + node_vessel.AddNode(node_sensor); } - node.AddNode(node_vessels); - if (body_data != null) + node_vessels.AddNode(node_vessel); + } + node.AddNode(node_vessels); + if (body_data != null) + { + ConfigNode node_progress = new ConfigNode("Progress"); + foreach (string body_name in body_data.Keys) { - ConfigNode node_progress = new ConfigNode("Progress"); - foreach (string body_name in body_data.Keys) - { - ConfigNode node_body = new ConfigNode("Body"); - SCANdata body_scan = body_data[body_name]; - node_body.AddValue("Name", body_name); - node_body.AddValue("Disabled", body_scan.Disabled); - node_body.AddValue("MinHeightRange", body_scan.TerrainConfig.MinTerrain); - node_body.AddValue("MaxHeightRange", body_scan.TerrainConfig.MaxTerrain); - if (body_scan.TerrainConfig.ClampTerrain != null) - node_body.AddValue("ClampHeight", body_scan.TerrainConfig.ClampTerrain); - node_body.AddValue("PaletteName", body_scan.TerrainConfig.ColorPal.name); - node_body.AddValue("PaletteSize", body_scan.TerrainConfig.PalSize); - node_body.AddValue("PaletteReverse", body_scan.TerrainConfig.PalRev); - node_body.AddValue("PaletteDiscrete", body_scan.TerrainConfig.PalDis); - node_body.AddValue("Map", body_scan.integerSerialize()); - node_progress.AddNode(node_body); - } - node.AddNode(node_progress); + ConfigNode node_body = new ConfigNode("Body"); + SCANdata body_scan = body_data[body_name]; + node_body.AddValue("Name", body_name); + node_body.AddValue("Disabled", body_scan.Disabled); + node_body.AddValue("MinHeightRange", body_scan.TerrainConfig.MinTerrain); + node_body.AddValue("MaxHeightRange", body_scan.TerrainConfig.MaxTerrain); + if (body_scan.TerrainConfig.ClampTerrain != null) + node_body.AddValue("ClampHeight", body_scan.TerrainConfig.ClampTerrain); + node_body.AddValue("PaletteName", body_scan.TerrainConfig.ColorPal.name); + node_body.AddValue("PaletteSize", body_scan.TerrainConfig.PalSize); + node_body.AddValue("PaletteReverse", body_scan.TerrainConfig.PalRev); + node_body.AddValue("PaletteDiscrete", body_scan.TerrainConfig.PalDis); + node_body.AddValue("Map", body_scan.integerSerialize()); + node_progress.AddNode(node_body); } - if (resourceTypes.Count > 0 && masterResourceNodes.Count > 0) + node.AddNode(node_progress); + } + if (resourceTypes.Count > 0 && masterResourceNodes.Count > 0) + { + ConfigNode node_resources = new ConfigNode("SCANResources"); + foreach (SCANresourceGlobal r in masterResourceNodes.Values) { - ConfigNode node_resources = new ConfigNode("SCANResources"); - foreach (SCANresourceGlobal r in masterResourceNodes.Values) + if (r != null) { - if (r != null) - { - SCANUtil.SCANdebugLog("Saving Resource: {0}", r.Name); - ConfigNode node_resource_type = new ConfigNode("ResourceType"); - node_resource_type.AddValue("Resource", r.Name); - node_resource_type.AddValue("MinColor", ConfigNode.WriteColor(r.MinColor)); - node_resource_type.AddValue("MaxColor", ConfigNode.WriteColor(r.MaxColor)); - node_resource_type.AddValue("Transparency", r.Transparency); - - string rMinMax = saveResources(r); - node_resource_type.AddValue("MinMaxValues", rMinMax); - node_resources.AddNode(node_resource_type); - } + SCANUtil.SCANdebugLog("Saving Resource: {0}", r.Name); + ConfigNode node_resource_type = new ConfigNode("ResourceType"); + node_resource_type.AddValue("Resource", r.Name); + node_resource_type.AddValue("MinColor", ConfigNode.WriteColor(r.MinColor)); + node_resource_type.AddValue("MaxColor", ConfigNode.WriteColor(r.MaxColor)); + node_resource_type.AddValue("Transparency", r.Transparency); + + string rMinMax = saveResources(r); + node_resource_type.AddValue("MinMaxValues", rMinMax); + node_resources.AddNode(node_resource_type); } - node.AddNode(node_resources); } + node.AddNode(node_resources); } }