public override void SetSelection(MeshSelection selection) { m_edgeSelection.Clear(); m_selection.Clear(); if (selection != null) { selection = selection.ToEdges(false); foreach (KeyValuePair <GameObject, IList <Edge> > kvp in selection.SelectedEdges) { PBMesh pbMesh = kvp.Key.GetComponent <PBMesh>(); if (pbMesh.IsMarkedAsDestroyed) { continue; } m_edgeSelection.Add(kvp.Key.GetComponent <ProBuilderMesh>(), kvp.Value); } } }
public override MeshSelection Unselect(Material material) { MeshSelection selection = IMeshEditorExt.Select(material); selection = selection.ToEdges(true, false); foreach (KeyValuePair <GameObject, IList <Edge> > kvp in selection.UnselectedEdges.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.UnselectedEdges.Remove(kvp.Key); } else { m_edgeSelection.Remove(mesh, edges); } } if (selection.UnselectedEdges.Count == 0) { return(null); } return(selection); }