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

Draw all nodes once on load to fix missing noodles

This commit is contained in:
Megalon 2021-11-28 21:21:44 -08:00
parent 06c9010a71
commit 3ba566cf33
2 changed files with 9 additions and 2 deletions

View File

@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.Linq;
using UnityEditor;
@ -439,7 +439,8 @@ namespace XNodeEditor {
// Culling
if (e.type == EventType.Layout) {
// Cull unselected nodes outside view
if (!Selection.Contains(node) && ShouldBeCulled(node)) {
if (drewAllNodesOnLoad && !Selection.Contains(node) && ShouldBeCulled(node))
{
culledNodes.Add(node);
continue;
}
@ -551,6 +552,8 @@ namespace XNodeEditor {
//This is done through reflection because OnValidate is only relevant in editor,
//and thus, the code should not be included in build.
if (onValidate != null && EditorGUI.EndChangeCheck()) onValidate.Invoke(Selection.activeObject, null);
drewAllNodesOnLoad = true;
}
private bool ShouldBeCulled(XNode.Node node) {

View File

@ -16,6 +16,8 @@ namespace XNodeEditor {
[SerializeField] private NodePortReference[] _references = new NodePortReference[0];
[SerializeField] private Rect[] _rects = new Rect[0];
private static bool drewAllNodesOnLoad = false;
private Func<bool> isDocked {
get {
if (_isDocked == null) _isDocked = this.GetIsDockedDelegate();
@ -199,6 +201,8 @@ namespace XNodeEditor {
public static NodeEditorWindow Open(XNode.NodeGraph graph) {
if (!graph) return null;
drewAllNodesOnLoad = false;
NodeEditorWindow w = GetWindow(typeof(NodeEditorWindow), false, "xNode", true) as NodeEditorWindow;
w.wantsMouseMove = true;
w.graph = graph;