Compatibility with latest nanobrain

This commit is contained in:
Pascal Serrarens 2026-05-19 17:17:13 +02:00
parent 1918faf280
commit 76023718cb
10 changed files with 78 additions and 12 deletions

View File

@ -19,7 +19,7 @@ namespace NanoBrain.Unity {
public override float GetPropertyHeight(SerializedProperty property, GUIContent label) {
float height = EditorGUIUtility.singleLineHeight + padding;
string key = property.propertyPath + "_" + property.serializedObject.targetObject.GetEntityId();
string key = property.propertyPath + "_" + property.serializedObject.targetObject.GetInstanceID();//GetEntityId();
s_foldouts.TryGetValue(key, out bool isOpen);
if (property.objectReferenceValue != null && isOpen) {
height += padding + elementHeight;
@ -45,7 +45,7 @@ namespace NanoBrain.Unity {
if (property.objectReferenceValue is ClusterPrefab prefab) {
// key per field instance
string key = property.propertyPath + "_" + property.serializedObject.targetObject.GetEntityId();
string key = property.propertyPath + "_" + property.serializedObject.targetObject.GetInstanceID();//GetEntityId();
if (!s_foldouts.TryGetValue(key, out bool isOpen))
isOpen = true;

View File

@ -1,2 +1,11 @@
fileFormatVersion: 2
guid: 5f43b401b7d59dec7ac7d493cbc4927d
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -19,13 +19,13 @@ namespace NanoBrain.Unity {
static readonly Dictionary<string, ClusterView> clusterViews = new();
public static ClusterView GetClusterView(SerializedProperty property) {
string key = property.propertyPath + "_" + property.serializedObject.targetObject.GetEntityId();
string key = property.propertyPath + "_" + property.serializedObject.targetObject.GetInstanceID();//GetEntityId();
if (!clusterViews.TryGetValue(key, out ClusterView clusterView))
clusterView = new() { key = key };
return clusterView;
}
public static ClusterView GetClusterView(SerializedObject serializedObject) {
string key = serializedObject.targetObject.GetEntityId().ToString();
string key = serializedObject.targetObject.GetInstanceID().ToString(); //GetEntityId().ToString();
if (!clusterViews.TryGetValue(key, out ClusterView clusterView))
clusterView = new() { key = key };
return clusterView;
@ -267,6 +267,9 @@ namespace NanoBrain.Unity {
private void DescendGraph(Dag.Node receiver, ref int ix, Dag dag) {
Neuron receiverNeuron = receiver.nucleus as Neuron;
if (receiverNeuron == null)
return;
foreach (Synapse synapse in receiverNeuron.synapses) {
Nucleus nucleus = synapse.neuron;
if (nucleus.parent != null && nucleus.parent != currentNucleus.parent) {

View File

@ -1,2 +1,11 @@
fileFormatVersion: 2
guid: 8a7663ccd347fd78dbdba393c03ed7c7
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,2 +1,11 @@
fileFormatVersion: 2
guid: a755ac8461bd0c714a852df47331048e
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -15,7 +15,7 @@ namespace NanoBrain.Braitenberg {
protected override float SampleSensor() {
float sum = 0f;
// Get all active lights in scene (Point lights only)
Light[] lights = FindObjectsByType<Light>();
Light[] lights = FindObjectsByType<Light>(FindObjectsSortMode.None);
Vector3 pos = transform.position;
Vector3 forward = transform.forward;

View File

@ -1,2 +1,11 @@
fileFormatVersion: 2
guid: fbdba2c00e2271d7eae755fa49a7958c
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,2 +1,11 @@
fileFormatVersion: 2
guid: 07c6bf9674b9f9f0bbbf4a37f570ef4d
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,2 +1,11 @@
fileFormatVersion: 2
guid: b3d0457beca5df1bba076ac65df90b59
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,2 +1,11 @@
fileFormatVersion: 2
guid: a8d53357b6673864d91bbc5c595d48b9
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: