void VertexSelectionToolbox() { if (plotter.VertexSelectionCount > 0) { GUI.color = VertexSelectionToolbarColor; EditorGUILayout.LabelField("Vertex Selection", EditorStyles.boldLabel); EditorGUILayout.BeginHorizontal(); if (GUILayout.Button("Clear", EditorStyles.miniButton)) { plotter.ClearVertexSelection(); SceneView.lastActiveSceneView.Repaint(); } if (GUILayout.Button("Duplicate And Select", EditorStyles.miniButton)) { // Copy current selection HashSet <HairyPlotterVertex> prevSelection = new HashSet <HairyPlotterVertex>(plotter.SelectedVertices); // Clear current selection plotter.ClearVertexSelection(); // Duplicate each foreach (HairyPlotterVertex v in prevSelection) { plotter.AddSelection(plotter.CreateVertex(v.Position, v.Uv)); } } GUI.color = plotter.CurrentAction == HairyPlotterActions.TriangleSwitch ? ActiveUvEditorColor : VertexSelectionToolbarColor; if (GUILayout.Button("Switch In Triangle", EditorStyles.miniButton)) { if (plotter.CurrentAction == HairyPlotterActions.TriangleSwitch) { plotter.CurrentAction = HairyPlotterActions.None; } else { if (plotter.SelectedVertices.Count == 2) { plotter.CurrentAction = HairyPlotterActions.TriangleSwitch; } else { Debug.LogWarning("Switch In Triangle requires exactly two selected vertices"); } } } GUI.color = VertexSelectionToolbarColor; if (plotter.CurrentAction == HairyPlotterActions.VertexDelete) { if (GUILayout.Button("Yes!", EditorStyles.miniButton)) { plotter.CurrentAction = HairyPlotterActions.None; foreach (HairyPlotterVertex vertex in plotter.SelectedVertices) { plotter.DestroyVertex(vertex); } } if (GUILayout.Button("No!", EditorStyles.miniButton)) { plotter.CurrentAction = HairyPlotterActions.None; } } else { if (GUILayout.Button("Delete Selected", EditorStyles.miniButton)) { plotter.CurrentAction = HairyPlotterActions.VertexDelete; } } EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); GUILayout.Label("All"); plotter.SelectionPosition = EditVector3(plotter.SelectionPosition); EditorGUILayout.EndHorizontal(); if (plotter.SelectionPosition.x != float.MaxValue) { plotter.ToEachSelection(v => v.Position.x = plotter.SelectionPosition.x); } if (plotter.SelectionPosition.y != float.MaxValue) { plotter.ToEachSelection(v => v.Position.y = plotter.SelectionPosition.y); } if (plotter.SelectionPosition.z != float.MaxValue) { plotter.ToEachSelection(v => v.Position.z = plotter.SelectionPosition.z); } } List <HairyPlotterVertex> selectedVertices = plotter.SelectedVertices; foreach (HairyPlotterVertex vertex in selectedVertices) { EditorGUILayout.BeginHorizontal(); // Vertex index GUILayout.Label("#" + vertex.Index); // Lets us deselect a specific vertex if (GUILayout.Button("Deselect", EditorStyles.miniButton)) { plotter.RemoveSelection(vertex); } // Edit XYZ of vertex Vector3 pos = EditVector3(vertex.Position); // When editing UVs allow switching if (selectedVertices.Count > 1 && plotter.CurrentAction == HairyPlotterActions.VertexUvEdit) { if (GUILayout.Button("Edit UVs")) { plotter.SetUvEditVertex(vertex); } } EditorGUILayout.EndHorizontal(); // If position was updated if (pos != vertex.Position) { vertex.Position = pos; plotter.Dirty = true; plotter.ResetSelectionPosition(); } } GUI.color = Color.white; }