private void ClearSelection() { SplineEditorCache.RigisterUndo("Edit Selection"); SplineEditorCache.ClearSelection(); GUI.changed = true; }
private bool InitializeCheck() { if (target != SplineEditorCache.GetTarget()) { InvalidateShapeEditor(); SplineEditorCache.ClearSelection(); SplineEditorCache.SetTarget(target); } if (target != null && m_SplineEditor == null) { SetupSpriteShapeEditor(target.spline); } return(target != null); }
private void DoRectSelectionGUI() { Debug.Assert(m_Spline != null); var selection = SplineEditorCache.GetSelection(); if (m_RectSelectionID == -1) { m_RectSelectionID = GUIUtility.GetControlID("RectSelection".GetHashCode(), FocusType.Passive); } if (Event.current.GetTypeForControl(m_RectSelectionID) == EventType.MouseDown && Event.current.button == 0) { if (!Event.current.shift && !EditorGUI.actionKey) { SplineEditorCache.RigisterUndo("Edit Selection"); SplineEditorCache.ClearSelection(); GUI.changed = true; } } if (Event.current.GetTypeForControl(m_RectSelectionID) == EventType.MouseUp && Event.current.button == 0) { SplineEditorCache.RigisterUndo("Edit Selection"); selection.EndSelection(true); GUI.changed = true; } EditorGUI.BeginChangeCheck(); var selectionRect = m_RectSelectionTool.Do(m_RectSelectionID, GetTransform().position); if (EditorGUI.EndChangeCheck()) { selection.BeginSelection(); for (int i = 0; i < m_Spline.GetPointCount(); ++i) { if (selectionRect.Contains(HandleUtility.WorldToGUIPoint(LocalToWorld(m_Spline.GetPosition(i))), true)) { selection.Select(i, true); } } } }
private void SelectPoint(int index) { ISelection selection = SplineEditorCache.GetSelection(); bool additive = currentEvent.shift; bool subtractive = EditorGUI.actionKey; SplineEditorCache.RigisterUndo("Edit Selection"); if (!additive && !subtractive) { SplineEditorCache.ClearSelection(); } selection.Select(index, (!selection.IsSelected(index) || additive) && !subtractive); GUI.changed = true; }