Skip to content

Commit a185482

Browse files
committed
fix: lots of fixes to B-L behavior, probe panel height settings, and quick settings color
1 parent bf6b0b1 commit a185482

File tree

10 files changed

+787
-331
lines changed

10 files changed

+787
-331
lines changed

Assets/Prefabs/UI/SettingsMenu/Menus/AtlasMenu.prefab

Lines changed: 602 additions & 276 deletions
Large diffs are not rendered by default.

Assets/Scenes/TrajectoryPlanner.unity

Lines changed: 122 additions & 36 deletions
Large diffs are not rendered by default.

Assets/Scripts/Pinpoint/PinpointAtlasManager.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@
99

1010
public class PinpointAtlasManager : MonoBehaviour
1111
{
12-
[SerializeField] BregmaLambdaBehavior _blBehavior;
13-
1412
[SerializeField] private TMP_Dropdown _atlasDropdown;
1513
[SerializeField] List<string> _atlasNames;
1614
[SerializeField] List<string> _atlasMappings;

Assets/Scripts/Pinpoint/Probes/ProbeManager.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,8 @@ private void Start()
262262
if (_probeRenderer) _probeRenderer.material.color = _color;
263263

264264
UIUpdateEvent.Invoke();
265+
if (ActiveProbeManager == this)
266+
ActiveProbeUIUpdateEvent.Invoke();
265267
}
266268

267269
/// <summary>

Assets/Scripts/Pinpoint/Probes/UI/ProbePanelManager.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ public class ProbePanelManager : MonoBehaviour
1111
{
1212
#region Constants
1313
private const int MAX_VISIBLE_PROBE_PANELS = 16;
14-
public float DEFAULT_PROBE_PANEL_HEIGHT {get; private set; }
14+
public float _probePanelHeight {get; private set; }
1515
#endregion
1616

1717
#region Public vars / Properties
@@ -23,7 +23,7 @@ public class ProbePanelManager : MonoBehaviour
2323
#region Unity
2424
private void Awake()
2525
{
26-
DEFAULT_PROBE_PANEL_HEIGHT = 1440f;
26+
_probePanelHeight = 1440f;
2727
}
2828

2929
#endregion
@@ -55,7 +55,7 @@ public void CountProbePanels()
5555

5656
public void SetPanelHeight(float newHeight)
5757
{
58-
DEFAULT_PROBE_PANEL_HEIGHT = newHeight;
58+
_probePanelHeight = newHeight;
5959
RecalculateProbePanels();
6060
}
6161

@@ -74,27 +74,27 @@ public void RecalculateProbePanels()
7474
// Increase the layout to have two rows, by shrinking all the ProbePanel objects to be 500 pixels tall
7575
GridLayoutGroup probePanelParent = GameObject.Find("ProbePanelParent").GetComponent<GridLayoutGroup>();
7676
Vector2 cellSize = probePanelParent.cellSize;
77-
cellSize.y = DEFAULT_PROBE_PANEL_HEIGHT/2;
77+
cellSize.y = _probePanelHeight/2;
7878
probePanelParent.cellSize = cellSize;
7979

8080
// now resize all existing probeUIs to be 720 tall
8181
foreach (ProbeManager probeManager in ProbeManager.Instances)
8282
{
83-
probeManager.ResizeProbePanel(Mathf.RoundToInt(DEFAULT_PROBE_PANEL_HEIGHT/2));
83+
probeManager.ResizeProbePanel(Mathf.RoundToInt(_probePanelHeight/2));
8484
}
8585
}
8686
else if (VisibleProbePanels <= 4)
8787
{
88-
Debug.Log("Resizing panels to be 1440");
88+
Debug.Log($"Resizing panels to be {_probePanelHeight}");
8989
// now resize all existing probeUIs to be 1400 tall
9090
GridLayoutGroup probePanelParent = GameObject.Find("ProbePanelParent").GetComponent<GridLayoutGroup>();
9191
Vector2 cellSize = probePanelParent.cellSize;
92-
cellSize.y = DEFAULT_PROBE_PANEL_HEIGHT;
92+
cellSize.y = _probePanelHeight;
9393
probePanelParent.cellSize = cellSize;
9494

9595
foreach (ProbeManager probeManager in ProbeManager.Instances)
9696
{
97-
probeManager.ResizeProbePanel(Mathf.RoundToInt(DEFAULT_PROBE_PANEL_HEIGHT));
97+
probeManager.ResizeProbePanel(Mathf.RoundToInt(_probePanelHeight));
9898
}
9999
}
100100

Assets/Scripts/Pinpoint/TrajectoryPlannerManager.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,6 @@ public async void Startup()
168168

