Separation works again
This commit is contained in:
parent
f72a37b248
commit
c110a6e723
@ -263,39 +263,40 @@ public class ClusterInspector : Editor {
|
|||||||
|
|
||||||
// Draw selected Nucleus
|
// Draw selected Nucleus
|
||||||
if (expandArray) {
|
if (expandArray) {
|
||||||
if (this.currentNucleus is ReceptorArray receptor) {
|
// if (this.currentNucleus is ReceptorArray receptor) {
|
||||||
float maxValue = 0;
|
// float maxValue = 0;
|
||||||
foreach (Nucleus nucleus in receptor.instances) {
|
// foreach (Nucleus nucleus in receptor.instances) {
|
||||||
float value = length(nucleus.outputValue);
|
// float value = length(nucleus.outputValue);
|
||||||
if (value > maxValue)
|
// if (value > maxValue)
|
||||||
maxValue = value;
|
// maxValue = value;
|
||||||
}
|
// }
|
||||||
|
|
||||||
float spacing = 400f / receptor.instances.Count();
|
// float spacing = 400f / receptor.instances.Count();
|
||||||
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;
|
||||||
float yMin = 10 + margin - size / 2;
|
// float yMin = 10 + margin - size / 2;
|
||||||
float yMax = 400 - margin + size;
|
// float yMax = 400 - margin + size;
|
||||||
Vector3[] verts = new Vector3[4] {
|
// Vector3[] verts = new Vector3[4] {
|
||||||
new(xMin, yMin, 0),
|
// new(xMin, yMin, 0),
|
||||||
new(xMax, yMin, 0),
|
// new(xMax, yMin, 0),
|
||||||
new(xMax, yMax, 0),
|
// new(xMax, yMax, 0),
|
||||||
new(xMin, yMax, 0)
|
// new(xMin, yMax, 0)
|
||||||
};
|
// };
|
||||||
Handles.color = Color.black;
|
// Handles.color = Color.black;
|
||||||
Handles.DrawAAConvexPolygon(verts);
|
// Handles.DrawAAConvexPolygon(verts);
|
||||||
int row = 0;
|
// int row = 0;
|
||||||
foreach (Nucleus nucleus in receptor.instances) {
|
// foreach (Nucleus nucleus in receptor.instances) {
|
||||||
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 nucleus highlight ring
|
// // The selected nucleus highlight ring
|
||||||
Handles.DrawSolidDisc(pos, Vector3.forward, size + 2);
|
// Handles.DrawSolidDisc(pos, Vector3.forward, size + 2);
|
||||||
DrawNucleus(nucleus, pos, maxValue, size);
|
// DrawNucleus(nucleus, pos, maxValue, size);
|
||||||
row++;
|
// row++;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
else if (this.currentNucleus is Receptor receptor1) {
|
// else
|
||||||
|
if (this.currentNucleus is IReceptor receptor1) {
|
||||||
float maxValue = 0;
|
float maxValue = 0;
|
||||||
foreach (Nucleus nucleus in receptor1.array.nuclei) {
|
foreach (Nucleus nucleus in receptor1.array.nuclei) {
|
||||||
float value = length(nucleus.outputValue);
|
float value = length(nucleus.outputValue);
|
||||||
@ -332,13 +333,14 @@ public class ClusterInspector : Editor {
|
|||||||
fontStyle = FontStyle.Bold,
|
fontStyle = FontStyle.Bold,
|
||||||
};
|
};
|
||||||
Vector3 labelPos = new(150, yMax + size + 5, 0);
|
Vector3 labelPos = new(150, yMax + size + 5, 0);
|
||||||
int colonPos = receptor1.name.IndexOf(":");
|
string receptorName = receptor1.GetName();
|
||||||
|
int colonPos = receptorName.IndexOf(":");
|
||||||
if (colonPos > 0) {
|
if (colonPos > 0) {
|
||||||
string baseName = receptor1.name[..colonPos];
|
string baseName = receptorName[..colonPos];
|
||||||
Handles.Label(labelPos, baseName, style);
|
Handles.Label(labelPos, baseName, style);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
Handles.Label(labelPos, receptor1.name, style);
|
Handles.Label(labelPos, receptorName, style);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
Handles.color = Color.white;
|
Handles.color = Color.white;
|
||||||
@ -502,10 +504,17 @@ public class ClusterInspector : Editor {
|
|||||||
};
|
};
|
||||||
|
|
||||||
if (nucleus is Receptor receptor1) {
|
if (nucleus is Receptor receptor1) {
|
||||||
if (receptor1.array == null || receptor1.array.nuclei == null || receptor1.array.nuclei.Count() == 0)
|
// draw the array size label
|
||||||
receptor1.array = new NucleusArray(nucleus);
|
if (expandArray) { //} && receptor1.array.nuclei.First() == this.currentNucleus) {
|
||||||
|
style.alignment = TextAnchor.LowerCenter;
|
||||||
if ((!expandArray || receptor1.array.nuclei.First() != this.currentNucleus) && receptor1.array.nuclei.Count() > 1) {
|
Vector3 labelPos1 = position + Vector3.down * (size + 5); // below disc along up axis
|
||||||
|
int colonPos1 = nucleus.name.IndexOf(":");
|
||||||
|
if (colonPos1 > 0) {
|
||||||
|
string extName = nucleus.name[(colonPos1 + 2)..];
|
||||||
|
Handles.Label(labelPos1, extName, style);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
if (color.grayscale > 0.5f)
|
if (color.grayscale > 0.5f)
|
||||||
style.normal.textColor = Color.black;
|
style.normal.textColor = Color.black;
|
||||||
else
|
else
|
||||||
@ -523,13 +532,14 @@ public class ClusterInspector : Editor {
|
|||||||
// }
|
// }
|
||||||
|
|
||||||
if (nucleus is ClusterReceptor clusterReceptor) {
|
if (nucleus is ClusterReceptor clusterReceptor) {
|
||||||
|
// draw the array size label
|
||||||
if (expandArray && clusterReceptor.array.nuclei.First() == this.currentNucleus) {
|
if (expandArray && clusterReceptor.array.nuclei.First() == this.currentNucleus) {
|
||||||
style.alignment = TextAnchor.LowerCenter;
|
style.alignment = TextAnchor.LowerCenter;
|
||||||
Vector3 labelPos = position + Vector3.down * (size + 5); // below disc along up axis
|
Vector3 labelPos2 = position + Vector3.down * (size + 5); // below disc along up axis
|
||||||
int colonPos = nucleus.name.IndexOf(":");
|
int colonPos2 = nucleus.name.IndexOf(":");
|
||||||
if (colonPos > 0) {
|
if (colonPos2 > 0) {
|
||||||
string extName = nucleus.name[(colonPos + 2)..];
|
string extName = nucleus.name[(colonPos2 + 2)..];
|
||||||
Handles.Label(labelPos, extName, style);
|
Handles.Label(labelPos2, extName, style);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -542,26 +552,26 @@ public class ClusterInspector : Editor {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (expandArray && nucleus is Receptor receptor2 && receptor2.array.nuclei.First() == this.currentNucleus) {
|
// if (expandArray && nucleus is Receptor receptor2 && receptor2.array.nuclei.First() == this.currentNucleus) {
|
||||||
style.alignment = TextAnchor.LowerCenter;
|
// style.alignment = TextAnchor.LowerCenter;
|
||||||
Vector3 labelPos = position + Vector3.down * (size + 5); // below disc along up axis
|
// Vector3 labelPos = position + Vector3.down * (size + 5); // below disc along up axis
|
||||||
int colonPos = nucleus.name.IndexOf(":");
|
// int colonPos = nucleus.name.IndexOf(":");
|
||||||
if (colonPos > 0) {
|
// if (colonPos > 0) {
|
||||||
string extName = nucleus.name[(colonPos + 2)..];
|
// string extName = nucleus.name[(colonPos + 2)..];
|
||||||
Handles.Label(labelPos, extName, style);
|
// Handles.Label(labelPos, extName, style);
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
else {
|
// else {
|
||||||
style.alignment = TextAnchor.UpperCenter;
|
style.alignment = TextAnchor.UpperCenter;
|
||||||
Vector3 labelPos = position - Vector3.down * (size + 5); // below disc along up axis
|
Vector3 labelPos = position - Vector3.down * (size + 5); // below disc along up axis
|
||||||
int colonPos = nucleus.name.IndexOf(":");
|
int colonPos = nucleus.name.IndexOf(":");
|
||||||
if (colonPos > 0 && colonPos < nucleus.name.Length - 2) {
|
if (expandArray || (colonPos > 0 && colonPos < nucleus.name.Length - 2)) {
|
||||||
string baseName = nucleus.name[..colonPos];
|
// string baseName = nucleus.name[..colonPos];
|
||||||
Handles.Label(labelPos, baseName, style);
|
// Handles.Label(labelPos, baseName, style);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
Handles.Label(labelPos, nucleus.name, style);
|
Handles.Label(labelPos, nucleus.name, style);
|
||||||
}
|
// }
|
||||||
|
|
||||||
if (nucleus is Cluster) {
|
if (nucleus is Cluster) {
|
||||||
Handles.color = Color.white;
|
Handles.color = Color.white;
|
||||||
|
|||||||
@ -38,7 +38,7 @@ public class NucleusArray {
|
|||||||
newArray[i] = this._nuclei[i];
|
newArray[i] = this._nuclei[i];
|
||||||
if (this._nuclei[0] is Nucleus nucleus) {
|
if (this._nuclei[0] is Nucleus nucleus) {
|
||||||
newArray[newLength - 1] = nucleus.Clone(prefab);
|
newArray[newLength - 1] = nucleus.Clone(prefab);
|
||||||
newArray[newLength - 1].name += $"{newLength - 1}";
|
newArray[newLength - 1].name += $": {newLength - 1}";
|
||||||
}
|
}
|
||||||
|
|
||||||
this._nuclei = newArray;
|
this._nuclei = newArray;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user