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.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using UnityEditor;
|
using UnityEditor;
|
||||||
@ -439,7 +439,8 @@ namespace XNodeEditor {
|
|||||||
// Culling
|
// Culling
|
||||||
if (e.type == EventType.Layout) {
|
if (e.type == EventType.Layout) {
|
||||||
// Cull unselected nodes outside view
|
// Cull unselected nodes outside view
|
||||||
if (!Selection.Contains(node) && ShouldBeCulled(node)) {
|
if (drewAllNodesOnLoad && !Selection.Contains(node) && ShouldBeCulled(node))
|
||||||
|
{
|
||||||
culledNodes.Add(node);
|
culledNodes.Add(node);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -551,6 +552,8 @@ namespace XNodeEditor {
|
|||||||
//This is done through reflection because OnValidate is only relevant in editor,
|
//This is done through reflection because OnValidate is only relevant in editor,
|
||||||
//and thus, the code should not be included in build.
|
//and thus, the code should not be included in build.
|
||||||
if (onValidate != null && EditorGUI.EndChangeCheck()) onValidate.Invoke(Selection.activeObject, null);
|
if (onValidate != null && EditorGUI.EndChangeCheck()) onValidate.Invoke(Selection.activeObject, null);
|
||||||
|
|
||||||
|
drewAllNodesOnLoad = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool ShouldBeCulled(XNode.Node node) {
|
private bool ShouldBeCulled(XNode.Node node) {
|
||||||
|
|||||||
@ -16,6 +16,8 @@ namespace XNodeEditor {
|
|||||||
[SerializeField] private NodePortReference[] _references = new NodePortReference[0];
|
[SerializeField] private NodePortReference[] _references = new NodePortReference[0];
|
||||||
[SerializeField] private Rect[] _rects = new Rect[0];
|
[SerializeField] private Rect[] _rects = new Rect[0];
|
||||||
|
|
||||||
|
private static bool drewAllNodesOnLoad = false;
|
||||||
|
|
||||||
private Func<bool> isDocked {
|
private Func<bool> isDocked {
|
||||||
get {
|
get {
|
||||||
if (_isDocked == null) _isDocked = this.GetIsDockedDelegate();
|
if (_isDocked == null) _isDocked = this.GetIsDockedDelegate();
|
||||||
@ -199,6 +201,8 @@ namespace XNodeEditor {
|
|||||||
public static NodeEditorWindow Open(XNode.NodeGraph graph) {
|
public static NodeEditorWindow Open(XNode.NodeGraph graph) {
|
||||||
if (!graph) return null;
|
if (!graph) return null;
|
||||||
|
|
||||||
|
drewAllNodesOnLoad = false;
|
||||||
|
|
||||||
NodeEditorWindow w = GetWindow(typeof(NodeEditorWindow), false, "xNode", true) as NodeEditorWindow;
|
NodeEditorWindow w = GetWindow(typeof(NodeEditorWindow), false, "xNode", true) as NodeEditorWindow;
|
||||||
w.wantsMouseMove = true;
|
w.wantsMouseMove = true;
|
||||||
w.graph = graph;
|
w.graph = graph;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user