public void DeleteNode(NodeEditorBase node) { Undo.SetCurrentGroupName("Delete node"); Undo.RecordObject(_graph, "Delete node"); CleanupNode(node); Undo.CollapseUndoOperations(Undo.GetCurrentGroup()); }
public void Update(Event e) { if (e.button != 1) { return; } if (e.type == EventType.MouseDown) { _connection = null; _clickedNode = null; _bodyClick = false; foreach (var node in _window.Nodes) { var connection = node.GetConnection(e.mousePosition); if (connection != null) { _connection = node.GetConnection(e.mousePosition); _clickedNode = node; continue; } if (node.IsHeaderPosition(e.mousePosition)) { _connection = null; _clickedNode = node; } else if (node.Data.rect.Contains(e.mousePosition)) { _bodyClick = true; } } } if (_connection != null) { GUI.FocusControl(null); ConnectionContextClick(e); } else if (_clickedNode == null && !_bodyClick) { GUI.FocusControl(null); EmptyContextClick(e); } else if (_clickedNode != null) { GUI.FocusControl(null); NodeContextClick(e); } if (e.type == EventType.MouseUp) { _clickedNode = null; } }
public override void OpenGraph() { NodeEditorBase.SubmitGraph(this); if (m_NodePositions != null) { m_NodeManager.NodeEditorPostions = m_NodePositions; } IsOpen = true; }
public void Update(Event e) { if (e.button != 0) { return; } if (e.type == EventType.MouseDown) { _connection = null; _clickedNode = null; foreach (var node in _window.Nodes) { var connection = node.GetConnection(e.mousePosition); if (connection != null) { _connection = connection; _clickedNode = node; continue; } if (node.IsHeaderPosition(e.mousePosition)) { _connection = null; _clickedNode = node; } } } HandleCtrlClick(e); if (_toggleSelectionMode) { _clickedNode = null; return; } if (_connection != null) { UpdateClickedConnection(e); } else if (_clickedNode == null) { DrawSelectionArea(e); } else if (_clickedNode != null) { UpdateClickedNode(e); } if (e.type == EventType.MouseUp) { _clickedNode = null; } }
public void DuplicateNode(NodeEditorBase node) { Undo.SetCurrentGroupName("Duplicate node"); Undo.RecordObject(_graph, "New node"); var copy = node.CreateDataCopy(); NewNode(copy, new Vector2(copy.rect.position.x + 50, copy.rect.position.y + 50)); Undo.CollapseUndoOperations(Undo.GetCurrentGroup()); }
private void CleanupNode(NodeEditorBase node) { Undo.RecordObject(node.Data, "Delete node"); node.CleanConnections(); _graph.DeleteNode(node.Data); _window.GraveyardAdd(node); Undo.DestroyObjectImmediate(node.Data); var childObjects = node.Data.enterActions .Concat <ScriptableObject>(node.Data.exitActions) .Concat(node.Data.conditions); foreach (var scriptableObject in childObjects) { Undo.DestroyObjectImmediate(scriptableObject); } node.DeleteCleanup(); }
public bool Contains(NodeEditorBase node) { return(Selected.Contains(node)); }
public void Remove(NodeEditorBase node) { Selected.Remove(node); node.Deselect(); }
public void Add(NodeEditorBase node) { Selected.Add(node); node.Select(); Selection.activeObject = node.Data; }
public void GraveyardAdd(NodeEditorBase node) { _graveyard.Add(node); }