mirror of
https://github.com/Siccity/xNode.git
synced 2025-12-20 09:16:01 +08:00
Draw all nodes once on load to fix missing noodles
This commit is contained in:
parent
06c9010a71
commit
3ba566cf33
@ -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) {
|
||||
|
||||
@ -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;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user