Skip to content

Commit b7a687d

Browse files
committed
fix: fixing a bug that was causing incorrect atlases to be loaded when onlya subset of atlases were allowed
1 parent 9e79969 commit b7a687d

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

Assets/Scripts/Pinpoint/PinpointAtlasManager.cs

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ public class PinpointAtlasManager : MonoBehaviour
1818

1919
private Dictionary<string, string> _atlasNameMapping;
2020
private Dictionary<string, bool> _allowedOnWebGLMapping;
21+
List<string> _allowedNames;
2122

2223
public HashSet<OntologyNode> DefaultNodes;
2324

@@ -54,6 +55,9 @@ public void Startup()
5455
// we don't have transforms (yet) for waxholm rat
5556
case "waxholm_rat_39um":
5657
break;
58+
// we don't have transforms (yet) for waxholm rat
59+
case "waxholm_rat_78um":
60+
break;
5761
}
5862

5963
PopulateTransformDropdown();
@@ -66,15 +70,15 @@ public void PopulateAtlasDropdown()
6670
var atlasNames = BrainAtlasManager.AtlasNames;
6771

6872
#if UNITY_WEBGL
69-
List<string> allowedNames = new();
73+
_allowedNames = new();
7074
for (int i = 0; i < atlasNames.Count; i++)
7175
if (_allowedOnWebGLMapping[atlasNames[i]])
72-
allowedNames.Add(atlasNames[i]);
76+
_allowedNames.Add(atlasNames[i]);
7377
#else
7478
var allowedNames = atlasNames;
7579
#endif
7680

77-
_atlasDropdown.options = allowedNames.ConvertAll(ConvertAtlas2Userfriendly);
81+
_atlasDropdown.options = _allowedNames.ConvertAll(ConvertAtlas2Userfriendly);
7882
}
7983

8084
public void ResetAtlasDropdownIndex()
@@ -94,7 +98,10 @@ public void SetAtlas(int option)
9498
private void ResetScene(int option)
9599
{
96100
PlayerPrefs.SetInt("scene-atlas-reset", 1);
97-
Settings.AtlasName = BrainAtlasManager.AtlasNames[option];
101+
Settings.AtlasName = _allowedNames[option];
102+
#if UNITY_EDITOR
103+
Debug.Log($"(PAM) Resetting atlas to {Settings.AtlasName}");
104+
#endif
98105
SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex);
99106
}
100107

0 commit comments

Comments
 (0)