Пример #1
0
        public void PushUndo()
        {
            var mesh = SVTXPainterUtils.GetMesh(gameObject);

            if (mesh != null)
            {
                m_record.index = m_historyIndex;
                m_historyIndex++;
                var colors = mesh.colors;
                m_record.colors = new Color[colors.Length];
                Array.Copy(colors, m_record.colors, colors.Length);
                Undo.RegisterCompleteObjectUndo(this, "Simple Vertex Painter [" + m_record.index + "]");
                //Debug.Log("Change Vertex Color");
            }
        }
Пример #2
0
        public void OnUndoRedo()
        {
            var mesh = SVTXPainterUtils.GetMesh(gameObject);

            if (mesh == null)
            {
                return;
            }
            if (m_historyIndex != m_record.index)
            {
                m_historyIndex = m_record.index;
                if (m_record.colors != null && mesh.colors != null && m_record.colors.Length == mesh.colors.Length)
                {
                    mesh.colors = m_record.colors;
                    //Debug.Log("UndoRedo");
                }
            }
        }