Example #1
0
 public void OnNodeCreateChild(BTEditorGraphNode parent, Type childType)
 {
     if (parent != null && childType != null)
     {
         BTEditorGraphNode child = parent.OnCreateChild(childType);
         if (child != null)
         {
             BTUndoSystem.RegisterUndo(new UndoNodeCreated(child));
         }
     }
 }
Example #2
0
        public override void Redo()
        {
            if (CanRedo)
            {
                BTEditorGraphNode parentNode  = m_graph.GetNodeByHash(m_parentNodeHash);
                BehaviourNode     node        = BTUtils.DeserializeNode(m_serializedNode);
                BTEditorGraphNode createdNode = parentNode.OnCreateChild(node);

                m_createdNodeHash = m_graph.GetNodeHash(createdNode);
                m_parentNodeHash  = null;
                m_serializedNode  = null;
            }
        }
Example #3
0
        public void OnPasteNode(BTEditorGraphNode destination)
        {
            if (CanPaste(destination))
            {
                BehaviourNode     node  = BTUtils.DeserializeNode(BTEditorCanvas.Current.Clipboard);
                BTEditorGraphNode child = destination.OnCreateChild(node);
                if (child != null)
                {
                    SelectBranch(child);

                    var undoState = new UndoNodeCreated(child);
                    undoState.Title = "Pasted " + child.Node.Title;

                    BTUndoSystem.RegisterUndo(undoState);
                }
            }
        }