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

Exposed virtual OnGUI() and 'position' for graph editors

This commit is contained in:
Thor Brigsted 2018-04-10 22:59:32 +02:00
parent ba8b9ef447
commit bab898e489
2 changed files with 7 additions and 0 deletions

View File

@ -14,6 +14,7 @@ namespace XNodeEditor {
Matrix4x4 m = GUI.matrix; Matrix4x4 m = GUI.matrix;
if (graph == null) return; if (graph == null) return;
graphEditor = NodeGraphEditor.GetEditor(graph); graphEditor = NodeGraphEditor.GetEditor(graph);
graphEditor.position = position;
Controls(); Controls();
@ -23,6 +24,7 @@ namespace XNodeEditor {
DrawNodes(); DrawNodes();
DrawSelectionBox(); DrawSelectionBox();
DrawTooltip(); DrawTooltip();
graphEditor.OnGUI();
GUI.matrix = m; GUI.matrix = m;
} }

View File

@ -8,8 +8,13 @@ namespace XNodeEditor {
/// <summary> Base class to derive custom Node Graph editors from. Use this to override how graphs are drawn in the editor. </summary> /// <summary> Base class to derive custom Node Graph editors from. Use this to override how graphs are drawn in the editor. </summary>
[CustomNodeGraphEditor(typeof(XNode.NodeGraph))] [CustomNodeGraphEditor(typeof(XNode.NodeGraph))]
public class NodeGraphEditor : XNodeEditor.Internal.NodeEditorBase<NodeGraphEditor, NodeGraphEditor.CustomNodeGraphEditorAttribute, XNode.NodeGraph> { public class NodeGraphEditor : XNodeEditor.Internal.NodeEditorBase<NodeGraphEditor, NodeGraphEditor.CustomNodeGraphEditorAttribute, XNode.NodeGraph> {
/// <summary> The position of the window in screen space. </summary>
public Rect position;
/// <summary> Are we currently renaming a node? </summary>
protected bool isRenaming; protected bool isRenaming;
public virtual void OnGUI() { }
public virtual Texture2D GetGridTexture() { public virtual Texture2D GetGridTexture() {
return NodeEditorPreferences.GetSettings().gridTexture; return NodeEditorPreferences.GetSettings().gridTexture;
} }