gaze with clusterreceptor
This commit is contained in:
parent
cbc8296e55
commit
9c730709f1
@ -8,6 +8,15 @@ using static Unity.Mathematics.math;
|
||||
[Serializable]
|
||||
public class Cluster : Nucleus {
|
||||
|
||||
public string baseName {
|
||||
get {
|
||||
int colonPositon = this.name.IndexOf(':');
|
||||
if (colonPositon < 0)
|
||||
return this.name;
|
||||
return this.name[..colonPositon];
|
||||
}
|
||||
}
|
||||
|
||||
#region Init
|
||||
|
||||
public Cluster(ClusterPrefab prefab, Cluster parent) {
|
||||
|
||||
@ -488,7 +488,7 @@ public class ClusterInspector : Editor {
|
||||
}
|
||||
}
|
||||
|
||||
if (expandArray == false) {
|
||||
if (expandArray == false || nucleus is not IReceptor) {
|
||||
// put name below nucleus
|
||||
Vector3 labelPos = position - Vector3.down * (size + 5); // below neuron
|
||||
style.alignment = TextAnchor.UpperCenter;
|
||||
@ -624,34 +624,16 @@ public class ClusterInspector : Editor {
|
||||
EditorGUILayout.IntField("Array size", receptor1.nucleiArray.Count());
|
||||
if (GUILayout.Button("Add")) {
|
||||
Undo.RecordObject(prefabAsset, "Array add " + prefabAsset.name);
|
||||
//receptor1.array.AddNucleus(this.prefab);
|
||||
receptor1.AddReceptorElement(this.prefab);
|
||||
anythingChanged = true;
|
||||
}
|
||||
if (GUILayout.Button("Del")) {
|
||||
Undo.RecordObject(prefabAsset, "Array delete " + prefabAsset.name);
|
||||
//receptor1.array.RemoveNucleus();
|
||||
receptor1.RemoveReceptorElement();
|
||||
anythingChanged = true;
|
||||
}
|
||||
EditorGUILayout.EndHorizontal();
|
||||
}
|
||||
// else if (this.currentNucleus is ClusterReceptor receptor2) {
|
||||
// EditorGUILayout.BeginHorizontal();
|
||||
// EditorGUILayout.IntField("Array size", receptor2.array.nuclei.Count());
|
||||
// if (GUILayout.Button("Add")) {
|
||||
// Undo.RecordObject(prefabAsset, "Array add " + prefabAsset.name);
|
||||
// receptor2.array.AddNucleus(this.prefab);
|
||||
// anythingChanged = true;
|
||||
// }
|
||||
// if (GUILayout.Button("Del")) {
|
||||
// Undo.RecordObject(prefabAsset, "Array delete " + prefabAsset.name);
|
||||
// receptor2.array.RemoveNucleus();
|
||||
// anythingChanged = true;
|
||||
// }
|
||||
// EditorGUILayout.EndHorizontal();
|
||||
// }
|
||||
|
||||
|
||||
// Synapses
|
||||
|
||||
@ -666,7 +648,7 @@ public class ClusterInspector : Editor {
|
||||
|
||||
EditorGUIUtility.wideMode = true;
|
||||
EditorGUIUtility.labelWidth = 100;
|
||||
Vector3 newBias = EditorGUILayout.Vector3Field("Bias", this.currentNucleus.bias); //, GUILayout.Width(200));
|
||||
Vector3 newBias = EditorGUILayout.Vector3Field("Bias", this.currentNucleus.bias);
|
||||
anythingChanged |= newBias != this.currentNucleus.bias;
|
||||
this.currentNucleus.bias = newBias;
|
||||
|
||||
@ -705,8 +687,8 @@ public class ClusterInspector : Editor {
|
||||
GUIStyle labelStyle = new(GUI.skin.label);
|
||||
float labelWidth = 200;
|
||||
if (synapse.nucleus.clusterPrefab != null) {
|
||||
labelWidth = labelStyle.CalcSize(new GUIContent($"{synapse.nucleus.clusterPrefab.name}.")).x;
|
||||
GUILayout.Label($"{synapse.nucleus.clusterPrefab.name}", GUILayout.Width(labelWidth));
|
||||
labelWidth = labelStyle.CalcSize(new GUIContent($"{synapse.nucleus.parent.baseName}.")).x;
|
||||
GUILayout.Label($"{synapse.nucleus.parent.baseName}", GUILayout.Width(labelWidth));
|
||||
}
|
||||
string[] options = synapse.nucleus.parent.clusterNuclei.Select(n => n.name).ToArray();
|
||||
int selectedIndex = System.Array.IndexOf(options, synapse.nucleus.name);
|
||||
@ -753,32 +735,33 @@ public class ClusterInspector : Editor {
|
||||
|
||||
// Activation
|
||||
|
||||
EditorGUILayout.Space();
|
||||
showActivation = EditorGUILayout.BeginFoldoutHeaderGroup(showActivation, "Activation");
|
||||
if (showActivation) {
|
||||
if (this.currentNucleus is Neuron neuron) {
|
||||
if (this.currentNucleus is not MemoryCell) {
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
EditorGUILayout.LabelField("Activation Curve", GUILayout.Width(150));
|
||||
if (neuron.curveMax > 0)
|
||||
EditorGUILayout.CurveField(neuron.curve, Color.cyan, new Rect(0, 0, 1, neuron.curveMax));
|
||||
else
|
||||
EditorGUILayout.CurveField(neuron.curve, Color.cyan, new Rect(0, neuron.curveMax, 1, -neuron.curveMax));
|
||||
Neuron.CurvePresets newPreset = (Neuron.CurvePresets)EditorGUILayout.EnumPopup(neuron.curvePreset, GUILayout.Width(100));
|
||||
anythingChanged |= newPreset != neuron.curvePreset;
|
||||
neuron.curvePreset = newPreset;
|
||||
EditorGUILayout.EndHorizontal();
|
||||
}
|
||||
if (neuron is Receptor receptor2) {
|
||||
if (receptor2.nucleiArray == null || receptor2.nucleiArray.Count() == 0)
|
||||
receptor2.array = new NucleusArray(neuron);
|
||||
}
|
||||
}
|
||||
|
||||
if (this.currentNucleus is not Cluster) {
|
||||
EditorGUILayout.Space();
|
||||
}
|
||||
EditorGUILayout.EndFoldoutHeaderGroup();
|
||||
showActivation = EditorGUILayout.BeginFoldoutHeaderGroup(showActivation, "Activation");
|
||||
if (showActivation) {
|
||||
if (this.currentNucleus is Neuron neuron) {
|
||||
if (this.currentNucleus is not MemoryCell) {
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
EditorGUILayout.LabelField("Activation Curve", GUILayout.Width(150));
|
||||
if (neuron.curveMax > 0)
|
||||
EditorGUILayout.CurveField(neuron.curve, Color.cyan, new Rect(0, 0, 1, neuron.curveMax));
|
||||
else
|
||||
EditorGUILayout.CurveField(neuron.curve, Color.cyan, new Rect(0, neuron.curveMax, 1, -neuron.curveMax));
|
||||
Neuron.CurvePresets newPreset = (Neuron.CurvePresets)EditorGUILayout.EnumPopup(neuron.curvePreset, GUILayout.Width(100));
|
||||
anythingChanged |= newPreset != neuron.curvePreset;
|
||||
neuron.curvePreset = newPreset;
|
||||
EditorGUILayout.EndHorizontal();
|
||||
}
|
||||
if (neuron is Receptor receptor2) {
|
||||
if (receptor2.nucleiArray == null || receptor2.nucleiArray.Count() == 0)
|
||||
receptor2.array = new NucleusArray(neuron);
|
||||
}
|
||||
}
|
||||
|
||||
EditorGUILayout.Space();
|
||||
}
|
||||
EditorGUILayout.EndFoldoutHeaderGroup();
|
||||
}
|
||||
|
||||
if (GUILayout.Button("Delete this neuron"))
|
||||
DeleteNucleus(this.currentNucleus);
|
||||
|
||||
@ -13,18 +13,31 @@ MonoBehaviour:
|
||||
m_Name: Velocity
|
||||
m_EditorClassIdentifier: Assembly-CSharp::ClusterPrefab
|
||||
nuclei:
|
||||
- rid: 2243601425629446539
|
||||
- rid: 2262690551513219315
|
||||
- rid: 2262690551513219316
|
||||
- rid: 2262690551513219317
|
||||
references:
|
||||
version: 2
|
||||
RefIds:
|
||||
- rid: 2243601425629446539
|
||||
- rid: -2
|
||||
type: {class: , ns: , asm: }
|
||||
- rid: 2262690551513219315
|
||||
type: {class: Neuron, ns: , asm: Assembly-CSharp}
|
||||
data:
|
||||
_name: Output
|
||||
_synapses: []
|
||||
_receivers: []
|
||||
_array:
|
||||
rid: 2243601425629446540
|
||||
name: Velocity
|
||||
clusterPrefab: {fileID: 11400000}
|
||||
parent:
|
||||
rid: -2
|
||||
trace: 0
|
||||
bias: {x: 0, y: 0, z: 0}
|
||||
_synapses:
|
||||
- nucleus:
|
||||
rid: 2262690551513219316
|
||||
weight: 1
|
||||
- nucleus:
|
||||
rid: 2262690551513219317
|
||||
weight: 1
|
||||
combinator: 0
|
||||
_curvePreset: 0
|
||||
curve:
|
||||
serializedVersion: 2
|
||||
@ -51,10 +64,65 @@ MonoBehaviour:
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
curveMax: 1
|
||||
average: 0
|
||||
- rid: 2243601425629446540
|
||||
type: {class: NucleusArray, ns: , asm: Assembly-CSharp}
|
||||
_receivers: []
|
||||
- rid: 2262690551513219316
|
||||
type: {class: Neuron, ns: , asm: Assembly-CSharp}
|
||||
data:
|
||||
_nuclei:
|
||||
- rid: 2243601425629446539
|
||||
name: Output
|
||||
name: Position
|
||||
clusterPrefab: {fileID: 11400000}
|
||||
parent:
|
||||
rid: -2
|
||||
trace: 0
|
||||
bias: {x: 0, y: 0, z: 0}
|
||||
_synapses: []
|
||||
combinator: 0
|
||||
_curvePreset: 0
|
||||
curve:
|
||||
serializedVersion: 2
|
||||
m_Curve:
|
||||
- serializedVersion: 3
|
||||
time: 0
|
||||
value: 0
|
||||
inSlope: 0
|
||||
outSlope: 1
|
||||
tangentMode: 0
|
||||
weightedMode: 0
|
||||
inWeight: 0
|
||||
outWeight: 0
|
||||
- serializedVersion: 3
|
||||
time: 1000
|
||||
value: 1000
|
||||
inSlope: 1
|
||||
outSlope: 0
|
||||
tangentMode: 0
|
||||
weightedMode: 0
|
||||
inWeight: 0
|
||||
outWeight: 0
|
||||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
curveMax: 1
|
||||
_receivers:
|
||||
- rid: 2262690551513219315
|
||||
- rid: 2262690551513219317
|
||||
type: {class: MemoryCell, ns: , asm: Assembly-CSharp}
|
||||
data:
|
||||
name: New memory cell
|
||||
clusterPrefab: {fileID: 11400000}
|
||||
parent:
|
||||
rid: -2
|
||||
trace: 0
|
||||
bias: {x: 0, y: 0, z: 0}
|
||||
_synapses: []
|
||||
combinator: 0
|
||||
_curvePreset: 0
|
||||
curve:
|
||||
serializedVersion: 2
|
||||
m_Curve: []
|
||||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
curveMax: 1
|
||||
_receivers:
|
||||
- rid: 2262690551513219315
|
||||
staticMemory: 0
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user