1
0
mirror of https://github.com/Siccity/xNode.git synced 2025-12-21 01:36:03 +08:00

Add virtual OnWindowFocus and OnWindowFocusLost in NodeGraphEditor(#253)

This commit is contained in:
Romain Théry 2020-04-23 15:08:43 +02:00 committed by GitHub
parent ff2c1e8158
commit c298b5ee53
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 1 deletions

View File

@ -77,7 +77,14 @@ namespace XNodeEditor {
void OnFocus() {
current = this;
ValidateGraphEditor();
if (graphEditor != null && NodeEditorPreferences.GetSettings().autoSave) AssetDatabase.SaveAssets();
if (graphEditor != null) {
graphEditor.OnWindowFocus();
if (NodeEditorPreferences.GetSettings().autoSave) AssetDatabase.SaveAssets();
}
}
void OnLostFocus() {
if (graphEditor != null) graphEditor.OnWindowFocusLost();
}
[InitializeOnLoadMethod]

View File

@ -18,6 +18,12 @@ namespace XNodeEditor {
/// <summary> Called when opened by NodeEditorWindow </summary>
public virtual void OnOpen() { }
/// <summary> Called when NodeEditorWindow gains focus </summary>
public virtual void OnWindowFocus() { }
/// <summary> Called when NodeEditorWindow loses focus </summary>
public virtual void OnWindowFocusLost() { }
public virtual Texture2D GetGridTexture() {
return NodeEditorPreferences.GetSettings().gridTexture;
}