mirror of
https://github.com/Siccity/xNode.git
synced 2026-03-26 22:49:02 +08:00
!WF(Node Editor) OnFocus Trigger OnInit
This commit is contained in:
parent
ae9429fa3e
commit
efbab70191
@ -24,7 +24,7 @@ namespace XNodeEditor {
|
||||
internal static bool inNodeEditor = false;
|
||||
#endif
|
||||
private List<string> _excludesField;
|
||||
public sealed override void OnCreate()
|
||||
public override void OnCreate()
|
||||
{
|
||||
_excludesField = new List<string> { "m_Script", "graph", "position", "ports" };
|
||||
|
||||
@ -34,12 +34,6 @@ namespace XNodeEditor {
|
||||
{
|
||||
_excludesField.AddRange(fields);
|
||||
}
|
||||
|
||||
Init();
|
||||
}
|
||||
|
||||
protected virtual void Init()
|
||||
{
|
||||
}
|
||||
|
||||
public virtual void OnHeaderGUI() {
|
||||
|
||||
@ -50,6 +50,7 @@ namespace XNodeEditor.Internal {
|
||||
editor.serializedObject = new SerializedObject(target);
|
||||
editor.window = window;
|
||||
editor.OnCreate();
|
||||
editor.OnInit();
|
||||
editors.Add(target, editor);
|
||||
}
|
||||
if (editor.target == null) editor.target = target;
|
||||
@ -84,6 +85,11 @@ namespace XNodeEditor.Internal {
|
||||
/// <summary> Called on creation, after references have been set </summary>
|
||||
public virtual void OnCreate() { }
|
||||
|
||||
/// <summary>
|
||||
/// node editor window OnFocus call
|
||||
/// </summary>
|
||||
public virtual void OnInit() { }
|
||||
|
||||
public interface INodeEditorAttrib {
|
||||
Type GetInspectedType();
|
||||
}
|
||||
|
||||
@ -106,6 +106,7 @@ namespace XNodeEditor {
|
||||
void OnFocus() {
|
||||
current = this;
|
||||
ValidateGraphEditor();
|
||||
graphEditor?.OnFocus();
|
||||
if (graphEditor != null && NodeEditorPreferences.GetSettings().autoSave) AssetDatabase.SaveAssets();
|
||||
}
|
||||
|
||||
|
||||
@ -264,6 +264,15 @@ namespace XNodeEditor {
|
||||
/// <summary> Called when opened by NodeEditorWindow </summary>
|
||||
public virtual void OnOpen() { }
|
||||
|
||||
public virtual void OnFocus()
|
||||
{
|
||||
foreach (var targetNode in target.nodes)
|
||||
{
|
||||
var editor = NodeEditor.GetEditor(targetNode, window);
|
||||
editor.OnInit();
|
||||
}
|
||||
}
|
||||
|
||||
public virtual Texture2D GetGridTexture() {
|
||||
return NodeEditorPreferences.GetSettings().gridTexture;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user