protected override void AdditionalMenuItems() { Add(new MenuSeparator()); //add before Add(new MenuItemButton(BGEditorUtility.LoadTexture2D(BGEditorUtility.Image.BGPointInsertBefore123), "Insert a point before this point", () => { var curve = point.Curve; var settings = BGPrivateField.GetSettings(curve); var index = curve.IndexOf(point); curve.AddPoint(BGNewPointPositionManager.InsertBefore(curve, index, settings.ControlType, settings.Sections), index); })); //add after Add(new MenuItemButton(BGEditorUtility.LoadTexture2D(BGEditorUtility.Image.BGPointInsertAfter123), "Insert a point after this point", () => { var curve = point.Curve; var settings = BGPrivateField.GetSettings(curve); var index = curve.IndexOf(point); curve.AddPoint(BGNewPointPositionManager.InsertAfter(curve, index, settings.ControlType, settings.Sections), index + 1); })); //add remove to selection addToSelectionItem = new MenuItemButton(BGEditorUtility.LoadTexture2D(BGEditorUtility.Image.BGSelectionAdd123), "Add this point to selection", () => EditorSelection.Add(point)); removeFromSelectionItem = new MenuItemButton(BGEditorUtility.LoadTexture2D(BGEditorUtility.Image.BGSelectionRemove123), "Remove this point from selection", () => EditorSelection.Remove(point)); Add(addToSelectionItem); Add(removeFromSelectionItem); }
private void PointButtons(BGCurvePointI point, int index, BGCurveSettings settings) { if (!settings.ShowPointMenu) { return; } var curve = point.Curve; //================== Copy if (BGEditorUtility.ButtonWithIcon(BGBinaryResources.BGCopy123, PointCopyPaste.Instance.CopyTooltip)) { PointCopyPaste.Instance.Copy(point); } GUILayout.Space(2); //================== Paste if (BGEditorUtility.ButtonWithIcon(BGBinaryResources.BGPaste123, PointCopyPaste.Instance.PasteTooltip)) { PointCopyPaste.Instance.Paste(point); } GUILayout.Space(2); //================== Add before if (BGEditorUtility.ButtonWithIcon(BGBinaryResources.BGAdd123, "Insert a point before this point")) { BGCurveEditor.AddPoint(curve, BGNewPointPositionManager.InsertBefore(curve, index, settings.ControlType, settings.Sections), index); } GUILayout.Space(2); //=========================== Move Up if (index > 0 && BGEditorUtility.ButtonWithIcon(BGBinaryResources.BGMoveUp123, "Move the point up")) { curve.Swap(index - 1, index); } GUILayout.Space(2); //=========================== Move Down if (index < curve.PointsCount - 1 && BGEditorUtility.ButtonWithIcon(BGBinaryResources.BGMoveDown123, "Move the point down")) { curve.Swap(index, index + 1); } GUILayout.Space(2); //=========================== Delete if (BGEditorUtility.ButtonWithIcon(BGBinaryResources.BGDelete123, "Delete the point")) { BGCurveEditor.DeletePoint(curve, index); if (editorSelection != null) { editorSelection.Remove(point); } GUIUtility.ExitGUI(); } }
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(); } }