Improved (but not fixed) cross-cluster monitoring

This commit is contained in:
Pascal Serrarens 2026-04-23 11:50:59 +02:00
parent b12616bd0c
commit 4f8a6abbe9

View File

@ -245,7 +245,7 @@ namespace NanoBrain {
float maxValue = 1;
if (this.currentNucleus is Cluster cluster) {
float spacing = 400f / cluster.siblingClusters.Length;
float spacing = 400f / cluster.instanceCount;
float margin = 10 + spacing / 2;
float xMin = 150 - size;
float xMax = 150 + size;
@ -260,6 +260,15 @@ namespace NanoBrain {
Handles.color = Color.black;
Handles.DrawAAConvexPolygon(verts);
int row = 0;
if (cluster.siblingClusters == null) {
Vector3 pos = new(150, margin + row * spacing, 0.0f);
Handles.color = Color.white;
// The selected sibling highlight ring
Handles.DrawSolidDisc(pos, Vector3.forward, size + 2);
DrawNucleus(cluster, pos, maxValue, size);
row++;
}
else {
foreach (Cluster sibling in cluster.siblingClusters) {
Vector3 pos = new(150, margin + row * spacing, 0.0f);
Handles.color = Color.white;
@ -268,6 +277,7 @@ namespace NanoBrain {
DrawNucleus(sibling, pos, maxValue, size);
row++;
}
}
GUIStyle style = new(EditorStyles.label) {
alignment = TextAnchor.UpperCenter,
normal = { textColor = Color.white },
@ -316,9 +326,12 @@ namespace NanoBrain {
else
return;
// For top-level nodes, add link to previous editor or 'all-outputs'
// For top-level nodes, add link to previous editor and/or 'Outputs'
int nodeCount = receivers.Count();
if (nucleus == this.selectedOutput) {// && ClusterViewer.previousPrefab != null) {
if (nucleus == this.selectedOutput) {
// Add link to 'Outpus'
nodeCount++;
if (ClusterViewer.previousPrefab != null)
// Add link to previous editor
nodeCount++;
}
@ -353,10 +366,13 @@ namespace NanoBrain {
}
if (nucleus == this.selectedOutput) {
Vector3 pos = new(50, margin + row * spacing, 0);
if (ClusterViewer.previousPrefab != null) {
DrawEdge(parentPos, pos);
if (ClusterViewer.previousPrefab != null)
DrawClusterPrefab(ClusterViewer.previousPrefab, pos, size);
else
row++;
}
pos = new(50, margin + row * spacing, 0);
DrawEdge(parentPos, pos);
DrawAllOutputs(pos, size);
}
}
@ -658,7 +674,7 @@ namespace NanoBrain {
fontStyle = FontStyle.Bold,
alignment = TextAnchor.MiddleCenter,
};
Handles.Label(position, "All\noutputs", labelTextStyle);
Handles.Label(position, "Outputs", labelTextStyle);
Rect neuronRect = new(position.x - size, position.y - size, size * 2, size * 2);
Event e = Event.current;
@ -711,8 +727,15 @@ namespace NanoBrain {
protected void OnNeuronClick(Nucleus nucleus) {
if (nucleus == this.currentNucleus) {
if (Application.isPlaying) {
if (nucleus is Cluster)
if (nucleus is Cluster cluster) {
if (expandArray) {
this.currentNucleus = cluster.defaultOutput;
if (this.currentNucleus is Neuron neuron && neuron.receivers.Count == 0)
this.selectedOutput = this.currentNucleus; expandArray = false;
}
else
expandArray = !expandArray;
}
else
expandArray = false;
}