private void UpdatePoints(Rect rect) { var sceneViewHeight = BGEditorUtility.GetSceneViewHeight(); var math = editor.Math; curve.ForEach((point, index, count) => { //add or remove from selection if (rect.Contains(BGEditorUtility.GetSceneViewPosition(math.GetPosition(index), sceneViewHeight))) { selection.Add(point); } else { selection.Remove(point); } }); if (!selection.Changed) { return; } selection.Reset(); }
private void PointButtons(BGCurvePoint point, int index, BGCurveSettings settings) { if (!settings.ShowPointMenu) { return; } var curve = point.Curve; //================== Add before if (BGEditorUtility.ButtonWithIcon(addBeforeTexture, "Insert a point before this point")) { curve.AddPoint(BGNewPointPositionManager.InsertBefore(curve, index, settings.ControlType, settings.Sections), index); } GUILayout.Space(2); //=========================== Move Up if (index > 0 && BGEditorUtility.ButtonWithIcon(moveUpTexture, "Move the point up")) { curve.Swap(index - 1, index); } GUILayout.Space(2); //=========================== Move Down if (index < curve.PointsCount - 1 && BGEditorUtility.ButtonWithIcon(moveDownTexture, "Move the point down")) { curve.Swap(index, index + 1); } GUILayout.Space(2); //=========================== Delete if (BGEditorUtility.ButtonWithIcon(deleteTexture, "Delete the point")) { curve.Delete(index); editorSelection.Remove(point); GUIUtility.ExitGUI(); } }