Exemple #1
0
        public override MeshSelection Unselect(Material material)
        {
            MeshSelection selection = IMeshEditorExt.Select(material);

            selection.FacesToEdges(true);

            foreach (KeyValuePair <ProBuilderMesh, IList <Edge> > kvp in selection.UnselectedEdges.ToArray())
            {
                m_edgeSelection.FindCoincidentEdges(kvp.Key);
                IList <Edge> edges = m_edgeSelection.GetCoincidentEdges(kvp.Value).ToList();

                for (int i = edges.Count - 1; i >= 0; i--)
                {
                    Edge edge = edges[i];
                    if (!m_edgeSelection.IsSelected(kvp.Key, edge))
                    {
                        edges.Remove(edge);
                    }
                }

                if (edges.Count == 0)
                {
                    selection.UnselectedEdges.Remove(kvp.Key);
                }
                else
                {
                    m_edgeSelection.Remove(kvp.Key, edges);
                }
            }
            if (selection.UnselectedEdges.Count == 0)
            {
                return(null);
            }
            return(selection);
        }
Exemple #2
0
        public override MeshSelection Unselect(Material material)
        {
            MeshSelection selection = IMeshEditorExt.Select(material);

            selection.Invert();

            m_faceSelection.BeginChange();
            foreach (KeyValuePair <ProBuilderMesh, IList <int> > kvp in selection.UnselectedFaces.ToArray())
            {
                IList <int> faces = kvp.Value;
                for (int i = faces.Count - 1; i >= 0; i--)
                {
                    int face = faces[i];
                    if (!m_faceSelection.IsSelected(face))
                    {
                        faces.Remove(face);
                    }
                    else
                    {
                        m_faceSelection.Remove(face);
                    }
                }

                if (faces.Count == 0)
                {
                    selection.UnselectedFaces.Remove(kvp.Key);
                }
            }
            m_faceSelection.EndChange();
            if (selection.UnselectedFaces.Count == 0)
            {
                return(null);
            }
            return(selection);
        }
        public override MeshSelection Unselect(Material material)
        {
            MeshSelection selection = IMeshEditorExt.Select(material);

            selection = selection.ToVertices(true);

            foreach (KeyValuePair <GameObject, IList <int> > kvp in selection.UnselectedIndices.ToArray())
            {
                IList <int>    indices = kvp.Value;
                ProBuilderMesh mesh    = kvp.Key.GetComponent <ProBuilderMesh>();
                for (int i = indices.Count - 1; i >= 0; i--)
                {
                    int index = indices[i];
                    if (!m_vertexSelection.IsSelected(mesh, index))
                    {
                        indices.Remove(index);
                    }
                }

                if (indices.Count == 0)
                {
                    selection.UnselectedIndices.Remove(kvp.Key);
                }
                else
                {
                    m_vertexSelection.Remove(mesh, indices);
                }
            }
            if (selection.UnselectedIndices.Count == 0)
            {
                return(null);
            }
            return(selection);
        }
Exemple #4
0
        public override MeshSelection Select(Material material)
        {
            MeshSelection selection = IMeshEditorExt.Select(material);

            selection.FacesToVertices(false);

            foreach (KeyValuePair <ProBuilderMesh, IList <int> > kvp in selection.SelectedIndices.ToArray())
            {
                IList <int> indices = kvp.Value;
                for (int i = indices.Count - 1; i >= 0; i--)
                {
                    int index = indices[i];
                    if (m_vertexSelection.IsSelected(kvp.Key, index))
                    {
                        indices.Remove(index);
                    }
                }

                if (indices.Count == 0)
                {
                    selection.SelectedIndices.Remove(kvp.Key);
                }
                else
                {
                    m_vertexSelection.Add(kvp.Key, indices);
                }
            }
            if (selection.SelectedIndices.Count == 0)
            {
                return(null);
            }
            return(selection);
        }
        public override MeshSelection Select(Material material)
        {
            MeshSelection selection = IMeshEditorExt.Select(material);

            m_faceSelection.BeginChange();
            foreach (KeyValuePair <GameObject, IList <int> > kvp in selection.SelectedFaces.ToArray())
            {
                IList <int>    faces = kvp.Value;
                ProBuilderMesh mesh  = kvp.Key.GetComponent <ProBuilderMesh>();
                for (int i = faces.Count - 1; i >= 0; i--)
                {
                    int face = faces[i];
                    if (m_faceSelection.IsSelected(mesh, face))
                    {
                        faces.Remove(face);
                    }
                    else
                    {
                        m_faceSelection.Add(mesh, face);
                    }
                }

                if (faces.Count == 0)
                {
                    selection.SelectedFaces.Remove(kvp.Key);
                }
            }
            m_faceSelection.EndChange();
            if (selection.SelectedFaces.Count == 0)
            {
                return(null);
            }
            return(selection);
        }
Exemple #6
0
        public override MeshSelection Select(Material material)
        {
            MeshSelection selection = IMeshEditorExt.Select(material);

            selection = selection.ToEdges(false, false);

            foreach (KeyValuePair <GameObject, IList <Edge> > kvp in selection.SelectedEdges.ToArray())
            {
                ProBuilderMesh mesh = kvp.Key.GetComponent <ProBuilderMesh>();
                m_edgeSelection.FindCoincidentEdges(mesh);
                IList <Edge> edges = m_edgeSelection.GetCoincidentEdges(kvp.Value).ToList();

                for (int i = edges.Count - 1; i >= 0; i--)
                {
                    Edge edge = edges[i];
                    if (m_edgeSelection.IsSelected(mesh, edge))
                    {
                        edges.Remove(edge);
                    }
                }

                if (edges.Count == 0)
                {
                    selection.SelectedEdges.Remove(kvp.Key);
                }
                else
                {
                    m_edgeSelection.Add(mesh, edges);
                }
            }
            if (selection.SelectedEdges.Count == 0)
            {
                return(null);
            }
            return(selection);
        }