private void Move(Vector2 delta)
        {
            for (int i = 0; i < m_selection.Count; ++i)
            {
                ManualUVSelection selection = m_selection[i];
                PBMesh            mesh      = selection.Mesh;
                Vector2[]         textures  = mesh.Textures;
                foreach (int index in m_indexes[i])
                {
                    textures[index] = m_initialUVs[i][index] + delta;
                }
                mesh.Textures = textures;
                mesh.RefreshUV();
            }

            if (UVChanged != null)
            {
                UVChanged();
            }
        }
        private void RecordUV(GameObject[] gameObjects, Vector2[][] oldUv, Vector2[][] newUv)
        {
            m_editor.Undo.CreateRecord(record =>
            {
                for (int i = 0; i < gameObjects.Length; ++i)
                {
                    GameObject go = gameObjects[i];
                    PBMesh mesh   = go.GetComponent <PBMesh>();
                    mesh.Textures = newUv[i];
                    mesh.RefreshUV();
                }

                RefreshPivotPoint();

                if (UVChanged != null)
                {
                    UVChanged();
                }
                return(true);
            },
                                       record =>
            {
                for (int i = 0; i < gameObjects.Length; ++i)
                {
                    GameObject go = gameObjects[i];
                    PBMesh mesh   = go.GetComponent <PBMesh>();
                    mesh.Textures = oldUv[i];
                    mesh.RefreshUV();
                }

                RefreshPivotPoint();

                if (UVChanged != null)
                {
                    UVChanged();
                }

                return(true);
            });
        }
        public void Scale()
        {
            Vector2 scale = m_pivotPoint.transform.localScale;

            for (int i = 0; i < m_selection.Count; ++i)
            {
                ManualUVSelection selection = m_selection[i];
                PBMesh            mesh      = selection.Mesh;
                Vector2[]         textures  = mesh.Textures;
                foreach (int index in m_indexes[i])
                {
                    textures[index] = m_initialUV + Vector2.Scale((m_initialUVs[i][index] - m_initialUV), scale);
                }
                mesh.Textures = textures;
                mesh.RefreshUV();
            }

            if (UVChanged != null)
            {
                UVChanged();
            }
        }
        public void Rotate()
        {
            Vector2 uv    = ManualUVRenderer.WorldToUV(m_pivotPoint.transform.position);
            float   angle = -m_pivotPoint.transform.eulerAngles.z;

            for (int i = 0; i < m_selection.Count; ++i)
            {
                ManualUVSelection selection = m_selection[i];
                PBMesh            mesh      = selection.Mesh;
                Vector2[]         textures  = mesh.Textures;
                foreach (int index in m_indexes[i])
                {
                    textures[index] = (m_initialUVs[i][index]).RotateAroundPoint(uv, angle);
                }
                mesh.Textures = textures;
                mesh.RefreshUV();
            }

            if (UVChanged != null)
            {
                UVChanged();
            }
        }