Example #1
0
        public override void Undo()
        {
            if (CanUndo)
            {
                BTEditorGraphNode createdNode = m_graph.GetNodeByHash(m_createdNodeHash);

                m_parentNodeHash = m_graph.GetNodeHash(createdNode.Parent);
                m_serializedNode = BTUtils.SerializeNode(createdNode.Node);

                createdNode.OnDelete();
                m_createdNodeHash = null;
            }
        }
Example #2
0
 public UndoNodeMoved(BTEditorGraphNode node)
 {
     m_graph         = node.Graph;
     m_nodeHash      = m_graph.GetNodeHash(node);
     m_startPosition = node.Node.Position;
     m_endPosition   = Vector2.zero;
 }
Example #3
0
 public UndoNodeCreated(BTEditorGraphNode node)
 {
     m_graph           = node.Graph;
     m_createdNodeHash = m_graph.GetNodeHash(node);
     m_parentNodeHash  = null;
     m_serializedNode  = null;
     Title             = "Created " + node.Node.Title;
 }
Example #4
0
        public UndoNodeDeleted(BTEditorGraphNode node, int childIndex)
        {
            m_graph          = node.Graph;
            m_parentNodeHash = m_graph.GetNodeHash(node.Parent);
            m_serializedNode = BTUtils.SerializeNode(node.Node);
            m_childIndex     = childIndex;
            Title            = "Deleted " + node.Node.Title;

            m_createdNodeHash = null;
        }
Example #5
0
        public UndoNodeGroupPush(BTEditorGraphNode node)
        {
            if (!(node.Node is NodeGroup))
            {
                throw new System.ArgumentException("BT graph node is not of type NodeGroup", "node");
            }

            m_graph         = node.Graph;
            m_nodeGroupHash = m_graph.GetNodeHash(node);
            Title           = "Open " + node.Node.Title;
        }
Example #6
0
        public override void Undo()
        {
            if (CanUndo)
            {
                BehaviourNode node = BTUtils.DeserializeNode(m_serializedNode);
                if (m_childIndex >= 0)
                {
                    var parentNode  = m_graph.GetNodeByHash(m_parentNodeHash);
                    var createdNode = parentNode.OnInsertChild(m_childIndex, node);
                    m_createdNodeHash = m_graph.GetNodeHash(createdNode);
                }
                else
                {
                    var parentNode  = m_graph.GetNodeByHash(m_parentNodeHash);
                    var createdNode = parentNode.OnCreateChild(node);
                    m_createdNodeHash = m_graph.GetNodeHash(createdNode);
                }

                m_parentNodeHash = null;
                m_serializedNode = null;
            }
        }