mirror of
https://github.com/Siccity/xNode.git
synced 2025-12-21 09:46:03 +08:00
Revert "Minor performance improvement (cachine serialized objects)"
This reverts commit dba4cd18429d0d2800d7391708f96da037ba8ce9.
This commit is contained in:
parent
1ff815c627
commit
b787b57eb3
@ -10,7 +10,6 @@ namespace XNodeEditor.Internal {
|
|||||||
public class NodeEditorBase<T, A, K> where A : Attribute, NodeEditorBase<T, A, K>.INodeEditorAttrib where T : NodeEditorBase<T,A,K> where K : ScriptableObject {
|
public class NodeEditorBase<T, A, K> where A : Attribute, NodeEditorBase<T, A, K>.INodeEditorAttrib where T : NodeEditorBase<T,A,K> where K : ScriptableObject {
|
||||||
/// <summary> Custom editors defined with [CustomNodeEditor] </summary>
|
/// <summary> Custom editors defined with [CustomNodeEditor] </summary>
|
||||||
private static Dictionary<Type, T> editors;
|
private static Dictionary<Type, T> editors;
|
||||||
private static Dictionary<ScriptableObject, SerializedObject> serializeds;
|
|
||||||
public K target;
|
public K target;
|
||||||
public SerializedObject serializedObject;
|
public SerializedObject serializedObject;
|
||||||
|
|
||||||
@ -19,17 +18,10 @@ namespace XNodeEditor.Internal {
|
|||||||
Type type = target.GetType();
|
Type type = target.GetType();
|
||||||
T editor = GetEditor(type);
|
T editor = GetEditor(type);
|
||||||
editor.target = target;
|
editor.target = target;
|
||||||
editor.serializedObject = GetSerialized(target);
|
editor.serializedObject = new SerializedObject(target);
|
||||||
return editor;
|
return editor;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static SerializedObject GetSerialized(K target) {
|
|
||||||
if (target == null) return null;
|
|
||||||
if (serializeds == null) serializeds = new Dictionary<ScriptableObject, SerializedObject>();
|
|
||||||
if (!serializeds.ContainsKey(target)) serializeds.Add(target, new SerializedObject(target));
|
|
||||||
return serializeds[target];
|
|
||||||
}
|
|
||||||
|
|
||||||
private static T GetEditor(Type type) {
|
private static T GetEditor(Type type) {
|
||||||
if (type == null) return null;
|
if (type == null) return null;
|
||||||
if (editors == null) CacheCustomEditors();
|
if (editors == null) CacheCustomEditors();
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user