Skip to content

Commit df4d194

Browse files
committed
fix: fixing a bug that caused color to be reset each time a probe was disabled/enabled
1 parent 0f71d2c commit df4d194

File tree

3 files changed

+19
-4
lines changed

3 files changed

+19
-4
lines changed

Assets/Scripts/Accounts/ActiveExperimentUI.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,15 @@ public void SelectExperiment(int optIdx)
5757
#region Insertions
5858
public void UpdateExperimentInsertionUIPanels()
5959
{
60+
// If the accounts manager is disconnected, clear the view
61+
if (!_accountsManager.Connected)
62+
{
63+
ResetUIPanels();
64+
return;
65+
}
66+
6067
// don't bother updating if we are disabled
61-
if (!gameObject.activeSelf || !_accountsManager.Connected)
68+
if (!gameObject.activeSelf)
6269
return;
6370

6471
// If the experiment was changed, reset the whole panel

Assets/Scripts/TrajectoryPlanner/Probes/ProbeManager.cs

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using System;
1+
using System;
22
using System.Collections.Generic;
33
using System.Linq;
44
using EphysLink;
@@ -188,6 +188,10 @@ private void Awake()
188188

189189
_axisControl = GameObject.Find("AxisControl").GetComponent<AxisControl>();
190190

191+
// Set color
192+
if (_probeRenderer != null)
193+
_color = ProbeProperties.NextColor;
194+
191195
_probeController.FinishedMovingEvent.AddListener(UpdateName);
192196
_probeController.MovedThisFrameEvent.AddListener(ProbeMoved);
193197
}
@@ -199,8 +203,11 @@ private void Start()
199203
#endif
200204
UpdateSelectionLayer(SelectionLayerName);
201205

202-
if (_probeRenderer != null)
203-
Color = ProbeProperties.NextColor;
206+
// Force update color
207+
foreach (ProbeUIManager puiManager in _probeUIManagers)
208+
puiManager.UpdateColors();
209+
210+
UIUpdateEvent.Invoke();
204211
}
205212

206213
/// <summary>

Assets/Scripts/TrajectoryPlanner/TrajectoryPlannerManager.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1066,6 +1066,7 @@ private void AccountsNewProbeHelper((Vector3 apmldv, Vector3 angles, int type, s
10661066
ProbeManager newProbeManager = AddNewProbe((ProbeProperties.ProbeType)data.type, new ProbeInsertion(data.apmldv, data.angles, CoordinateSpaceManager.ActiveCoordinateSpace, CoordinateSpaceManager.ActiveCoordinateTransform), data.UUID);
10671067
if (data.overrideName != null)
10681068
newProbeManager.OverrideName(data.overrideName);
1069+
Debug.Log($"Overriding color: {data.color}");
10691070
newProbeManager.Color = data.color;
10701071
}
10711072

0 commit comments

Comments
 (0)