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; float maxValue = 1;
if (this.currentNucleus is Cluster cluster) { if (this.currentNucleus is Cluster cluster) {
float spacing = 400f / cluster.siblingClusters.Length; float spacing = 400f / cluster.instanceCount;
float margin = 10 + spacing / 2; float margin = 10 + spacing / 2;
float xMin = 150 - size; float xMin = 150 - size;
float xMax = 150 + size; float xMax = 150 + size;
@ -260,14 +260,24 @@ namespace NanoBrain {
Handles.color = Color.black; Handles.color = Color.black;
Handles.DrawAAConvexPolygon(verts); Handles.DrawAAConvexPolygon(verts);
int row = 0; int row = 0;
foreach (Cluster sibling in cluster.siblingClusters) { if (cluster.siblingClusters == null) {
Vector3 pos = new(150, margin + row * spacing, 0.0f); Vector3 pos = new(150, margin + row * spacing, 0.0f);
Handles.color = Color.white; Handles.color = Color.white;
// The selected sibling highlight ring // The selected sibling highlight ring
Handles.DrawSolidDisc(pos, Vector3.forward, size + 2); Handles.DrawSolidDisc(pos, Vector3.forward, size + 2);
DrawNucleus(sibling, pos, maxValue, size); DrawNucleus(cluster, pos, maxValue, size);
row++; row++;
} }
else {
foreach (Cluster sibling in cluster.siblingClusters) {
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(sibling, pos, maxValue, size);
row++;
}
}
GUIStyle style = new(EditorStyles.label) { GUIStyle style = new(EditorStyles.label) {
alignment = TextAnchor.UpperCenter, alignment = TextAnchor.UpperCenter,
normal = { textColor = Color.white }, normal = { textColor = Color.white },
@ -316,11 +326,14 @@ namespace NanoBrain {
else else
return; 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(); int nodeCount = receivers.Count();
if (nucleus == this.selectedOutput) {// && ClusterViewer.previousPrefab != null) { if (nucleus == this.selectedOutput) {
// Add link to previous editor // Add link to 'Outpus'
nodeCount++; nodeCount++;
if (ClusterViewer.previousPrefab != null)
// Add link to previous editor
nodeCount++;
} }
// Determine the maximum value in this layer // Determine the maximum value in this layer
@ -353,11 +366,14 @@ namespace NanoBrain {
} }
if (nucleus == this.selectedOutput) { if (nucleus == this.selectedOutput) {
Vector3 pos = new(50, margin + row * spacing, 0); Vector3 pos = new(50, margin + row * spacing, 0);
DrawEdge(parentPos, pos); if (ClusterViewer.previousPrefab != null) {
if (ClusterViewer.previousPrefab != null) DrawEdge(parentPos, pos);
DrawClusterPrefab(ClusterViewer.previousPrefab, pos, size); DrawClusterPrefab(ClusterViewer.previousPrefab, pos, size);
else row++;
DrawAllOutputs(pos, size); }
pos = new(50, margin + row * spacing, 0);
DrawEdge(parentPos, pos);
DrawAllOutputs(pos, size);
} }
} }
@ -658,7 +674,7 @@ namespace NanoBrain {
fontStyle = FontStyle.Bold, fontStyle = FontStyle.Bold,
alignment = TextAnchor.MiddleCenter, 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); Rect neuronRect = new(position.x - size, position.y - size, size * 2, size * 2);
Event e = Event.current; Event e = Event.current;
@ -711,8 +727,15 @@ namespace NanoBrain {
protected void OnNeuronClick(Nucleus nucleus) { protected void OnNeuronClick(Nucleus nucleus) {
if (nucleus == this.currentNucleus) { if (nucleus == this.currentNucleus) {
if (Application.isPlaying) { if (Application.isPlaying) {
if (nucleus is Cluster) if (nucleus is Cluster cluster) {
expandArray = !expandArray; 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 else
expandArray = false; expandArray = false;
} }