mirror of
https://github.com/Siccity/xNode.git
synced 2025-12-21 09:46:03 +08:00
Merge pull request #62 from phoenixanimations/patch-4
Fixes the undo bug, and hopefully the inconsistent values in inspector/node
This commit is contained in:
commit
372c968c85
@ -1,4 +1,4 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using UnityEditor;
|
using UnityEditor;
|
||||||
@ -43,6 +43,10 @@ namespace XNodeEditor {
|
|||||||
|
|
||||||
/// <summary> Draws standard field editors for all public fields </summary>
|
/// <summary> Draws standard field editors for all public fields </summary>
|
||||||
public virtual void OnBodyGUI() {
|
public virtual void OnBodyGUI() {
|
||||||
|
// Unity specifically requires this to save/update any serial object.
|
||||||
|
// serializedObject.Update(); must go at the start of an inspector gui, and
|
||||||
|
// serializedObject.ApplyModifiedProperties(); goes at the end.
|
||||||
|
serializedObject.Update();
|
||||||
string[] excludes = { "m_Script", "graph", "position", "ports" };
|
string[] excludes = { "m_Script", "graph", "position", "ports" };
|
||||||
portPositions = new Dictionary<XNode.NodePort, Vector2>();
|
portPositions = new Dictionary<XNode.NodePort, Vector2>();
|
||||||
|
|
||||||
@ -54,6 +58,7 @@ namespace XNodeEditor {
|
|||||||
if (excludes.Contains(iterator.name)) continue;
|
if (excludes.Contains(iterator.name)) continue;
|
||||||
NodeEditorGUILayout.PropertyField(iterator, true);
|
NodeEditorGUILayout.PropertyField(iterator, true);
|
||||||
}
|
}
|
||||||
|
serializedObject.ApplyModifiedProperties();
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual int GetWidth() {
|
public virtual int GetWidth() {
|
||||||
@ -93,4 +98,5 @@ namespace XNodeEditor {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user