Skip to content

Commit 32ad90b

Browse files
committed
Fixed undo registering when opening the graph
1 parent 5a34268 commit 32ad90b

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

Assets/com.alelievr.NodeGraphProcessor/Editor/BaseGraphWindow.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ void CloseWindowWhenSceneIsClosed(Scene closedScene)
142142

143143
public virtual void OnGraphDeleted()
144144
{
145-
if (graph != null)
145+
if (graph != null && graphView != null)
146146
rootView.Remove(graphView);
147147

148148
graphView = null;

Assets/com.alelievr.NodeGraphProcessor/Editor/Views/BaseNodeView.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -941,11 +941,13 @@ public override void SetPosition(Rect newPos)
941941
{
942942
if (initializing || !nodeTarget.isLocked)
943943
{
944-
initializing = false;
945944
base.SetPosition(newPos);
946945

947-
owner.RegisterCompleteObjectUndo("Moved graph node");
946+
if (!initializing)
947+
owner.RegisterCompleteObjectUndo("Moved graph node");
948+
948949
nodeTarget.position = newPos;
950+
initializing = false;
949951
}
950952
}
951953

0 commit comments

Comments
 (0)