mirror of
https://github.com/Siccity/xNode.git
synced 2025-12-21 17:56:06 +08:00
Improved editor responsiveness
No longer saves asset on right click drag
This commit is contained in:
parent
8bb30e2f87
commit
455bb723d2
@ -27,7 +27,6 @@ namespace XNodeEditor {
|
|||||||
|
|
||||||
public void Controls() {
|
public void Controls() {
|
||||||
wantsMouseMove = true;
|
wantsMouseMove = true;
|
||||||
|
|
||||||
Event e = Event.current;
|
Event e = Event.current;
|
||||||
switch (e.type) {
|
switch (e.type) {
|
||||||
case EventType.MouseMove:
|
case EventType.MouseMove:
|
||||||
@ -57,28 +56,31 @@ namespace XNodeEditor {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case EventType.KeyDown:
|
case EventType.KeyDown:
|
||||||
if (e.keyCode == KeyCode.F) Home();
|
if (GUIUtility.keyboardControl == 0) break;
|
||||||
|
else if (e.keyCode == KeyCode.F) Home();
|
||||||
break;
|
break;
|
||||||
case EventType.MouseDown:
|
case EventType.MouseDown:
|
||||||
Repaint();
|
Repaint();
|
||||||
SelectNode(hoveredNode);
|
if (e.button == 0) {
|
||||||
if (IsHoveringPort) {
|
SelectNode(hoveredNode);
|
||||||
if (hoveredPort.IsOutput) {
|
if (IsHoveringPort) {
|
||||||
draggedOutput = hoveredPort;
|
if (hoveredPort.IsOutput) {
|
||||||
} else {
|
draggedOutput = hoveredPort;
|
||||||
hoveredPort.VerifyConnections();
|
} else {
|
||||||
if (hoveredPort.IsConnected) {
|
hoveredPort.VerifyConnections();
|
||||||
Node node = hoveredPort.node;
|
if (hoveredPort.IsConnected) {
|
||||||
NodePort output = hoveredPort.Connection;
|
Node node = hoveredPort.node;
|
||||||
hoveredPort.Disconnect(output);
|
NodePort output = hoveredPort.Connection;
|
||||||
draggedOutput = output;
|
hoveredPort.Disconnect(output);
|
||||||
draggedOutputTarget = hoveredPort;
|
draggedOutput = output;
|
||||||
if (NodeEditor.onUpdateNode != null) NodeEditor.onUpdateNode(node);
|
draggedOutputTarget = hoveredPort;
|
||||||
|
if (NodeEditor.onUpdateNode != null) NodeEditor.onUpdateNode(node);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
} else if (IsHoveringNode && IsHoveringTitle(hoveredNode)) {
|
||||||
|
draggedNode = hoveredNode;
|
||||||
|
dragOffset = hoveredNode.position - WindowToGridPosition(e.mousePosition);
|
||||||
}
|
}
|
||||||
} else if (IsHoveringNode && IsHoveringTitle(hoveredNode)) {
|
|
||||||
draggedNode = hoveredNode;
|
|
||||||
dragOffset = hoveredNode.position - WindowToGridPosition(e.mousePosition);
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case EventType.MouseUp:
|
case EventType.MouseUp:
|
||||||
@ -97,14 +99,17 @@ namespace XNodeEditor {
|
|||||||
draggedOutputTarget = null;
|
draggedOutputTarget = null;
|
||||||
EditorUtility.SetDirty(graph);
|
EditorUtility.SetDirty(graph);
|
||||||
Repaint();
|
Repaint();
|
||||||
|
AssetDatabase.SaveAssets();
|
||||||
} else if (IsDraggingNode) {
|
} else if (IsDraggingNode) {
|
||||||
draggedNode = null;
|
draggedNode = null;
|
||||||
|
AssetDatabase.SaveAssets();
|
||||||
|
} else if (GUIUtility.hotControl != 0) {
|
||||||
|
AssetDatabase.SaveAssets();
|
||||||
}
|
}
|
||||||
} else if (e.button == 1) {
|
} else if (e.button == 1) {
|
||||||
if (!isPanning) ShowContextMenu();
|
if (!isPanning) ShowContextMenu();
|
||||||
isPanning = false;
|
isPanning = false;
|
||||||
}
|
}
|
||||||
AssetDatabase.SaveAssets();
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user