mirror of
https://github.com/Siccity/xNode.git
synced 2025-12-20 01:06:01 +08:00
Merge ab158dab7c9da0eea6dc9ec7f47454702ed2f895 into d6effd70f5574369e3415c423ef3e621ea309564
This commit is contained in:
commit
2a3cc8e7c0
@ -49,8 +49,14 @@ namespace XNodeEditor.Internal {
|
|||||||
editor.target = target;
|
editor.target = target;
|
||||||
editor.serializedObject = new SerializedObject(target);
|
editor.serializedObject = new SerializedObject(target);
|
||||||
editor.window = window;
|
editor.window = window;
|
||||||
|
|
||||||
|
// OnCreate is obsolete - use OnEnable instead
|
||||||
|
#pragma warning disable 0618
|
||||||
editor.OnCreate();
|
editor.OnCreate();
|
||||||
|
#pragma warning restore 0618
|
||||||
|
|
||||||
editors.Add(target, editor);
|
editors.Add(target, editor);
|
||||||
|
editor.OnEnable();
|
||||||
}
|
}
|
||||||
if (editor.target == null) editor.target = target;
|
if (editor.target == null) editor.target = target;
|
||||||
if (editor.window != window) editor.window = window;
|
if (editor.window != window) editor.window = window;
|
||||||
@ -91,9 +97,18 @@ namespace XNodeEditor.Internal {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary> Clears stored editors. Called when a new graph opens. Ensures that NodeEditor.OnEnable is called as expected. </summary>
|
||||||
|
public static void ClearCachedEditors() {
|
||||||
|
editors = new Dictionary<K, T>();
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary> Called on creation, after references have been set </summary>
|
/// <summary> Called on creation, after references have been set </summary>
|
||||||
|
[Obsolete("OnCreate() is deprecated, please use OnEnable() instead.")]
|
||||||
public virtual void OnCreate() { }
|
public virtual void OnCreate() { }
|
||||||
|
|
||||||
|
/// <summary> Called when a graph containing the node is opened </summary>
|
||||||
|
public virtual void OnEnable() { }
|
||||||
|
|
||||||
public interface INodeEditorAttrib {
|
public interface INodeEditorAttrib {
|
||||||
Type GetInspectedType();
|
Type GetInspectedType();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -55,6 +55,7 @@ namespace XNodeEditor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void OnEnable() {
|
private void OnEnable() {
|
||||||
|
NodeEditor.ClearCachedEditors();
|
||||||
// Reload portConnectionPoints if there are any
|
// Reload portConnectionPoints if there are any
|
||||||
int length = _references.Length;
|
int length = _references.Length;
|
||||||
if (length == _rects.Length) {
|
if (length == _rects.Length) {
|
||||||
@ -202,6 +203,7 @@ namespace XNodeEditor {
|
|||||||
NodeEditorWindow w = GetWindow(typeof(NodeEditorWindow), false, "xNode", true) as NodeEditorWindow;
|
NodeEditorWindow w = GetWindow(typeof(NodeEditorWindow), false, "xNode", true) as NodeEditorWindow;
|
||||||
w.wantsMouseMove = true;
|
w.wantsMouseMove = true;
|
||||||
w.graph = graph;
|
w.graph = graph;
|
||||||
|
NodeEditor.ClearCachedEditors();
|
||||||
return w;
|
return w;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user