1
0
mirror of https://github.com/Siccity/xNode.git synced 2026-03-26 22:49:02 +08:00

Uncommitted stuff

This commit is contained in:
Thor Brigsted 2019-04-01 18:40:19 +02:00
parent 72a80deb27
commit 77b4c034bf

View File

@ -385,20 +385,26 @@ namespace XNodeEditor {
list.onRemoveCallback = list.onRemoveCallback =
(ReorderableList rl) => { (ReorderableList rl) => {
int index = rl.index; int index = rl.index;
// Clear the removed ports connections
instancePorts[index].ClearConnections(); if (instancePorts.Count > index) {
// Move following connections one step up to replace the missing connection // Clear the removed ports connections
for (int k = index + 1; k < instancePorts.Count(); k++) { instancePorts[index].ClearConnections();
for (int j = 0; j < instancePorts[k].ConnectionCount; j++) { // Move following connections one step up to replace the missing connection
XNode.NodePort other = instancePorts[k].GetConnection(j); for (int k = index + 1; k < instancePorts.Count(); k++) {
instancePorts[k].Disconnect(other); for (int j = 0; j < instancePorts[k].ConnectionCount; j++) {
instancePorts[k - 1].Connect(other); XNode.NodePort other = instancePorts[k].GetConnection(j);
instancePorts[k].Disconnect(other);
instancePorts[k - 1].Connect(other);
}
} }
// Remove the last instance port, to avoid messing up the indexing
node.RemoveInstancePort(instancePorts[instancePorts.Count() - 1].fieldName);
serializedObject.Update();
EditorUtility.SetDirty(node);
} else {
Debug.LogWarning("InstancePorts[" + index + "] out of range. Length was " + instancePorts.Count + ". Skipping.");
} }
// Remove the last instance port, to avoid messing up the indexing
node.RemoveInstancePort(instancePorts[instancePorts.Count() - 1].fieldName);
serializedObject.Update();
EditorUtility.SetDirty(node);
if (hasArrayData) { if (hasArrayData) {
arrayData.DeleteArrayElementAtIndex(index); arrayData.DeleteArrayElementAtIndex(index);
arraySize--; arraySize--;