private void OnBoxSelection(object sender, BoxSelectionArgs e) { IMeshEditor meshEditor = m_meshEditors[(int)m_mode]; if (meshEditor == null) { return; } RuntimeWindow window = m_rte.ActiveWindow; Vector2 min = m_boxSelection.SelectionBounds.min; Vector2 max = m_boxSelection.SelectionBounds.max; RectTransform rt = window.GetComponent <RectTransform>(); Rect rect = new Rect(new Vector2(min.x, rt.rect.height - max.y), m_boxSelection.SelectionBounds.size); MeshSelection selection = meshEditor.Select(window.Camera, rect, e.GameObjects.Where(g => g.GetComponent <ExposeToEditor>() != null).ToArray(), MeshEditorSelectionMode.Add); m_rte.Undo.BeginRecord(); if (selection != null) { RecordSelection(meshEditor, selection); } m_pivot.position = meshEditor.Position; m_pivot.rotation = GetPivotRotation(meshEditor); TrySelectPivot(meshEditor); m_rte.Undo.EndRecord(); }
private void OnBoxSelection(object sender, BoxSelectionArgs e) { Bounds selectionBounds = m_selectionComponent.BoxSelection.SelectionBounds; Vector2 min = ManualUVRenderer.WorldToUV(Window.Camera.ScreenToWorldPoint(selectionBounds.min)); Vector2 max = ManualUVRenderer.WorldToUV(Window.Camera.ScreenToWorldPoint(selectionBounds.max)); switch (m_tool.Mode) { case ProBuilderToolMode.Vertex: m_uvEditor.SelectVertices(uv => (min.x <= uv.x && min.y <= uv.y && uv.x <= max.x && uv.y <= max.y) ? 0 : 1, false, !SelectMultipleAction()); break; case ProBuilderToolMode.Face: m_uvEditor.SelectFaces(uv => (min.x <= uv.x && min.y <= uv.y && uv.x <= max.x && uv.y <= max.y) ? 0 : 1, false, !SelectMultipleAction()); break; default: m_uvEditor.SelectEdges((uv0, uv1) => PBMath.Intersects(min, max, uv0, uv1) ? 0 : 1, false, !SelectMultipleAction()); break; } m_uvEditor.RefreshPivotPoint(); }