From c8eece20ce6174656a259d2244f2afa284fcfe61 Mon Sep 17 00:00:00 2001 From: Carifio24 Date: Thu, 6 Jan 2022 14:45:47 -0500 Subject: [PATCH 1/4] Cast bytes to doubles when performing division in getParams to avoid truncation to integer values. --- WWTExplorer3d/Layer.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/WWTExplorer3d/Layer.cs b/WWTExplorer3d/Layer.cs index b9c6d76..5cfecaa 100644 --- a/WWTExplorer3d/Layer.cs +++ b/WWTExplorer3d/Layer.cs @@ -178,10 +178,10 @@ public virtual void CopyToClipboard() public virtual double[] GetParams() { double[] paramList = new double[5]; - paramList[0] = color.R/255; - paramList[1] = color.G/255; - paramList[2] = color.B/255; - paramList[3] = color.A/255; + paramList[0] = ((double)color.R) / 255; + paramList[1] = ((double)color.G) / 255; + paramList[2] = ((double)color.B) / 255; + paramList[3] = ((double)color.A) / 255; paramList[4] = opacity; From 7bbf13710209e9353f0cf39e5ac213bf8527c187 Mon Sep 17 00:00:00 2001 From: Carifio24 Date: Thu, 6 Jan 2022 17:04:43 -0500 Subject: [PATCH 2/4] Change the TourStop layers list to use the same GUID as the layers themselves. Try changing the FrameParams for the TourStop layers to match those of the layer object itself. --- WWTExplorer3d/LayerManager.cs | 11 +++++++++++ WWTExplorer3d/TourStop.cs | 10 +++++++++- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/WWTExplorer3d/LayerManager.cs b/WWTExplorer3d/LayerManager.cs index b173fc2..cf30d6b 100644 --- a/WWTExplorer3d/LayerManager.cs +++ b/WWTExplorer3d/LayerManager.cs @@ -1937,6 +1937,17 @@ void colorMenu_Click(object sender, EventArgs e) if (picker.ShowDialog() == DialogResult.OK) { layer.Color = picker.Color; + + // We're currently editing a tour stop, update the FrameParams for this layer + TourEditTab tourEdit = Earth3d.MainWindow.TourEdit; + if (tourEdit != null) + { + TourDocument tour = tourEdit.Tour; + if (tour != null && tour.CurrentTourStop != null) + { + tour.CurrentTourStop.Layers[layer.ID].FrameParams = layer.GetParams(); + } + } } } diff --git a/WWTExplorer3d/TourStop.cs b/WWTExplorer3d/TourStop.cs index f111c99..8d9fd39 100644 --- a/WWTExplorer3d/TourStop.cs +++ b/WWTExplorer3d/TourStop.cs @@ -2241,7 +2241,15 @@ private void LoadLayerList(XmlNode layersNode) foreach (XmlNode layer in layersNode) { LayerInfo info = new LayerInfo(); - info.ID = new Guid(layer.InnerText); + + if (layer.Attributes["Id"] != null) + { + info.ID = new Guid(layer.Attributes["Id"].Value); + } + else + { + info.ID = new Guid(layer.InnerText); + } info.StartOpacity = Convert.ToSingle(layer.Attributes["StartOpacity"].Value); info.EndOpacity = Convert.ToSingle(layer.Attributes["EndOpacity"].Value); From 0b81f0dc04ca31110b6fee3b8329b17be4867174 Mon Sep 17 00:00:00 2001 From: Carifio24 Date: Mon, 10 Jan 2022 12:28:17 -0500 Subject: [PATCH 3/4] Modify the appropriate LayerInfo's StartParams and EndParams as well. Check whether the layer in question is one of the layers in the current tour stop before grabbing the LayerInfo. --- WWTExplorer3d/LayerManager.cs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/WWTExplorer3d/LayerManager.cs b/WWTExplorer3d/LayerManager.cs index cf30d6b..6b45eca 100644 --- a/WWTExplorer3d/LayerManager.cs +++ b/WWTExplorer3d/LayerManager.cs @@ -1945,7 +1945,15 @@ void colorMenu_Click(object sender, EventArgs e) TourDocument tour = tourEdit.Tour; if (tour != null && tour.CurrentTourStop != null) { - tour.CurrentTourStop.Layers[layer.ID].FrameParams = layer.GetParams(); + Dictionary layers = tour.CurrentTourStop.Layers; + if (layers.ContainsKey(layer.ID)) + { + LayerInfo info = tour.CurrentTourStop.Layers[layer.ID]; + double[] pars = layer.GetParams(); + info.FrameParams = pars; + info.StartParams = pars; + info.EndParams = pars; + } } } } From 9657431dd9f34fa02e0dda7a174a9e279dedbc0d Mon Sep 17 00:00:00 2001 From: Carifio24 Date: Mon, 10 Jan 2022 12:40:50 -0500 Subject: [PATCH 4/4] Undo the Guid change made to tour stops. --- WWTExplorer3d/TourStop.cs | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/WWTExplorer3d/TourStop.cs b/WWTExplorer3d/TourStop.cs index 8d9fd39..f111c99 100644 --- a/WWTExplorer3d/TourStop.cs +++ b/WWTExplorer3d/TourStop.cs @@ -2241,15 +2241,7 @@ private void LoadLayerList(XmlNode layersNode) foreach (XmlNode layer in layersNode) { LayerInfo info = new LayerInfo(); - - if (layer.Attributes["Id"] != null) - { - info.ID = new Guid(layer.Attributes["Id"].Value); - } - else - { - info.ID = new Guid(layer.InnerText); - } + info.ID = new Guid(layer.InnerText); info.StartOpacity = Convert.ToSingle(layer.Attributes["StartOpacity"].Value); info.EndOpacity = Convert.ToSingle(layer.Attributes["EndOpacity"].Value);