Example #1
0
        public void FlushAndPushGraphState(VFXGraph graph)
        {
            int lastCursorInStack = m_undoStack.Last().Key;

            while (lastCursorInStack > m_lastGraphUndoCursor)
            {
                //An action has been performed which overwrite
                m_undoStack.Remove(lastCursorInStack);
                lastCursorInStack = m_undoStack.Last().Key;
            }
            m_undoStack.Add(m_graphUndoCursor.index, new SerializedState()
            {
                serializedGraph = graph.Backup()
            });
        }
Example #2
0
        public VFXGraphUndoStack(VFXGraph initialState)
        {
            m_graphUndoCursor = ScriptableObject.CreateInstance <VFXGraphUndoCursor>();

            m_graphUndoCursor.hideFlags = HideFlags.HideAndDontSave;
            m_undoStack = new SortedDictionary <int, SerializedState>();

            m_graphUndoCursor.index = 0;
            m_lastGraphUndoCursor   = 0;
            m_undoStack.Add(0, new SerializedState()
            {
                serializedGraph = initialState.Backup()
            });
            m_Graph = initialState;
        }