mirror of
https://github.com/Siccity/xNode.git
synced 2026-03-26 22:49:02 +08:00
!R(Dynamic Port List) 顺序改变,这次重写应该再也不会出现未知的错误=-=
This commit is contained in:
parent
2bcfbc85a4
commit
eb7c9098e9
@ -1,4 +1,4 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
@ -397,28 +397,42 @@ namespace XNodeEditor {
|
|||||||
|
|
||||||
list.onReorderCallbackWithDetails = (reorderableList, index, newIndex) =>
|
list.onReorderCallbackWithDetails = (reorderableList, index, newIndex) =>
|
||||||
{
|
{
|
||||||
var port = serializedObject.FindProperty(Node.PortFieldName);
|
var portSer = serializedObject.FindProperty(Node.PortFieldName);
|
||||||
SerializedProperty keys = port.FindPropertyRelative(Node.KeysFieldName);
|
SerializedProperty keys = portSer.FindPropertyRelative(Node.KeysFieldName);
|
||||||
SerializedProperty values = port.FindPropertyRelative(Node.ValuesFieldName);
|
SerializedProperty values = portSer.FindPropertyRelative(Node.ValuesFieldName);
|
||||||
var count = 0;
|
|
||||||
|
var baseIndex = 0;
|
||||||
foreach (var nodePort in node.Ports)
|
|
||||||
|
if (io == NodePort.IO.Output)
|
||||||
{
|
{
|
||||||
if (!reorderableList.list.Contains(nodePort))
|
foreach (var nodePort in node.Ports)
|
||||||
{
|
{
|
||||||
count++;
|
if (nodePort.direction == NodePort.IO.Input)
|
||||||
|
{
|
||||||
|
baseIndex++;
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
//list after May exist dynamic node so break
|
break;
|
||||||
break;
|
}
|
||||||
|
|
||||||
|
baseIndex++;
|
||||||
}
|
}
|
||||||
|
|
||||||
index += count;
|
index += baseIndex;
|
||||||
newIndex += count;
|
newIndex += baseIndex;
|
||||||
keys.MoveArrayElement(index, newIndex);
|
keys.MoveArrayElement(index, newIndex);
|
||||||
values.MoveArrayElement(index, newIndex);
|
values.MoveArrayElement(index, newIndex);
|
||||||
|
serializedObject.ApplyModifiedProperties();
|
||||||
|
EditorUtility.SetDirty(node);
|
||||||
|
serializedObject.Update();
|
||||||
|
NodeEditorWindow.current.Repaint();
|
||||||
|
EditorApplication.delayCall += NodeEditorWindow.current.Repaint;
|
||||||
|
foreach (NodePort port in reorderableList.list)
|
||||||
|
{
|
||||||
|
port.RefreshValueType();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
list.onAddCallback =
|
list.onAddCallback =
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user