mirror of
https://github.com/Siccity/xNode.git
synced 2026-03-26 22:49:02 +08:00
Renamed ReorderableListCache to C# convention. Added line break to limit line width.
This commit is contained in:
parent
979bd5f7cf
commit
417e63ee6c
@ -11,7 +11,9 @@ namespace XNodeEditor {
|
|||||||
/// <summary> xNode-specific version of <see cref="EditorGUILayout"/> </summary>
|
/// <summary> xNode-specific version of <see cref="EditorGUILayout"/> </summary>
|
||||||
public static class NodeEditorGUILayout {
|
public static class NodeEditorGUILayout {
|
||||||
|
|
||||||
private static readonly Dictionary<UnityEngine.Object, Dictionary<string, ReorderableList>> reorderableListCache = new Dictionary<UnityEngine.Object, Dictionary<string, ReorderableList>>();
|
private static readonly Dictionary<UnityEngine.Object, Dictionary<string, ReorderableList>> ReorderableListCache =
|
||||||
|
new Dictionary<UnityEngine.Object, Dictionary<string, ReorderableList>>();
|
||||||
|
|
||||||
private static int reorderableListIndex = -1;
|
private static int reorderableListIndex = -1;
|
||||||
|
|
||||||
/// <summary> Make a field for a serialized property. Automatically displays relevant node port. </summary>
|
/// <summary> Make a field for a serialized property. Automatically displays relevant node port. </summary>
|
||||||
@ -264,7 +266,7 @@ namespace XNodeEditor {
|
|||||||
string[] parts = port.fieldName.Split(' ');
|
string[] parts = port.fieldName.Split(' ');
|
||||||
if (parts.Length != 2) return false;
|
if (parts.Length != 2) return false;
|
||||||
Dictionary<string, ReorderableList> cache;
|
Dictionary<string, ReorderableList> cache;
|
||||||
if (reorderableListCache.TryGetValue(port.node, out cache)) {
|
if (ReorderableListCache.TryGetValue(port.node, out cache)) {
|
||||||
ReorderableList list;
|
ReorderableList list;
|
||||||
if (cache.TryGetValue(parts[0], out list)) return true;
|
if (cache.TryGetValue(parts[0], out list)) return true;
|
||||||
}
|
}
|
||||||
@ -294,15 +296,15 @@ namespace XNodeEditor {
|
|||||||
|
|
||||||
ReorderableList list = null;
|
ReorderableList list = null;
|
||||||
Dictionary<string, ReorderableList> rlc;
|
Dictionary<string, ReorderableList> rlc;
|
||||||
if (reorderableListCache.TryGetValue(serializedObject.targetObject, out rlc)) {
|
if (ReorderableListCache.TryGetValue(serializedObject.targetObject, out rlc)) {
|
||||||
if (!rlc.TryGetValue(fieldName, out list)) list = null;
|
if (!rlc.TryGetValue(fieldName, out list)) list = null;
|
||||||
}
|
}
|
||||||
// If a ReorderableList isn't cached for this array, do so.
|
// If a ReorderableList isn't cached for this array, do so.
|
||||||
if (list == null) {
|
if (list == null) {
|
||||||
SerializedProperty arrayData = serializedObject.FindProperty(fieldName);
|
SerializedProperty arrayData = serializedObject.FindProperty(fieldName);
|
||||||
list = CreateReorderableList(fieldName, dynamicPorts, arrayData, type, serializedObject, io, connectionType, typeConstraint, onCreation);
|
list = CreateReorderableList(fieldName, dynamicPorts, arrayData, type, serializedObject, io, connectionType, typeConstraint, onCreation);
|
||||||
if (reorderableListCache.TryGetValue(serializedObject.targetObject, out rlc)) rlc.Add(fieldName, list);
|
if (ReorderableListCache.TryGetValue(serializedObject.targetObject, out rlc)) rlc.Add(fieldName, list);
|
||||||
else reorderableListCache.Add(serializedObject.targetObject, new Dictionary<string, ReorderableList>() { { fieldName, list } });
|
else ReorderableListCache.Add(serializedObject.targetObject, new Dictionary<string, ReorderableList>() { { fieldName, list } });
|
||||||
}
|
}
|
||||||
list.list = dynamicPorts;
|
list.list = dynamicPorts;
|
||||||
list.DoLayoutList();
|
list.DoLayoutList();
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user