Пример #1
0
        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);
        }
Пример #2
0
        public override void SetSelection(MeshSelection selection)
        {
            m_vertexSelection.Clear();
            m_selection.Clear();

            if (selection != null)
            {
                selection = selection.ToVertices(false);
                foreach (KeyValuePair <GameObject, IList <int> > kvp in selection.SelectedIndices)
                {
                    PBMesh pbMesh = kvp.Key.GetComponent <PBMesh>();
                    if (pbMesh.IsMarkedAsDestroyed)
                    {
                        continue;
                    }

                    m_vertexSelection.Add(kvp.Key.GetComponent <ProBuilderMesh>(), kvp.Value);
                }
            }
        }