From 3a8ceca30ba96fc685b9eedf2a45254a3c0fd579 Mon Sep 17 00:00:00 2001 From: Jose Luis Rey Mendez Date: Thu, 23 Aug 2018 11:37:09 -0300 Subject: [PATCH] Allow graphs to repain on update --- Scripts/Editor/NodeEditorWindow.cs | 7 +++++++ Scripts/NodeGraph.cs | 5 +++++ 2 files changed, 12 insertions(+) diff --git a/Scripts/Editor/NodeEditorWindow.cs b/Scripts/Editor/NodeEditorWindow.cs index 72fd4ce..eacfd26 100644 --- a/Scripts/Editor/NodeEditorWindow.cs +++ b/Scripts/Editor/NodeEditorWindow.cs @@ -56,6 +56,13 @@ namespace XNodeEditor { } } + public void Update() { + // Repaint the graph if it is required during update. + if (graph.RepaintOnUpdate) { + Repaint(); + } + } + public Dictionary nodeSizes { get { return _nodeSizes; } } private Dictionary _nodeSizes = new Dictionary(); public XNode.NodeGraph graph; diff --git a/Scripts/NodeGraph.cs b/Scripts/NodeGraph.cs index d6d766c..e94796a 100644 --- a/Scripts/NodeGraph.cs +++ b/Scripts/NodeGraph.cs @@ -78,5 +78,10 @@ namespace XNode { // Remove all nodes prior to graph destruction Clear(); } + + /// Whether the graph requires a repaint during updates. + public virtual bool RepaintOnUpdate { + get { return false; } + } } } \ No newline at end of file