From ab03db466f87df4c7c28f10d8e9ceffe06cf7f4d Mon Sep 17 00:00:00 2001 From: FHomps Date: Thu, 25 Jul 2019 14:13:40 +0200 Subject: [PATCH] Fixed attribute roles not resetting properly when switching visualizations --- ReViVD/Assets/ControlPanel/ControlPanel.cs | 5 +++++ ReViVD/Assets/Visualization/Visualization.cs | 10 +++++----- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/ReViVD/Assets/ControlPanel/ControlPanel.cs b/ReViVD/Assets/ControlPanel/ControlPanel.cs index 81ddcc5..105f626 100644 --- a/ReViVD/Assets/ControlPanel/ControlPanel.cs +++ b/ReViVD/Assets/ControlPanel/ControlPanel.cs @@ -454,21 +454,25 @@ bool CheckIfAtomAttributeExists(string attribute, ControlPanel.JsonData.AtomAttr data.chosen_instants_step = Tools.ParseField_i(sampling.instants_step, 1); data.useGPSCoords = axisConf.gps.isOn; + data.atomAttributeUsedAs_x = ""; if (axisConf.xAxis.value != 0) { JsonData.AtomAttribute attr = data.atomAttributes[axisConf.xAxis.value - 1]; attr.sizeCoeff = Tools.ParseField_f(axisConf.xScale, 1f); data.atomAttributeUsedAs_x = attr.name; } + data.atomAttributeUsedAs_y = ""; if (axisConf.yAxis.value != 0) { JsonData.AtomAttribute attr = data.atomAttributes[axisConf.yAxis.value - 1]; attr.sizeCoeff = Tools.ParseField_f(axisConf.yScale, 1f); data.atomAttributeUsedAs_y = attr.name; } + data.atomAttributeUsedAs_z = ""; if (axisConf.zAxis.value != 0) { JsonData.AtomAttribute attr = data.atomAttributes[axisConf.zAxis.value - 1]; attr.sizeCoeff = Tools.ParseField_f(axisConf.zScale, 1f); data.atomAttributeUsedAs_z = attr.name; } + data.atomAttributeUsedAs_t = ""; if (axisConf.time.value != 0) { data.atomAttributeUsedAs_t = data.atomAttributes[axisConf.time.value - 1].name; } @@ -478,6 +482,7 @@ bool CheckIfAtomAttributeExists(string attribute, ControlPanel.JsonData.AtomAttr data.spheresAnimSpeed = Tools.ParseField_f(spheres.animSpeed, 1); data.spheresRadius = Tools.ParseField_f(spheres.radius, 2); + data.atomAttributeUsedAs_color = ""; if (style.attribute.value != 0) { JsonData.AtomAttribute attr = data.atomAttributes[style.attribute.value - 1]; attr.colorStart = (JsonData.Color)style.startColor.value; diff --git a/ReViVD/Assets/Visualization/Visualization.cs b/ReViVD/Assets/Visualization/Visualization.cs index f9f5512..1f47dd3 100644 --- a/ReViVD/Assets/Visualization/Visualization.cs +++ b/ReViVD/Assets/Visualization/Visualization.cs @@ -504,9 +504,9 @@ int ReadAttribute_i(BinaryReader reader, ControlPanel.JsonData.DataType type) { } paths = new List(keptPaths.Length); - Color32[] pathColors = new Color32[keptPaths.Length]; + Color32[] randomPathColors = new Color32[keptPaths.Length]; for (int i = 0; i < keptPaths.Length; i++) - pathColors[i] = UnityEngine.Random.ColorHSV(); + randomPathColors[i] = UnityEngine.Random.ColorHSV(); Tools.AddClockStop("Generated paths array"); @@ -694,11 +694,11 @@ void ReadPathAttributes() { a.point.x += data.atomAttributes[X_RoleIndex].positionOffset; a.point.y += data.atomAttributes[Y_RoleIndex].positionOffset; a.point.z += data.atomAttributes[Z_RoleIndex].positionOffset; - a.point = Vector3.Max(a.point, lowerTruncature); - a.point = Vector3.Min(a.point, upperTruncature); a.point.x *= data.atomAttributes[X_RoleIndex].sizeCoeff; a.point.y *= data.atomAttributes[Y_RoleIndex].sizeCoeff; a.point.z *= data.atomAttributes[Z_RoleIndex].sizeCoeff; + a.point = Vector3.Max(a.point, lowerTruncature); + a.point = Vector3.Min(a.point, upperTruncature); if (T_RoleIndex != -1) a.time = atomAttributeValuesBuffer[T_RoleIndex]; @@ -717,7 +717,7 @@ void ReadPathAttributes() { } } else { - a.BaseColor = pathColors[i_path]; + a.BaseColor = randomPathColors[i_path]; } p.atoms.Add(a);