169169
// Set the reference coordinate before anything else happen
170170
// if this is the first time, load bregma
171-
Debug.Log((_firstTime, _atlasReset));
172171
if (_firstTime || _atlasReset)
173172
{
174173
if (Utils.BregmaDefaults.ContainsKey(Settings.AtlasName))
@@ -201,8 +200,6 @@ public async void Startup()
201200

202201
// Now that the areas are loaded we can also set the BLDistance values
203202
SetBLUI();
204-
if (Settings.BregmaLambdaDistance > 0f)
205-
ChangeBLDistance(Settings.BregmaLambdaDistance);
206203

207204
StartupEvent_RefAtlasLoaded.Invoke();
208205
StartupEvent_AnnotationTextureLoaded.Invoke(BrainAtlasManager.ActiveReferenceAtlas.AnnotationTexture);

Assets/Scripts/Pinpoint/UI/BregmaLambdaBehavior.cs

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,19 @@
1+
using TMPro;
12
using UnityEngine;
23
using UnityEngine.UI;
34

45
public class BregmaLambdaBehavior : MonoBehaviour
56
{
6-
private float _blDistance = 4.15f;
7+
private float _blDistance = -1f;
78
public float DefaultBLDistance { get { return _blDistance; } }
89

910
[SerializeField] Slider _blSlider;
11+
[SerializeField] TMP_Text _sliderText;
12+
13+
private void Awake()
14+
{
15+
_blSlider.onValueChanged.AddListener(SetSetting);
16+
}
1017

1118
public void ResetBLDistance()
1219
{
@@ -21,10 +28,22 @@ public void ResetBLDistance()
2128
/// <param name="blDistance"></param>
2229
public void SetBLRange(float min, float max, float blDistance)
2330
{
31+
Debug.Log("Range set");
2432
_blDistance = blDistance;
2533

2634
_blSlider.minValue = min;
2735
_blSlider.maxValue = max;
28-
_blSlider.value = blDistance;
36+
_blSlider.SetValueWithoutNotify(blDistance);
37+
}
38+
39+
public void SetText(float value)
40+
{
41+
Debug.Log("Text set");
42+
_sliderText.text = $"{Mathf.RoundToInt(value * 100f) / 100f}";
43+
}
44+
45+
private void SetSetting(float value)
46+
{
47+
Settings.BregmaLambdaDistance = value;
2948
}
3049
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
using System.Collections;
2+
using System.Collections.Generic;
3+
using UnityEngine;
4+
using UnityEngine.UI;
5+
6+
public class ProbePanelHeightSlider : MonoBehaviour
7+
{
8+
[SerializeField] private Slider _slider;
9+
10+
private void Awake()
11+
{
12+
_slider.onValueChanged.AddListener(SetSetting);
13+
}
14+
15+
private void SetSetting(float value)
16+
{
17+
Settings.ProbePanelHeight = value;
18+
}
19+
}

Assets/Scripts/Pinpoint/UI/ProbePanelHeightSlider.cs.meta

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Assets/Scripts/Pinpoint/Utilities/Settings.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,6 @@ public static bool ShowAllProbePanels
262262

263263

264264
private const float PROBE_PANEL_HEIGHT_DEFAULT = 1440f;
265-
[SerializeField] private Slider _probePanelHeightSlider;
266265
public UnityEvent<float> ProbePanelHeightChangedEvent;
267266

268267
public static float ProbePanelHeight
@@ -342,7 +341,6 @@ public static string AtlasTransformName
342341
}
343342

344343
private const float BREGMALAMBDA_DEFAULT = -1f;
345-
[SerializeField] private Slider _blSlider;
346344
public UnityEvent<float> BregmaLambdaChangedEvent;
347345

348346
public static float BregmaLambdaDistance
@@ -694,7 +692,7 @@ private void Apply()
694692
_ghostInactiveAreasToggle.SetIsOnWithoutNotify(GhostInactiveAreas);
695693

696694
// Probes
697-
_probePanelHeightSlider.SetValueWithoutNotify(ProbePanelHeight);
695+
ProbePanelHeight = data.ProbePanelHeight;
698696
ProbeSpeedChangedEvent.Invoke(data.ProbeSpeed);
699697

700698
// Default to Bregma
@@ -715,7 +713,7 @@ private void Apply()
715713

716714
// the relative coordinate needs to be set, since it gets propagated downstream
717715
ReferenceCoord = data.RelativeCoord;
718-
_blSlider.SetValueWithoutNotify(BregmaLambdaDistance);
716+
BregmaLambdaDistance = data.BregmaLambdaDistance;
719717

720718
// Accounts
721719
_stayLoggedInToggle.SetIsOnWithoutNotify(StayLoggedIn);

0 commit comments

Comments
 (0)