Skip to content

Commit

Permalink
Fixed attribute roles not resetting properly when switching visualiza…
Browse files Browse the repository at this point in the history
…tions
  • Loading branch information
FHomps committed Jul 25, 2019
1 parent 1fad942 commit ab03db4
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
5 changes: 5 additions & 0 deletions ReViVD/Assets/ControlPanel/ControlPanel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand All @@ -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;
Expand Down
10 changes: 5 additions & 5 deletions ReViVD/Assets/Visualization/Visualization.cs
Original file line number Diff line number Diff line change
Expand Up @@ -504,9 +504,9 @@ int ReadAttribute_i(BinaryReader reader, ControlPanel.JsonData.DataType type) {
}

paths = new List<Path>(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");

Expand Down Expand Up @@ -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];
Expand All @@ -717,7 +717,7 @@ void ReadPathAttributes() {
}
}
else {
a.BaseColor = pathColors[i_path];
a.BaseColor = randomPathColors[i_path];
}

p.atoms.Add(a);
Expand Down

0 comments on commit ab03db4

Please sign in to comment.