mirror of
https://github.com/Siccity/xNode.git
synced 2025-12-21 01:36:03 +08:00
Fixed bug in NodeEditorGUILayout.InstancePortList
This commit is contained in:
parent
ac9db2a0b0
commit
cd0a4ca64b
@ -195,6 +195,15 @@ namespace XNodeEditor {
|
|||||||
if (hasArrayData) {
|
if (hasArrayData) {
|
||||||
arrayData.DeleteArrayElementAtIndex(i);
|
arrayData.DeleteArrayElementAtIndex(i);
|
||||||
arraySize--;
|
arraySize--;
|
||||||
|
// Error handling. If the following happens too often, file a bug report at https://github.com/Siccity/xNode/issues
|
||||||
|
if (instancePorts.Count <= arraySize) {
|
||||||
|
while (instancePorts.Count <= arraySize) {
|
||||||
|
arrayData.DeleteArrayElementAtIndex(--arraySize);
|
||||||
|
}
|
||||||
|
Debug.LogWarning("Array size exceeded instance ports size. Excess items removed.");
|
||||||
|
}
|
||||||
|
serializedObject.ApplyModifiedProperties();
|
||||||
|
serializedObject.Update();
|
||||||
}
|
}
|
||||||
i--;
|
i--;
|
||||||
} else {
|
} else {
|
||||||
@ -220,10 +229,11 @@ namespace XNodeEditor {
|
|||||||
int i = 0;
|
int i = 0;
|
||||||
while (node.HasPort(newName)) newName = fieldName + " " + (++i);
|
while (node.HasPort(newName)) newName = fieldName + " " + (++i);
|
||||||
|
|
||||||
instancePorts.Add(node.AddInstanceOutput(type, connectionType, newName));
|
node.AddInstanceOutput(type, connectionType, newName);
|
||||||
serializedObject.Update();
|
serializedObject.Update();
|
||||||
EditorUtility.SetDirty(node);
|
EditorUtility.SetDirty(node);
|
||||||
if (hasArrayData) arrayData.InsertArrayElementAtIndex(arraySize);
|
if (hasArrayData) arrayData.InsertArrayElementAtIndex(arraySize);
|
||||||
|
serializedObject.ApplyModifiedProperties();
|
||||||
}
|
}
|
||||||
GUILayout.EndHorizontal();
|
GUILayout.EndHorizontal();
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user